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

pub struct Tensor(pub Rc<RawTensor>);

Symbolic multi-dimensional array.

Methods

impl Tensor
[src]

[src]

Evaluates this tensor as a ndarray's array object.

See eval.

[src]

Returns the (symbolic) shape of this tensor.

See shape.

[src]

Returns the (symbolic) rank of this tensor.

See rank.

[src]

Returns the (symbolic) size of this tensor.

See size.

impl Tensor
[src]

[src]

Gets a symbolic element from this tensor with shape [].

Index i can be negative.

extern crate ndarray;
extern crate autograd as ag;

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

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

Methods from Deref<Target = Rc<RawTensor>>

[src]

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

Attempt to downcast the Rc<Any> to a concrete type.

Examples

#![feature(rc_downcast)]
use std::any::Any;
use std::rc::Rc;

fn print_if_string(value: Rc<Any>) {
    if let Ok(string) = value.downcast::<String>() {
        println!("String ({}): {}", string.len(), string);
    }
}

fn main() {
    let my_string = "Hello World".to_string();
    print_if_string(Rc::new(my_string));
    print_if_string(Rc::new(0i8));
}

Trait Implementations

impl Ord for Tensor
[src]

[src]

Compares the ranks in topological ordering

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl PartialOrd for Tensor
[src]

[src]

Compares the ranks in topological ordering

1.0.0
[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

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 Eq for Tensor
[src]

impl PartialEq for Tensor
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl Hash for Tensor
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Clone for Tensor
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Deref for Tensor
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.

impl DerefMut for Tensor
[src]

[src]

Mutably dereferences the value.

impl Display for Tensor
[src]

[src]

Formats the value using the given formatter. Read more

impl ArrayLike for Tensor
[src]

[src]

impl Add for Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a> Add<&'a Tensor> for Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a> Add<Tensor> for &'a Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

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

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub for Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a> Sub<&'a Tensor> for Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a> Sub<Tensor> for &'a Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

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

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Mul for Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<&'a Tensor> for Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<Tensor> for &'a Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

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

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div for Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<'a> Div<&'a Tensor> for Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<'a> Div<Tensor> for &'a Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

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

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Add<i32> for Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a> Add<i32> for &'a Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub<i32> for Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a> Sub<i32> for &'a Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Mul<i32> for Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<i32> for &'a Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<i32> for Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<'a> Div<i32> for &'a Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Add<i64> for Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a> Add<i64> for &'a Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub<i64> for Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a> Sub<i64> for &'a Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Mul<i64> for Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<i64> for &'a Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<i64> for Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<'a> Div<i64> for &'a Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Add<f32> for Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a> Add<f32> for &'a Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub<f32> for Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a> Sub<f32> for &'a Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Mul<f32> for Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<f32> for &'a Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<f32> for Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<'a> Div<f32> for &'a Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Add<f64> for Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a> Add<f64> for &'a Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub<f64> for Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a> Sub<f64> for &'a Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Mul<f64> for Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<f64> for &'a Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<f64> for Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<'a> Div<f64> for &'a Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Add<u32> for Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a> Add<u32> for &'a Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub<u32> for Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a> Sub<u32> for &'a Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Mul<u32> for Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<u32> for &'a Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<u32> for Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<'a> Div<u32> for &'a Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Add<u64> for Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a> Add<u64> for &'a Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub<u64> for Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a> Sub<u64> for &'a Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Mul<u64> for Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<u64> for &'a Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<u64> for Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<'a> Div<u64> for &'a Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Add<usize> for Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a> Add<usize> for &'a Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub<usize> for Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a> Sub<usize> for &'a Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Mul<usize> for Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<usize> for &'a Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<usize> for Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<'a> Div<usize> for &'a Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Add<isize> for Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a> Add<isize> for &'a Tensor
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub<isize> for Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a> Sub<isize> for &'a Tensor
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Mul<isize> for Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<isize> for &'a Tensor
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<isize> for Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<'a> Div<isize> for &'a Tensor
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.