pub struct Tensor(/* private fields */);
Implementations§
source§impl Tensor
impl Tensor
pub fn new( backend: impl Into<Box<dyn Backend>>, dtype: DType, shape: impl Shape, primitive: impl Into<Box<dyn Primitive>>, inputs: impl Into<Vec<Tensor>> ) -> Self
pub fn id(&self) -> usize
pub fn backend(&self) -> &dyn Backend
pub fn dtype(&self) -> DType
pub fn primitive(&self) -> &dyn Primitive
pub fn inputs(&self) -> impl Deref<Target = [Tensor]> + '_
pub fn full( val: f64, shape: impl Shape, dtype: DType, backend: impl Into<Box<dyn Backend>> + Debug ) -> Tensor
pub fn ones( shape: impl Shape, dtype: DType, backend: impl Into<Box<dyn Backend>> + Debug ) -> Tensor
pub fn zeros( shape: impl Shape, dtype: DType, backend: impl Into<Box<dyn Backend>> + Debug ) -> Tensor
pub fn full_like(&self, val: f64) -> Tensor
pub fn zeros_like(&self) -> Tensor
pub fn ones_like(&self) -> Tensor
pub fn normal( shape: impl Shape, dtype: DType, backend: impl Into<Box<dyn Backend>> + Debug ) -> Tensor
pub fn arange<T: ArangeArgs>( args: T, backend: impl Into<Box<dyn Backend>> + Debug ) -> Tensor
pub fn matmul<T: AsRef<Tensor>>(&self, rhs: T) -> Tensor
pub fn eq<T: AsRef<Tensor>>(&self, rhs: T) -> Tensor
pub fn ne<T: AsRef<Tensor>>(&self, rhs: T) -> Tensor
pub fn gt<T: AsRef<Tensor>>(&self, rhs: T) -> Tensor
pub fn ge<T: AsRef<Tensor>>(&self, rhs: T) -> Tensor
pub fn lt<T: AsRef<Tensor>>(&self, rhs: T) -> Tensor
pub fn le<T: AsRef<Tensor>>(&self, rhs: T) -> Tensor
pub fn maximum<T: AsRef<Tensor>>(&self, rhs: T) -> Tensor
pub fn t(&self) -> Tensor
pub fn transpose(&self, dims: impl Into<Vec<usize>> + Debug) -> Tensor
pub fn broadcast_to(&self, shape: impl Shape) -> Tensor
pub fn reshape(&self, shape: impl Shape) -> Tensor
pub fn add<T>(&self, rhs: T) -> Tensor
pub fn mul<T>(&self, rhs: T) -> Tensor
pub fn sin(&self) -> Tensor
pub fn cos(&self) -> Tensor
pub fn square(&self) -> Tensor
pub fn sqrt(&self) -> Tensor
pub fn rsqrt(&self) -> Tensor
pub fn sign(&self) -> Tensor
pub fn abs(&self) -> Tensor
pub fn exp(&self) -> Tensor
pub fn log(&self) -> Tensor
pub fn log2(&self) -> Tensor
pub fn log10(&self) -> Tensor
pub fn sum<T: ReduceArgs>(&self, args: T) -> Tensor
pub fn max<T: ReduceArgs>(&self, args: T) -> Tensor
pub fn min<T: ReduceArgs>(&self, args: T) -> Tensor
pub fn mean<T: ReduceArgs>(&self, args: T) -> Tensor
pub fn as_type(&self, dtype: DType) -> Tensor
pub fn softmax<D: Dim>(&self, d: D) -> Tensor
pub fn log_softmax<D: Dim>(&self, d: D) -> Tensor
pub fn relu(&self) -> Tensor
pub fn jvp(&self, tangent_cache: &mut HashMap<usize, Tensor>) -> Tensor
pub fn vjp(&self, cotangent_cache: &mut HashMap<usize, Tensor>)
pub fn dot_graph(&self) -> String
pub fn detach(&self)
pub fn replace_data(&self, rhs: Tensor)
pub fn set_data<T: TensorLike + 'static>(&self, data: T)
pub fn get_data<T>(&self) -> Option<impl Deref<Target = T> + '_>where
T: 'static,
pub fn is_evaluated(&self) -> bool
Trait Implementations§
source§impl Differentiable for Tensor
impl Differentiable for Tensor
source§impl Ord for Tensor
impl Ord for Tensor
source§impl PartialEq for Tensor
impl PartialEq for Tensor
source§impl PartialOrd for Tensor
impl PartialOrd for Tensor
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Shape for Tensor
impl Shape for Tensor
fn shape(&self) -> &[usize]
fn ndim(&self) -> usize
fn size(&self) -> usize
fn shape_at<I: Dim>(&self, i: I) -> usize
fn shape_until<I: Dim>(&self, i: I) -> &[usize]
fn dim<I: Dim>(&self, i: I) -> usize
fn dims<D: Dims>(&self, d: D) -> Vec<usize>
fn size_of_dims<D: Dims>(&self, d: D) -> usize
fn shape_transpose(&self) -> Vec<usize>
fn shape_eq<S: Shape + ?Sized>(&self, rhs: &S) -> bool
fn shape_ndim_eq<S: Shape + ?Sized>(&self, rhs: &S) -> bool
fn shape_size_eq<S: Shape + ?Sized>(&self, rhs: &S) -> bool
fn shape_broadcast<T: Shape + ?Sized>(&self, rhs: &T) -> Result<Vec<usize>>
fn shape_broadcast_matmul<S: Shape + ?Sized>( &self, rhs: &S ) -> Result<Vec<usize>>
fn shape_reduce<T: AsRef<[usize]>>(&self, dims: T, keep_dim: bool) -> Vec<usize>
source§impl TensorIter for Tensor
impl TensorIter for Tensor
fn tensor_iter(&self) -> impl Iterator<Item = &Tensor>
impl Eq for Tensor
Auto Trait Implementations§
impl !RefUnwindSafe for Tensor
impl !Send for Tensor
impl !Sync for Tensor
impl Unpin for Tensor
impl !UnwindSafe for Tensor
Blanket Implementations§
§impl<'short, T, Target> AsGeneralizedRef<'short, &'short Target> for T
impl<'short, T, Target> AsGeneralizedRef<'short, &'short Target> for T
fn as_generalized_ref(&'short self) -> &'short Target
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