A combination of dimension names and a tensor. The provided dimensions increase
the dimensionality of the TensorRef exposed to more than the dimensionality of the TensorRef
this is created from, by adding additional dimensions with a length of one.
use easy_ml::tensors::Tensor;
use easy_ml::tensors::views::{TensorView, TensorExpansion};
let vector = Tensor::from([("a", 2)], vec![ 16, 8 ]);
let matrix = vector.expand([(1, "b")]);
let also_matrix = TensorView::from(TensorExpansion::from(&vector, [(1, "b")]));
assert_eq!(matrix, also_matrix);
assert_eq!(matrix, Tensor::from([("a", 2), ("b", 1)], vec![ 16, 8 ]));
Note: due to limitations in Rust’s const generics support, TensorExpansion only implements
TensorRef for D from 1 to 6.
Creates a TensorExpansion from a source and extra dimension names inserted into the shape
at the provided indexes.
Each extra dimension name adds a dimension to the tensor with a length of 1 so they
do not change the total number of elements. Hence, a vector can be viewed as a matrix
if you provide an extra row/column dimension. More generally, the tensor the TensorExpansion
exposes will have a dimensionality of D + I, where D is the dimensionality of the source,
and I is the dimensionality of the extra dimensions.
The extra dimension names can be added before any dimensions in the source’s shape, in
the range 0 inclusive to D inclusive. It is possible to add multiple dimension names before
an existing dimension.
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more
The shape this tensor has. See dimensions for an overview.
The product of the lengths in the pairs define how many elements are in the tensor
(or the portion of it that is visible).
The way the data in this tensor is laid out in memory. In particular,
Linear has several requirements on what is returned that must be upheld
by implementations of this trait. Read more