Trait coaster::tensor::ITensorDesc
source · pub trait ITensorDesc {
// Required methods
fn rank(&self) -> usize;
fn size(&self) -> usize;
fn dims(&self) -> &Vec<usize>;
fn dims_i32(&self) -> Vec<i32>;
// Provided methods
fn default_stride(&self) -> Vec<usize> { ... }
fn default_stride_i32(&self) -> Vec<i32> { ... }
}
Expand description
Describes the Descriptor of a Tensor.
Required Methods§
sourcefn rank(&self) -> usize
fn rank(&self) -> usize
Returns the rank of the Tensor.
The rank of the Tensor is the number of its dimensions.
sourcefn size(&self) -> usize
fn size(&self) -> usize
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.
Provided Methods§
sourcefn default_stride(&self) -> Vec<usize>
fn default_stride(&self) -> Vec<usize>
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.
sourcefn default_stride_i32(&self) -> Vec<i32>
fn default_stride_i32(&self) -> Vec<i32>
Returns the default stride for a Rust allocated Tensor as i32.