[][src]Trait neuro::tensor::TensorTrait

pub trait TensorTrait {
    fn ones(dims: Dim4) -> Tensor;
fn zeros(dims: Dim4) -> Tensor;
fn new_empty_tensor() -> Tensor;
fn batch_size(&self) -> u64;
fn shuffle(tensor1: &Tensor, tensor2: &Tensor) -> (Tensor, Tensor);
fn shuffle_mut(tensor1: &mut Tensor, tensor2: &mut Tensor);
fn scaled_uniform(
        lower_bound: PrimitiveType,
        upper_bound: PrimitiveType,
        dims: Dim4
    ) -> Tensor;
fn scaled_normal(
        mean: PrimitiveType,
        standard_deviation: PrimitiveType,
        dims: Dim4
    ) -> Tensor;
fn reduce(&self, reduction: Reduction) -> Tensor;
fn flatten(&self) -> Tensor;
fn flatten_mut(&mut self);
fn reshape(&self, dims: Dim4) -> Tensor;
fn reshape_mut(&mut self, dims: Dim4);
fn print_tensor(&self); }

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

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

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)

Loading content...

Implementors

impl TensorTrait for Tensor[src]

Loading content...