[][src]Struct tensorflow::Tensor

pub struct Tensor<T: TensorType> { /* fields omitted */ }

Holds a multi-dimensional array of elements of a single data type.

The data buffer stores elements in row major order. E.g. if data is treated as a vector of T:

  element 0:   index (0, ..., 0)
  element 1:   index (0, ..., 1)
  ...

Methods

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

pub fn new(dims: &[u64]) -> Self[src]

Creates a new tensor.

The data is initialized to zeros.

pub fn with_values(self, value: &[T]) -> Result<Self>[src]

Sets (copies) the tensor values to the provided ones.

let a = Tensor::new(&[2, 2]).with_values(&[0_i32, 1, 2, 3]).unwrap();

pub fn dims(&self) -> &[u64][src]

Returns the tensor's dimensions.

Trait Implementations

impl<T: TensorType + PartialEq> PartialEq<Tensor<T>> for Tensor<T>[src]

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

This method tests for !=.

impl<T: Eq + TensorType> Eq for Tensor<T> where
    T::InnerType: Eq
[src]

impl<T: Clone + TensorType> Clone for Tensor<T> where
    T::InnerType: Clone
[src]

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

Performs copy-assignment from source. Read more

impl<T: TensorType> From<T> for Tensor<T>[src]

impl<'a, T: TensorType> From<&'a [T]> for Tensor<T>[src]

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

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

type Target = [T]

The resulting type after dereferencing.

impl<T: Debug + TensorType> Debug for Tensor<T> where
    T::InnerType: Debug
[src]

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

Auto Trait Implementations

impl<T> Send for Tensor<T> where
    <T as TensorType>::InnerType: Send

impl<T> Sync for Tensor<T> where
    <T as TensorType>::InnerType: Sync

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

impl<T> ToString for T where
    T: Display + ?Sized
[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> Any for T where
    T: 'static + ?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.