pub trait BoolTensorOps<B: Backend> {
Show 16 methods // Required methods fn bool_empty<const D: usize>( shape: Shape<D>, device: &B::Device ) -> B::BoolTensorPrimitive<D>; fn bool_shape<const D: usize>( tensor: &B::BoolTensorPrimitive<D> ) -> Shape<D>; fn bool_into_data<const D: usize>( tensor: B::BoolTensorPrimitive<D> ) -> Data<bool, D>; fn bool_from_data<const D: usize>( data: Data<bool, D>, device: &B::Device ) -> B::BoolTensorPrimitive<D>; fn bool_into_int<const D: usize>( tensor: B::BoolTensorPrimitive<D> ) -> B::IntTensorPrimitive<D>; fn bool_into_float<const D: usize>( tensor: B::BoolTensorPrimitive<D> ) -> B::TensorPrimitive<D>; fn bool_device<const D: usize>( tensor: &B::BoolTensorPrimitive<D> ) -> B::Device; fn bool_to_device<const D: usize>( tensor: B::BoolTensorPrimitive<D>, device: &B::Device ) -> B::BoolTensorPrimitive<D>; fn bool_reshape<const D1: usize, const D2: usize>( tensor: B::BoolTensorPrimitive<D1>, shape: Shape<D2> ) -> B::BoolTensorPrimitive<D2>; fn bool_slice<const D1: usize, const D2: usize>( tensor: B::BoolTensorPrimitive<D1>, ranges: [Range<usize>; D2] ) -> B::BoolTensorPrimitive<D1>; fn bool_slice_assign<const D1: usize, const D2: usize>( tensor: B::BoolTensorPrimitive<D1>, ranges: [Range<usize>; D2], value: B::BoolTensorPrimitive<D1> ) -> B::BoolTensorPrimitive<D1>; fn bool_cat<const D: usize>( tensors: Vec<B::BoolTensorPrimitive<D>>, dim: usize ) -> B::BoolTensorPrimitive<D>; fn bool_equal<const D: usize>( lhs: B::BoolTensorPrimitive<D>, rhs: B::BoolTensorPrimitive<D> ) -> B::BoolTensorPrimitive<D>; fn bool_not<const D: usize>( tensor: B::BoolTensorPrimitive<D> ) -> B::BoolTensorPrimitive<D>; // Provided methods fn bool_to_data<const D: usize>( tensor: &B::BoolTensorPrimitive<D> ) -> Data<bool, D> { ... } fn bool_repeat<const D: usize>( tensor: B::BoolTensorPrimitive<D>, dim: usize, times: usize ) -> B::BoolTensorPrimitive<D> { ... }
}
Expand description

Bool Tensor API for basic operations, see tensor for documentation on each function.

Required Methods§

source

fn bool_empty<const D: usize>( shape: Shape<D>, device: &B::Device ) -> B::BoolTensorPrimitive<D>

Creates a new bool tensor.

Arguments
  • shape - The shape of the tensor.
  • device - The device to create the tensor on.
Returns

The boolean tensor with the given shape.

source

fn bool_shape<const D: usize>(tensor: &B::BoolTensorPrimitive<D>) -> Shape<D>

Returns the shape of the tensor.

Arguments
  • tensor - The tensor.
Returns

The shape of the tensor.

source

fn bool_into_data<const D: usize>( tensor: B::BoolTensorPrimitive<D> ) -> Data<bool, D>

Converts the tensor to a data structure.

Arguments
  • tensor - The tensor.
Returns

The data structure with the tensor’s data.

source

fn bool_from_data<const D: usize>( data: Data<bool, D>, device: &B::Device ) -> B::BoolTensorPrimitive<D>

Creates a tensor from the data structure.

Arguments
  • data - The data structure.
  • device - The device to create the tensor on.
Returns

The tensor with the data.

source

fn bool_into_int<const D: usize>( tensor: B::BoolTensorPrimitive<D> ) -> B::IntTensorPrimitive<D>

Converts bool tensor to int tensor.

Arguments
  • tensor - The tensor.
Returns

The int tensor with the same data as the bool tensor.

source

fn bool_into_float<const D: usize>( tensor: B::BoolTensorPrimitive<D> ) -> B::TensorPrimitive<D>

Converts bool tensor to float tensor.

Arguments
  • tensor - The tensor.
Returns

The float tensor with the same data as the bool tensor.

source

fn bool_device<const D: usize>(tensor: &B::BoolTensorPrimitive<D>) -> B::Device

Gets the device of the tensor.

Arguments
  • tensor - The tensor.
Returns

The device of the tensor.

source

fn bool_to_device<const D: usize>( tensor: B::BoolTensorPrimitive<D>, device: &B::Device ) -> B::BoolTensorPrimitive<D>

Moves the tensor to the device.

source

fn bool_reshape<const D1: usize, const D2: usize>( tensor: B::BoolTensorPrimitive<D1>, shape: Shape<D2> ) -> B::BoolTensorPrimitive<D2>

Reshapes the tensor.

Arguments
  • tensor - The tensor.
  • shape - The new shape.
Returns

The tensor with the new shape.

source

fn bool_slice<const D1: usize, const D2: usize>( tensor: B::BoolTensorPrimitive<D1>, ranges: [Range<usize>; D2] ) -> B::BoolTensorPrimitive<D1>

Gets the values from the tensor for the given ranges.

Arguments
  • tensor - The tensor.
  • ranges - The ranges to get the values from.
Returns

The tensor with the values for the given ranges.

source

fn bool_slice_assign<const D1: usize, const D2: usize>( tensor: B::BoolTensorPrimitive<D1>, ranges: [Range<usize>; D2], value: B::BoolTensorPrimitive<D1> ) -> B::BoolTensorPrimitive<D1>

Sets the values in the tensor for the given ranges.

Arguments
  • tensor - The tensor.
  • ranges - The ranges to set the values for.
  • value - The values to set.
Returns

The tensor with the values set for the given ranges.

source

fn bool_cat<const D: usize>( tensors: Vec<B::BoolTensorPrimitive<D>>, dim: usize ) -> B::BoolTensorPrimitive<D>

Concatenates the tensors along the given dimension.

Arguments
  • tensors - The tensors to concatenate.
  • dim - The dimension to concatenate along.
Returns

The tensor with the tensors concatenated along the given dimension.

source

fn bool_equal<const D: usize>( lhs: B::BoolTensorPrimitive<D>, rhs: B::BoolTensorPrimitive<D> ) -> B::BoolTensorPrimitive<D>

Equates the two tensors.

Arguments
  • lhs - The left hand side tensor.
  • rhs - The right hand side tensor.
Returns

The tensor with the result of the equate.

source

fn bool_not<const D: usize>( tensor: B::BoolTensorPrimitive<D> ) -> B::BoolTensorPrimitive<D>

Inverses boolean values.

Arguments
  • tensor - The tensor.
Returns

The tensor with the result of the negation.

Provided Methods§

source

fn bool_to_data<const D: usize>( tensor: &B::BoolTensorPrimitive<D> ) -> Data<bool, D>

Gets the data from the tensor.

Arguments
  • data - The data structure.
Returns

The data cloned from the data structure.

source

fn bool_repeat<const D: usize>( tensor: B::BoolTensorPrimitive<D>, dim: usize, times: usize ) -> B::BoolTensorPrimitive<D>

Repeats one dimension of the tensor a given number of times along that dimension.

Arguments
  • tensor - The tensor.
  • dim - The dimension to repeat.
  • times - The number of times to repeat the dimension.
Returns

The tensor with the dimension repeated.

Implementors§