Trait coaster::tensor::ITensorDesc[][src]

pub trait ITensorDesc {
    fn rank(&self) -> usize;
fn size(&self) -> usize;
fn dims(&self) -> &Vec<usize>;
fn dims_i32(&self) -> Vec<i32>; fn default_stride(&self) -> Vec<usize> { ... }
fn default_stride_i32(&self) -> Vec<i32> { ... } }
Expand description

Describes the Descriptor of a Tensor.

Required methods

Returns the rank of the Tensor.

The rank of the Tensor is the number of its dimensions.

Returns the summed up length of all dimensions of the Tensor.

A Tensor of rank 2 with the following dimesion specification [5, 5] would have a size of 25.

Returns the dimensions of the Tensor.

To return the length of one dimensions of the Tensor, you would call tensor_desc.dims()[0] // e.g. 64

Returns the dimensions of the Tensor as Vec.

Provided methods

Returns the default stride for an Rust allocated Tensor.

A rank 2 Tensor with dimensions [a, b] has a default stride of [b, 1] A rank 3 Tensor with dimensions [a, b, c] has a default stride of [b * c, c, 1] A rank 4 Tensor with dimensions [a, b, c, d] has a default stride of [b * c * d, c * d, d, 1] and so on.

Returns the default stride for a Rust allocated Tensor as i32.

Implementors