pub struct Tensor<Shape: TensorShape>(/* private fields */);Implementations§
Source§impl<Shape> Tensor<Shape>where
Shape: TensorShape,
impl<Shape> Tensor<Shape>where
Shape: TensorShape,
pub fn from_flat(data: [Float; Shape::SIZE]) -> Self
pub fn from_elem(value: Float) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn rank(&self) -> usize
pub fn as_slice(&self) -> &[Float] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [Float] ⓘ
pub fn at(&self, index: [usize; Shape::RANK]) -> &Float
pub fn set(&mut self, index: [usize; Shape::RANK], value: Float)
pub fn fill(&mut self, value: Float)
pub fn zeros() -> Self
pub fn random() -> Self
pub fn random_with_seed(seed: u64) -> Self
pub fn random_with<R>(rng: &mut R) -> Self
pub fn reshape<NewShape>(self) -> Tensor<NewShape>where
NewShape: TensorShape,
(): ReshapePreservesElementCount<{ Shape::SIZE }, { NewShape::SIZE }>,
pub fn as_ref(&self) -> TensorRef<'_, Shape>
pub fn as_mut(&mut self) -> TensorMut<'_, Shape>
pub fn map_inplace<F>(&mut self, f: F)
pub fn map<F>(&self, f: F) -> Self
pub fn zip_map<F>(&self, rhs: &Self, f: F) -> Self
pub fn sum(&self) -> Float
pub fn mean(&self) -> Float
pub fn slice<T: Iterator>(_range: T)
👎Deprecated:
Tensor::slice is not implemented yet
Source§impl<Shape> Tensor<Shape>where
Shape: NonScalarShape,
impl<Shape> Tensor<Shape>where
Shape: NonScalarShape,
Trait Implementations§
Source§impl<Shape> AddAssign<&Tensor<Shape>> for Tensor<Shape>where
Shape: TensorShape,
impl<Shape> AddAssign<&Tensor<Shape>> for Tensor<Shape>where
Shape: TensorShape,
Source§fn add_assign(&mut self, rhs: &Tensor<Shape>)
fn add_assign(&mut self, rhs: &Tensor<Shape>)
Performs the
+= operation. Read moreSource§impl<Shape> AddAssign<f64> for Tensor<Shape>where
Shape: TensorShape,
impl<Shape> AddAssign<f64> for Tensor<Shape>where
Shape: TensorShape,
Source§fn add_assign(&mut self, rhs: Float)
fn add_assign(&mut self, rhs: Float)
Performs the
+= operation. Read moreSource§impl<Shape> Clone for Tensor<Shape>where
Shape: TensorShape,
impl<Shape> Clone for Tensor<Shape>where
Shape: TensorShape,
Source§impl<Shape> Debug for Tensor<Shape>where
Shape: TensorShape,
impl<Shape> Debug for Tensor<Shape>where
Shape: TensorShape,
Source§impl<Shape> Default for Tensor<Shape>where
Shape: TensorShape,
impl<Shape> Default for Tensor<Shape>where
Shape: TensorShape,
Source§impl<Shape> DivAssign<f64> for Tensor<Shape>where
Shape: TensorShape,
impl<Shape> DivAssign<f64> for Tensor<Shape>where
Shape: TensorShape,
Source§fn div_assign(&mut self, rhs: Float)
fn div_assign(&mut self, rhs: Float)
Performs the
/= operation. Read moreSource§impl<Shape> MulAssign<&Tensor<Shape>> for Tensor<Shape>where
Shape: TensorShape,
impl<Shape> MulAssign<&Tensor<Shape>> for Tensor<Shape>where
Shape: TensorShape,
Source§fn mul_assign(&mut self, rhs: &Tensor<Shape>)
fn mul_assign(&mut self, rhs: &Tensor<Shape>)
Performs the
*= operation. Read moreSource§impl<Shape> MulAssign<f64> for Tensor<Shape>where
Shape: TensorShape,
impl<Shape> MulAssign<f64> for Tensor<Shape>where
Shape: TensorShape,
Source§fn mul_assign(&mut self, rhs: Float)
fn mul_assign(&mut self, rhs: Float)
Performs the
*= operation. Read moreAuto Trait Implementations§
impl<Shape> Freeze for Tensor<Shape>
impl<Shape> RefUnwindSafe for Tensor<Shape>where
Shape: RefUnwindSafe,
impl<Shape> Send for Tensor<Shape>where
Shape: Send,
impl<Shape> Sync for Tensor<Shape>where
Shape: Sync,
impl<Shape> Unpin for Tensor<Shape>where
Shape: Unpin,
impl<Shape> UnsafeUnpin for Tensor<Shape>
impl<Shape> UnwindSafe for Tensor<Shape>where
Shape: UnwindSafe,
Blanket Implementations§
Source§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