pub struct Tensor<T: TensorScalar, const N: usize>(/* private fields */);Expand description
Rank-N tensor backed by tenferro_tensor::TypedTensor<T>.
Implementations§
Source§impl<T: TensorScalar, const N: usize> Tensor<T, N>
impl<T: TensorScalar, const N: usize> Tensor<T, N>
Sourcepub fn to_row_major_vec(&self) -> Vec<T>
pub fn to_row_major_vec(&self) -> Vec<T>
Export the tensor as a row-major flat vector.
Sourcepub fn iter(&self) -> TensorIter<'_, T, N> ⓘ
pub fn iter(&self) -> TensorIter<'_, T, N> ⓘ
Iterate over all elements in row-major order.
Sourcepub fn iter_mut(&mut self) -> TensorIterMut<'_, T, N> ⓘ
pub fn iter_mut(&mut self) -> TensorIterMut<'_, T, N> ⓘ
Iterate mutably over all elements in row-major order.
Sourcepub fn as_inner_mut(&mut self) -> &mut TfTensor<T>
pub fn as_inner_mut(&mut self) -> &mut TfTensor<T>
Mutably borrow the wrapped tenferro tensor.
Sourcepub fn into_inner(self) -> TfTensor<T>
pub fn into_inner(self) -> TfTensor<T>
Consume this wrapper and return the inner tenferro tensor.
Sourcepub fn from_tenferro(tensor: TfTensor<T>) -> Self
pub fn from_tenferro(tensor: TfTensor<T>) -> Self
Wrap an existing tenferro tensor, panicking on rank mismatch.
Trait Implementations§
impl<T: TensorScalar + Eq, const N: usize> Eq for Tensor<T, N>
Auto Trait Implementations§
impl<T, const N: usize> Freeze for Tensor<T, N>
impl<T, const N: usize> RefUnwindSafe for Tensor<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for Tensor<T, N>
impl<T, const N: usize> Sync for Tensor<T, N>
impl<T, const N: usize> Unpin for Tensor<T, N>where
T: Unpin,
impl<T, const N: usize> UnsafeUnpin for Tensor<T, N>
impl<T, const N: usize> UnwindSafe for Tensor<T, N>where
T: UnwindSafe,
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more