[][src]Struct autograd::tensor::Tensor

pub struct Tensor<T: Float>(pub Rc<TensorCore<T>>);

Symbolic multi-dimensional array.

Methods

impl<T: Float> Tensor<T>[src]

pub fn get_persistent_array(&self) -> Option<&NdArray<T>>[src]

Returns a reference to the persistent array.

Returns Some if this tensor is made from ag::variable or ag::constant.

pub unsafe fn get_persistent_array_mut(&self) -> Option<&mut NdArray<T>>[src]

Returns a mutable reference to the persistent array.

Returns Some if this tensor is made from ag::variable.

pub fn has_persistent_array(&self) -> bool[src]

Returns True if this tensor is made from ag::variable or ag::constant.

impl<'a, 'b: 'a, 'c: 'a, T: Float + 'b + 'c> Tensor<T>[src]

pub fn builder() -> TensorBuilder<T>[src]

pub fn eval<I>(&self, feeds: I) -> Option<NdArray<T>> where
    I: IntoIterator<Item = &'a (&'b Tensor<T>, &'c Array<T, IxDyn>)>, 
[src]

Evaluates this tensor as an ndarray's array object.

See eval.

pub fn shape(&self) -> Tensor<T>[src]

Returns the (symbolic) shape of this tensor.

See shape.

pub fn rank(&self) -> Tensor<T>[src]

Returns the (symbolic) rank of this tensor.

See rank.

pub fn size(&self) -> Tensor<T>[src]

Returns the (symbolic) size of this tensor.

See size.

impl<T: Float> Tensor<T>[src]

pub fn get(&self, i: isize) -> Tensor<T>[src]

Looks up a symbolic element from this tensor.

Index i can be negative.

extern crate ndarray;
extern crate autograd as ag;

let ref a = ag::variable(ndarray::arr2(&[[2., 3.], [4., 5.]]));
let ref b = a.get(2);

assert_eq!(b.eval(&[]).unwrap()[ndarray::IxDyn(&[])], 4.);

Methods from Deref<Target = Rc<TensorCore<T>>>

Trait Implementations

impl<T: Float> ArrayLike<T> for Tensor<T>[src]

impl<T: Float> Clone for Tensor<T>[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a, T: Float> Ord for &'a Tensor<T>[src]

fn cmp(&self, other: &&'a Tensor<T>) -> Ordering[src]

Compares the addresses of the two tensors. This can be used for ordering-based data structures (e.g. BinaryTree).

default fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

default fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

default fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<T: Float> Eq for Tensor<T>[src]

impl<'a, T: Float> PartialOrd<&'a Tensor<T>> for &'a Tensor<T>[src]

fn partial_cmp(&self, other: &&'a Tensor<T>) -> Option<Ordering>[src]

Compares the addresses of the two tensors. This can be used for ordering-based data structures (e.g. BinaryTree).

#[must_use]
default fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
default fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
default fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
default fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Float> PartialEq<Tensor<T>> for Tensor<T>[src]

#[must_use]
default fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<T: Float> AsRef<Tensor<T>> for Tensor<T>[src]

impl<T: Float> Display for Tensor<T>[src]

impl<T: Float> Debug for Tensor<T>[src]

impl<T: Float> Add<T> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the + operator.

impl<'a, T: Float> Add<T> for &'a Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the + operator.

impl<T: Float> Add<Tensor<T>> for f64[src]

type Output = Tensor<T>

The resulting type after applying the + operator.

impl<'a, T: Float> Add<&'a Tensor<T>> for f64[src]

type Output = Tensor<T>

The resulting type after applying the + operator.

impl<T: Float> Add<Tensor<T>> for f32[src]

type Output = Tensor<T>

The resulting type after applying the + operator.

impl<'a, T: Float> Add<&'a Tensor<T>> for f32[src]

type Output = Tensor<T>

The resulting type after applying the + operator.

impl<T: Float> Add<Tensor<T>> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the + operator.

impl<'a, T: Float> Add<&'a Tensor<T>> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the + operator.

impl<'a, T: Float> Add<Tensor<T>> for &'a Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the + operator.

impl<'a, 'b, T: Float> Add<&'a Tensor<T>> for &'b Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the + operator.

impl<T: Float> Sub<T> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the - operator.

impl<'a, T: Float> Sub<T> for &'a Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the - operator.

impl<T: Float> Sub<Tensor<T>> for f64[src]

type Output = Tensor<T>

The resulting type after applying the - operator.

impl<'a, T: Float> Sub<&'a Tensor<T>> for f64[src]

type Output = Tensor<T>

The resulting type after applying the - operator.

impl<T: Float> Sub<Tensor<T>> for f32[src]

type Output = Tensor<T>

The resulting type after applying the - operator.

impl<'a, T: Float> Sub<&'a Tensor<T>> for f32[src]

type Output = Tensor<T>

The resulting type after applying the - operator.

impl<T: Float> Sub<Tensor<T>> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the - operator.

impl<'a, T: Float> Sub<&'a Tensor<T>> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the - operator.

impl<'a, T: Float> Sub<Tensor<T>> for &'a Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the - operator.

impl<'a, 'b, T: Float> Sub<&'a Tensor<T>> for &'b Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the - operator.

impl<T: Float> Mul<T> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the * operator.

impl<'a, T: Float> Mul<T> for &'a Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the * operator.

impl<T: Float> Mul<Tensor<T>> for f64[src]

type Output = Tensor<T>

The resulting type after applying the * operator.

impl<'a, T: Float> Mul<&'a Tensor<T>> for f64[src]

type Output = Tensor<T>

The resulting type after applying the * operator.

impl<T: Float> Mul<Tensor<T>> for f32[src]

type Output = Tensor<T>

The resulting type after applying the * operator.

impl<'a, T: Float> Mul<&'a Tensor<T>> for f32[src]

type Output = Tensor<T>

The resulting type after applying the * operator.

impl<T: Float> Mul<Tensor<T>> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the * operator.

impl<'a, T: Float> Mul<&'a Tensor<T>> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the * operator.

impl<'a, T: Float> Mul<Tensor<T>> for &'a Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the * operator.

impl<'a, 'b, T: Float> Mul<&'a Tensor<T>> for &'b Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the * operator.

impl<T: Float> Div<T> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the / operator.

impl<'a, T: Float> Div<T> for &'a Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the / operator.

impl<T: Float> Div<Tensor<T>> for f64[src]

type Output = Tensor<T>

The resulting type after applying the / operator.

impl<'a, T: Float> Div<&'a Tensor<T>> for f64[src]

type Output = Tensor<T>

The resulting type after applying the / operator.

impl<T: Float> Div<Tensor<T>> for f32[src]

type Output = Tensor<T>

The resulting type after applying the / operator.

impl<'a, T: Float> Div<&'a Tensor<T>> for f32[src]

type Output = Tensor<T>

The resulting type after applying the / operator.

impl<T: Float> Div<Tensor<T>> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the / operator.

impl<'a, T: Float> Div<&'a Tensor<T>> for Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the / operator.

impl<'a, T: Float> Div<Tensor<T>> for &'a Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the / operator.

impl<'a, 'b, T: Float> Div<&'a Tensor<T>> for &'b Tensor<T>[src]

type Output = Tensor<T>

The resulting type after applying the / operator.

impl<T: Float> Deref for Tensor<T>[src]

type Target = Rc<TensorCore<T>>

The resulting type after dereferencing.

impl<T: Float> DerefMut for Tensor<T>[src]

Auto Trait Implementations

impl<T> !Send for Tensor<T>

impl<T> !Sync for Tensor<T>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]