Struct autograd::tensor::Tensor
[−]
[src]
pub struct Tensor(pub Rc<RawTensor>);
"Shared" symbolic multi-dimensional array.
Methods
impl Tensor
[src]
fn eval(&self, ctx: &mut Context) -> NdArray
[src]
Evaluates this tensor as a ndarray's array object.
See eval.
fn shape(&self) -> Tensor
[src]
Returns the (symbolic) shape of this tensor.
See shape.
fn rank(&self) -> Tensor
[src]
Returns the (symbolic) rank of this tensor.
See rank.
fn size(&self) -> Tensor
[src]
Returns the (symbolic) size of this tensor.
See size.
fn set_shape(&self, shape: Tensor)
[src]
impl Tensor
[src]
fn get(&self, i: isize) -> Tensor
[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>>
fn downcast<T>(self) -> Result<Rc<T>, Rc<Any + 'static>> where
T: Any,
[src]
T: Any,
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]
fn cmp(&self, other: &Self) -> Ordering
[src]
Compares the ranks in topological ordering
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl PartialOrd for Tensor
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
Compares the ranks in topological ordering
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
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
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
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 Eq for Tensor
[src]
impl PartialEq for Tensor
[src]
fn eq(&self, other: &Tensor) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Hash for Tensor
[src]
fn hash<H: Hasher>(&self, _: &mut H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Clone for Tensor
[src]
fn clone(&self) -> Tensor
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Deref for Tensor
[src]
type Target = Rc<RawTensor>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
Dereferences the value.
impl DerefMut for Tensor
[src]
impl Display for Tensor
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl ArrayLike for Tensor
[src]
impl Add for Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: Tensor) -> Self::Output
[src]
Performs the +
operation.
impl<'a> Add<&'a Tensor> for Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: &Tensor) -> Self::Output
[src]
Performs the +
operation.
impl<'a> Add<Tensor> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: Tensor) -> Self::Output
[src]
Performs the +
operation.
impl<'a, 'b> Add<&'a Tensor> for &'b Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: &Tensor) -> Self::Output
[src]
Performs the +
operation.
impl Sub for Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: Tensor) -> Self::Output
[src]
Performs the -
operation.
impl<'a> Sub<&'a Tensor> for Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: &Tensor) -> Self::Output
[src]
Performs the -
operation.
impl<'a> Sub<Tensor> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: Tensor) -> Self::Output
[src]
Performs the -
operation.
impl<'a, 'b> Sub<&'a Tensor> for &'b Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: &Tensor) -> Self::Output
[src]
Performs the -
operation.
impl Mul for Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: Tensor) -> Self::Output
[src]
Performs the *
operation.
impl<'a> Mul<&'a Tensor> for Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: &Tensor) -> Self::Output
[src]
Performs the *
operation.
impl<'a> Mul<Tensor> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: Tensor) -> Self::Output
[src]
Performs the *
operation.
impl<'a, 'b> Mul<&'a Tensor> for &'b Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: &Tensor) -> Self::Output
[src]
Performs the *
operation.
impl Div for Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: Tensor) -> Self::Output
[src]
Performs the /
operation.
impl<'a> Div<&'a Tensor> for Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: &Tensor) -> Self::Output
[src]
Performs the /
operation.
impl<'a> Div<Tensor> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: Tensor) -> Self::Output
[src]
Performs the /
operation.
impl<'a, 'b> Div<&'a Tensor> for &'b Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: &Tensor) -> Self::Output
[src]
Performs the /
operation.
impl Add<i32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: i32) -> Self::Output
[src]
Performs the +
operation.
impl<'a> Add<i32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: i32) -> Self::Output
[src]
Performs the +
operation.
impl Sub<i32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: i32) -> Self::Output
[src]
Performs the -
operation.
impl<'a> Sub<i32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: i32) -> Self::Output
[src]
Performs the -
operation.
impl Mul<i32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: i32) -> Self::Output
[src]
Performs the *
operation.
impl<'a> Mul<i32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: i32) -> Self::Output
[src]
Performs the *
operation.
impl Div<i32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: i32) -> Self::Output
[src]
Performs the /
operation.
impl<'a> Div<i32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: i32) -> Self::Output
[src]
Performs the /
operation.
impl Add<i64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: i64) -> Self::Output
[src]
Performs the +
operation.
impl<'a> Add<i64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: i64) -> Self::Output
[src]
Performs the +
operation.
impl Sub<i64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: i64) -> Self::Output
[src]
Performs the -
operation.
impl<'a> Sub<i64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: i64) -> Self::Output
[src]
Performs the -
operation.
impl Mul<i64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: i64) -> Self::Output
[src]
Performs the *
operation.
impl<'a> Mul<i64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: i64) -> Self::Output
[src]
Performs the *
operation.
impl Div<i64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: i64) -> Self::Output
[src]
Performs the /
operation.
impl<'a> Div<i64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: i64) -> Self::Output
[src]
Performs the /
operation.
impl Add<f32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: f32) -> Self::Output
[src]
Performs the +
operation.
impl<'a> Add<f32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: f32) -> Self::Output
[src]
Performs the +
operation.
impl Sub<f32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: f32) -> Self::Output
[src]
Performs the -
operation.
impl<'a> Sub<f32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: f32) -> Self::Output
[src]
Performs the -
operation.
impl Mul<f32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Self::Output
[src]
Performs the *
operation.
impl<'a> Mul<f32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Self::Output
[src]
Performs the *
operation.
impl Div<f32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: f32) -> Self::Output
[src]
Performs the /
operation.
impl<'a> Div<f32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: f32) -> Self::Output
[src]
Performs the /
operation.
impl Add<f64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: f64) -> Self::Output
[src]
Performs the +
operation.
impl<'a> Add<f64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: f64) -> Self::Output
[src]
Performs the +
operation.
impl Sub<f64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: f64) -> Self::Output
[src]
Performs the -
operation.
impl<'a> Sub<f64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: f64) -> Self::Output
[src]
Performs the -
operation.
impl Mul<f64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: f64) -> Self::Output
[src]
Performs the *
operation.
impl<'a> Mul<f64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: f64) -> Self::Output
[src]
Performs the *
operation.
impl Div<f64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: f64) -> Self::Output
[src]
Performs the /
operation.
impl<'a> Div<f64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: f64) -> Self::Output
[src]
Performs the /
operation.
impl Add<u32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: u32) -> Self::Output
[src]
Performs the +
operation.
impl<'a> Add<u32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: u32) -> Self::Output
[src]
Performs the +
operation.
impl Sub<u32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: u32) -> Self::Output
[src]
Performs the -
operation.
impl<'a> Sub<u32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: u32) -> Self::Output
[src]
Performs the -
operation.
impl Mul<u32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: u32) -> Self::Output
[src]
Performs the *
operation.
impl<'a> Mul<u32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: u32) -> Self::Output
[src]
Performs the *
operation.
impl Div<u32> for Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: u32) -> Self::Output
[src]
Performs the /
operation.
impl<'a> Div<u32> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: u32) -> Self::Output
[src]
Performs the /
operation.
impl Add<u64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: u64) -> Self::Output
[src]
Performs the +
operation.
impl<'a> Add<u64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: u64) -> Self::Output
[src]
Performs the +
operation.
impl Sub<u64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: u64) -> Self::Output
[src]
Performs the -
operation.
impl<'a> Sub<u64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: u64) -> Self::Output
[src]
Performs the -
operation.
impl Mul<u64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: u64) -> Self::Output
[src]
Performs the *
operation.
impl<'a> Mul<u64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: u64) -> Self::Output
[src]
Performs the *
operation.
impl Div<u64> for Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: u64) -> Self::Output
[src]
Performs the /
operation.
impl<'a> Div<u64> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: u64) -> Self::Output
[src]
Performs the /
operation.
impl Add<usize> for Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: usize) -> Self::Output
[src]
Performs the +
operation.
impl<'a> Add<usize> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: usize) -> Self::Output
[src]
Performs the +
operation.
impl Sub<usize> for Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: usize) -> Self::Output
[src]
Performs the -
operation.
impl<'a> Sub<usize> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: usize) -> Self::Output
[src]
Performs the -
operation.
impl Mul<usize> for Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: usize) -> Self::Output
[src]
Performs the *
operation.
impl<'a> Mul<usize> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: usize) -> Self::Output
[src]
Performs the *
operation.
impl Div<usize> for Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: usize) -> Self::Output
[src]
Performs the /
operation.
impl<'a> Div<usize> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: usize) -> Self::Output
[src]
Performs the /
operation.
impl Add<isize> for Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: isize) -> Self::Output
[src]
Performs the +
operation.
impl<'a> Add<isize> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the +
operator.
fn add(self, rhs: isize) -> Self::Output
[src]
Performs the +
operation.
impl Sub<isize> for Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: isize) -> Self::Output
[src]
Performs the -
operation.
impl<'a> Sub<isize> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the -
operator.
fn sub(self, rhs: isize) -> Self::Output
[src]
Performs the -
operation.
impl Mul<isize> for Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: isize) -> Self::Output
[src]
Performs the *
operation.
impl<'a> Mul<isize> for &'a Tensor
[src]
type Output = Tensor
The resulting type after applying the *
operator.
fn mul(self, rhs: isize) -> Self::Output
[src]
Performs the *
operation.
impl Div<isize> for Tensor
[src]
type Output = Tensor
The resulting type after applying the /
operator.
fn div(self, rhs: isize) -> Self::Output
[src]
Performs the /
operation.