[−][src]Trait tensor_rs::tensor::index_slicing::IndexSlicing
Required methods
fn cat(&self, tensors: &[&Self], dim: usize) -> Self
fn chunk(&self, chunks: usize, dim: usize) -> Vec<Self>
fn gather(&self, dim: usize, index: &Self) -> Self
fn index_select(&self, dim: usize, index: &Self) -> Self
fn reshape(&self, new_shape: &[usize]) -> Self
fn split(&self, sections: &[usize], dim: usize) -> Vec<Self>
fn squeeze(&self, dim: Option<usize>) -> Self
fn stack(tensors: &[&Self], dim: usize) -> Self
fn take(&self, index: &[usize]) -> Self
fn permute(&self, dims: &[usize]) -> Self
fn unsqueeze(&self, dim: usize) -> Self
fn conditional_select(&self, x: &Self, y: &Self) -> Self
fn repeat(&self, sizes: &[usize]) -> Self
Implementors
impl<T> IndexSlicing for GenTensor<T> where
T: Float, [src]
T: Float,
fn cat(&self, tensors: &[&Self], dim: usize) -> Self[src]
Concatenates the given sequence of seq tensors in the given dimension.
fn chunk(&self, chunks: usize, dim: usize) -> Vec<Self>[src]
Splits a tensor into a specific number of chunks.
fn gather(&self, dim: usize, index: &Self) -> Self[src]
fn index_select(&self, dim: usize, index: &Self) -> Self[src]
fn reshape(&self, new_shape: &[usize]) -> Self[src]
fn split(&self, sections: &[usize], dim: usize) -> Vec<Self>[src]
Splits the tensor into chunks. Each chunk is a view of the original tensor.
fn squeeze(&self, dim: Option<usize>) -> Self[src]
fn stack(tensors: &[&Self], dim: usize) -> Self[src]
Concatenates sequence of tensors along a new dimension.
All tensors need to be of the same size.
let m1 = GenTensor::<f64>::new_raw(&vec![1.,2.,3.,4.,5.,6.], &vec![3,2]); let m2 = GenTensor::<f64>::new_raw(&vec![2.,3.,4.,5.,6.,7.], &vec![3,2]); let result = GenTensor::<f64>::stack(&vec![&m1, &m2], 1); let raw = result.get_raw(); for i in raw { println!("{}", i); } assert_eq!(*result.size(), vec![3,2,2]);
fn take(&self, index: &[usize]) -> Self[src]
Returns a new tensor with the elements of input at the given indices. The input tensor is treated as if it were viewed as a 1-D tensor. The result takes the same shape as the indices.
fn permute(&self, dims: &[usize]) -> Self[src]
Permute the dimensions of this tensor.
let mut m1 = GenTensor::<f64>::fill(1., &vec![2, 3, 5]); m1.permute(&vec![2, 0, 1]);