Tensor

Struct Tensor 

Source
pub struct Tensor { /* private fields */ }

Implementations§

Source§

impl Tensor

Source

pub fn new(primal: DynTensor) -> Self

Source

pub fn from_slice<T>(data: &[T], dims: &[usize]) -> Result<Self>
where T: DynTensorTyped + Copy,

Source

pub fn scalar_type(&self) -> ScalarType

Source

pub fn dims(&self) -> &[usize]

Source

pub fn ndim(&self) -> usize

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn axis_classes(&self) -> &[usize]

Source

pub fn is_dense(&self) -> bool

Source

pub fn is_diag(&self) -> bool

Source

pub fn requires_grad(&self) -> bool

Source

pub fn with_requires_grad(self, enabled: bool) -> Self

Source

pub fn detach(&self) -> Self

Source

pub fn to_dense(&self) -> Result<Self>

Source

pub fn grad(&self) -> Result<Option<Self>>

Source

pub fn zero_grad(&self) -> Result<()>

Source

pub fn backward(&self) -> Result<()>

Source

pub fn backward_with_seed(&self, seed: &Self) -> Result<()>

Source

pub fn shares_reverse_graph(&self, other: &Self) -> bool

Source

pub fn add(&self, rhs: &Self) -> Result<Self>

Source

pub fn exp(&self) -> Result<Self>

Source

pub fn sum(&self) -> Result<Self>

Source

pub fn einsum(subscripts: &str, operands: &[&Self]) -> Result<Self>

Source

pub fn solve(&self, rhs: &Self) -> Result<Self>

Source

pub fn lstsq(&self, rhs: &Self) -> Result<LstsqResult>

Source

pub fn solve_triangular(&self, rhs: &Self, upper: bool) -> Result<Self>

Source

pub fn det(&self) -> Result<Self>

Source

pub fn inv(&self) -> Result<Self>

Source

pub fn slogdet(&self) -> Result<SlogdetResult>

Source

pub fn cholesky(&self) -> Result<Self>

Source

pub fn lu(&self, pivot: LuPivot) -> Result<LuResult>

Source

pub fn norm(&self, kind: NormKind) -> Result<Self>

Source

pub fn vector_norm( &self, ord: VectorNormOrd, dim: Option<&[isize]>, keepdim: bool, ) -> Result<Self>

Source

pub fn matrix_norm( &self, ord: MatrixNormOrd, dim: Option<(isize, isize)>, keepdim: bool, ) -> Result<Self>

Source

pub fn qr(&self) -> Result<QrResult>

Source

pub fn svd(&self, options: Option<SvdOptions>) -> Result<SvdResult>

Source

pub fn eig(&self) -> Result<EigResult>

Source

pub fn eigh(&self) -> Result<EighResult>

Source

pub fn pinv(&self, rcond: Option<f64>) -> Result<Self>

Source

pub fn matrix_exp(&self) -> Result<Self>

Source

pub fn try_to_vec<T>(&self) -> Result<Vec<T>>
where T: DynTensorTyped + Copy,

Source

pub fn try_get<T>(&self, index: &[usize]) -> Result<T>
where T: DynTensorTyped + Copy,

Trait Implementations§

Source§

impl Debug for Tensor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<DynTensor> for Tensor

Source§

fn from(value: DynTensor) -> Self

Converts to this type from the input type.
Source§

impl<T> From<StructuredTensor<T>> for Tensor
where T: DynTensorTyped + Copy,

Source§

fn from(value: StructuredTensor<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Tensor<T>> for Tensor
where T: DynTensorTyped + Copy,

Source§

fn from(value: DenseTensor<T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !Freeze for Tensor

§

impl !RefUnwindSafe for Tensor

§

impl Send for Tensor

§

impl Sync for Tensor

§

impl Unpin for Tensor

§

impl !UnwindSafe for Tensor

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

§

impl<T> DistributionExt for T
where T: ?Sized,

§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

§

impl<T> MaybeSend for T

§

impl<T> MaybeSendSync for T

§

impl<T> MaybeSync for T