[−][src]Trait neuro::tensor::TensorTrait
Defines additional methods for the Tensor type.
Required methods
fn ones(dims: Dim4) -> Tensor
Creates a tensor of ones with the given dimensions.
fn zeros(dims: Dim4) -> Tensor
Creates a tensor of zeros with the given dimensions.
fn new_empty_tensor() -> Tensor
Creates an empty tensor with no dimensions.
fn batch_size(&self) -> u64
Returns the number of samples in a batch.
fn shuffle(tensor1: &Tensor, tensor2: &Tensor) -> (Tensor, Tensor)
Shuffles two vectors with identical indices permutation along the last dimension.
fn shuffle_mut(tensor1: &mut Tensor, tensor2: &mut Tensor)
Shuffles two vectors with identical indices permutation along the last dimension inplace.
fn scaled_uniform(
lower_bound: PrimitiveType,
upper_bound: PrimitiveType,
dims: Dim4
) -> Tensor
lower_bound: PrimitiveType,
upper_bound: PrimitiveType,
dims: Dim4
) -> Tensor
Creates a tensor with the given dimensions where each entry is drawn from a uniform distribution.
fn scaled_normal(
mean: PrimitiveType,
standard_deviation: PrimitiveType,
dims: Dim4
) -> Tensor
mean: PrimitiveType,
standard_deviation: PrimitiveType,
dims: Dim4
) -> Tensor
Creates a tensor with the given dimensions where each entry is drawn from a normal distribution.
fn reduce(&self, reduction: Reduction) -> Tensor
Reduces the tensor.
fn flatten(&self) -> Tensor
Reshapes the tensor such that each sample is one-dimensional.
For a tensor with dimensions [h, w, c, batch_size], the output tensor will have dimensions [hwc, 1, 1 batch_size].
fn flatten_mut(&mut self)
Reshapes the tensor inplace such that each sample is one-dimensional.
For a tensor with dimensions [h, w, c, batch_size], the tensor will be modified to have dimensions [hwc, 1, 1 batch_size].
fn reshape(&self, dims: Dim4) -> Tensor
Reshapes the tensor to the given dimensions.
fn reshape_mut(&mut self, dims: Dim4)
Reshapes the tensor to the given dimensions inplace.
fn print_tensor(&self)
Implementors
impl TensorTrait for Tensor
[src]
fn ones(dims: Dim4) -> Tensor
[src]
fn zeros(dims: Dim4) -> Tensor
[src]
fn new_empty_tensor() -> Tensor
[src]
fn batch_size(&self) -> u64
[src]
fn shuffle(x: &Tensor, y: &Tensor) -> (Tensor, Tensor)
[src]
fn shuffle_mut(x: &mut Tensor, y: &mut Tensor)
[src]
fn scaled_uniform(
lower_bound: PrimitiveType,
upper_bound: PrimitiveType,
dims: Dim4
) -> Tensor
[src]
lower_bound: PrimitiveType,
upper_bound: PrimitiveType,
dims: Dim4
) -> Tensor
fn scaled_normal(
mean: PrimitiveType,
standard_deviation: PrimitiveType,
dims: Dim4
) -> Tensor
[src]
mean: PrimitiveType,
standard_deviation: PrimitiveType,
dims: Dim4
) -> Tensor