pub trait FloatTensorOps<B>
where B: Backend,
{
Show 83 methods // Required methods fn float_from_data<const D: usize>( data: Data<<B as Backend>::FloatElem, D>, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_random<const D: usize>( shape: Shape<D>, distribution: Distribution, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_shape<const D: usize>( tensor: &<B as Backend>::FloatTensorPrimitive<D> ) -> Shape<D>; fn float_into_data<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> Reader<Data<<B as Backend>::FloatElem, D>>; fn float_device<const D: usize>( tensor: &<B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::Device; fn float_to_device<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_into_int<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::IntTensorPrimitive<D>; fn float_empty<const D: usize>( shape: Shape<D>, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_add<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_add_scalar<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_sub<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_sub_scalar<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_mul<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_mul_scalar<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_div<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_div_scalar<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_matmul<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_recip<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_swap_dims<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim1: usize, dim2: usize ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_reshape<const D1: usize, const D2: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D1>, shape: Shape<D2> ) -> <B as Backend>::FloatTensorPrimitive<D2>; fn float_gather<const D: usize>( dim: usize, tensor: <B as Backend>::FloatTensorPrimitive<D>, indices: <B as Backend>::IntTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_scatter<const D: usize>( dim: usize, tensor: <B as Backend>::FloatTensorPrimitive<D>, indices: <B as Backend>::IntTensorPrimitive<D>, value: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_select<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize, indices: <B as Backend>::IntTensorPrimitive<1> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_select_assign<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize, indices: <B as Backend>::IntTensorPrimitive<1>, value: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_slice<const D1: usize, const D2: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D1>, ranges: [Range<usize>; D2] ) -> <B as Backend>::FloatTensorPrimitive<D1>; fn float_slice_assign<const D1: usize, const D2: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D1>, ranges: [Range<usize>; D2], value: <B as Backend>::FloatTensorPrimitive<D1> ) -> <B as Backend>::FloatTensorPrimitive<D1>; fn float_mask_where<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, mask: <B as Backend>::BoolTensorPrimitive<D>, value: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_mask_fill<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, mask: <B as Backend>::BoolTensorPrimitive<D>, value: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_equal<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::BoolTensorPrimitive<D>; fn float_equal_elem<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::BoolTensorPrimitive<D>; fn float_greater<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::BoolTensorPrimitive<D>; fn float_greater_elem<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::BoolTensorPrimitive<D>; fn float_greater_equal<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::BoolTensorPrimitive<D>; fn float_greater_equal_elem<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::BoolTensorPrimitive<D>; fn float_lower<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::BoolTensorPrimitive<D>; fn float_lower_elem<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::BoolTensorPrimitive<D>; fn float_lower_equal<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::BoolTensorPrimitive<D>; fn float_lower_equal_elem<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::BoolTensorPrimitive<D>; fn float_sum<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<1>; fn float_sum_dim<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_mean_dim<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_to_full_precision<const D: usize>( tensor: &<B as Backend>::FloatTensorPrimitive<D> ) -> <<B as Backend>::FullPrecisionBackend as Backend>::FloatTensorPrimitive<D>; fn float_from_full_precision<const D: usize>( tensor: <<B as Backend>::FullPrecisionBackend as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_exp<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_log<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_log1p<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_powf<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_powf_scalar<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, value: f32 ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_sqrt<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_abs<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_cos<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_sin<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_tanh<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_erf<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_cat<const D: usize>( tensors: Vec<<B as Backend>::FloatTensorPrimitive<D>>, dim: usize ) -> <B as Backend>::FloatTensorPrimitive<D>; fn float_argmax<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::IntTensorPrimitive<D>; fn float_argmin<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::IntTensorPrimitive<D>; // Provided methods fn float_zeros<const D: usize>( shape: Shape<D>, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_ones<const D: usize>( shape: Shape<D>, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_full<const D: usize>( shape: Shape<D>, fill_value: <B as Backend>::FloatElem, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_to_data<const D: usize>( tensor: &<B as Backend>::FloatTensorPrimitive<D> ) -> Reader<Data<<B as Backend>::FloatElem, D>> { ... } fn float_arange( range: Range<usize>, device: &<B as Backend>::Device ) -> <B as Backend>::IntTensorPrimitive<1> { ... } fn float_arange_step( range: Range<usize>, step: usize, device: &<B as Backend>::Device ) -> <B as Backend>::IntTensorPrimitive<1> { ... } fn float_repeat<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize, times: usize ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_clamp_min<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, min: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_clamp_max<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, max: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_clamp<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, min: <B as Backend>::FloatElem, max: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_neg<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_transpose<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_detach<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_set_require_grad<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, _require_grad: bool ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_is_require_grad<const D: usize>( _tensor: &<B as Backend>::FloatTensorPrimitive<D> ) -> bool { ... } fn float_mean<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<1> { ... } fn float_powi<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::IntTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_powi_scalar<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::IntElem ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_max<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<1> { ... } fn float_max_dim<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_max_dim_with_indices<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> (<B as Backend>::FloatTensorPrimitive<D>, <B as Backend>::IntTensorPrimitive<D>) { ... } fn float_min<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<1> { ... } fn float_min_dim<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_min_dim_with_indices<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> (<B as Backend>::FloatTensorPrimitive<D>, <B as Backend>::IntTensorPrimitive<D>) { ... } fn float_narrow<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize, start: usize, length: usize ) -> <B as Backend>::FloatTensorPrimitive<D> { ... } fn float_chunk<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, chunks: usize, dim: usize ) -> Vec<<B as Backend>::FloatTensorPrimitive<D>> { ... }
}
Expand description

Operations on float tensors.

Required Methods§

source

fn float_from_data<const D: usize>( data: Data<<B as Backend>::FloatElem, D>, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>

Creates a new tensor from the data structure.

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

The tensor with the given data.

source

fn float_random<const D: usize>( shape: Shape<D>, distribution: Distribution, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>

Creates a new tensor with random values.

§Arguments
  • shape - The shape of the tensor.
  • distribution - The distribution to sample from.
  • device - The device to create the tensor on.
§Returns

The tensor with the given shape and random values.

source

fn float_shape<const D: usize>( tensor: &<B as Backend>::FloatTensorPrimitive<D> ) -> Shape<D>

Gets the shape of the tensor.

§Arguments
  • tensor - The tensor.
§Returns

The shape of the tensor.

source

fn float_into_data<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> Reader<Data<<B as Backend>::FloatElem, D>>

Converts the tensor to a data structure.

§Arguments
  • tensor - The tensor.
§Returns

The data structure with the tensor’s data.

source

fn float_device<const D: usize>( tensor: &<B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::Device

Gets the device of the tensor.

§Arguments
  • tensor - The tensor.
§Returns

The device of the tensor.

source

fn float_to_device<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>

Moves the tensor to the given device.

§Arguments
  • tensor - The tensor.
  • device - The device to move the tensor to.
§Returns

The tensor on the given device.

source

fn float_into_int<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::IntTensorPrimitive<D>

Converts float tensor to int tensor.

§Arguments
  • tensor - The tensor.
§Returns

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

source

fn float_empty<const D: usize>( shape: Shape<D>, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>

Creates an empty tensor with the given shape.

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

The empty tensor with the given shape.

source

fn float_add<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Adds two tensors together.

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

The result of adding the two tensors together.

source

fn float_add_scalar<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>

Adds a scalar to a tensor.

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

The result of adding the scalar to the tensor.

source

fn float_sub<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Subtracts two tensors.

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

The result of subtracting the two tensors.

source

fn float_sub_scalar<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>

Subtracts a scalar from a tensor.

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

The result of subtracting the scalar from the tensor.

source

fn float_mul<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Multiplies two tensors together element-wise.

source

fn float_mul_scalar<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>

Multiplies a tensor by a scalar.

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

The result of multiplying the tensor by the scalar.

source

fn float_div<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Divides two tensors element-wise.

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

The result of dividing the two tensors.

source

fn float_div_scalar<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>

Divides a tensor by a scalar.

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

The result of dividing the tensor by the scalar.

source

fn float_matmul<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Multiplies two tensors together using matrix multiplication.

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

The result of multiplying the two tensors together using matrix multiplication.

source

fn float_recip<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Calculates the reciprocals elementwise

source

fn float_swap_dims<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim1: usize, dim2: usize ) -> <B as Backend>::FloatTensorPrimitive<D>

Swaps two dimensions of a tensor.

§Arguments
  • tensor - The tensor to swap the dimensions of.
  • dim1 - The first dimension to swap.
  • dim2 - The second dimension to swap.
§Returns

The tensor with the dimensions swapped.

source

fn float_reshape<const D1: usize, const D2: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D1>, shape: Shape<D2> ) -> <B as Backend>::FloatTensorPrimitive<D2>

Reshapes a tensor.

§Arguments
  • tensor - The tensor to reshape.
  • shape - The new shape of the tensor.
§Returns

The tensor with the new shape.

source

fn float_gather<const D: usize>( dim: usize, tensor: <B as Backend>::FloatTensorPrimitive<D>, indices: <B as Backend>::IntTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Gather elements from a tensor.

§Arguments
  • dim - The dimension to gather from.
  • tensor - The tensor to gather from.
  • indices - The indices to gather.
§Returns

The gathered elements.

source

fn float_scatter<const D: usize>( dim: usize, tensor: <B as Backend>::FloatTensorPrimitive<D>, indices: <B as Backend>::IntTensorPrimitive<D>, value: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Scatter elements into a tensor.

§Arguments
  • dim - The dimension to scatter into.
  • tensor - The tensor to scatter into.
  • indices - The indices to scatter into.
  • value - The value to scatter.
§Returns

The tensor with the scattered elements.

source

fn float_select<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize, indices: <B as Backend>::IntTensorPrimitive<1> ) -> <B as Backend>::FloatTensorPrimitive<D>

Select tensor elements along the given dimension corresponding for the given indices.

§Arguments
  • tensor - The tensor to select from.
  • dim - The dimension to select from.
  • indices - The indices to select.
§Returns

The selected elements.

source

fn float_select_assign<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize, indices: <B as Backend>::IntTensorPrimitive<1>, value: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Assign the selected elements along the given dimension corresponding for the given indices to the given value.

§Arguments
  • tensor - The tensor to select from.
  • dim - The dimension to select from.
  • indices - The indices to select.
  • value - The value to assign.
§Returns

The tensor with the selected elements assigned to the given value.

source

fn float_slice<const D1: usize, const D2: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D1>, ranges: [Range<usize>; D2] ) -> <B as Backend>::FloatTensorPrimitive<D1>

Select tensor elements corresponding for the given ranges.

§Arguments
  • tensor - The tensor to select from.
  • ranges - The ranges to select.
§Returns

The selected elements in a new tensor.

source

fn float_slice_assign<const D1: usize, const D2: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D1>, ranges: [Range<usize>; D2], value: <B as Backend>::FloatTensorPrimitive<D1> ) -> <B as Backend>::FloatTensorPrimitive<D1>

Assign the selected elements corresponding for the given ranges to the given value.

§Arguments
  • tensor - The tensor to select from.
  • ranges - The ranges to select.
  • value - The value to assign.
§Returns

The tensor with the selected elements assigned to the given value.

source

fn float_mask_where<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, mask: <B as Backend>::BoolTensorPrimitive<D>, value: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Update the given tensor with the value tensor where the mask is true.

§Arguments
  • tensor - The tensor to select from.
  • mask - The boolean mask to select with.
  • value - The value to assign to the selected elements from the value tensor.
§Returns

The tensor with the selected elements assigned to the given value.

source

fn float_mask_fill<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, mask: <B as Backend>::BoolTensorPrimitive<D>, value: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>

Update the given tensor with the value where the mask is true.

§Arguments
  • tensor - The tensor to select from.
  • mask - The boolean mask to select with.
  • value - The value to assign to the selected elements.
§Returns

The tensor with the selected elements assigned to the given value.

source

fn float_equal<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::BoolTensorPrimitive<D>

Equal comparison of two tensors.

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

A boolean tensor with the result of the comparison.

source

fn float_equal_elem<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::BoolTensorPrimitive<D>

Equal comparison of a tensor and a scalar.

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

A boolean tensor with the result of the comparison.

source

fn float_greater<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::BoolTensorPrimitive<D>

Greater than comparison of two tensors.

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

A boolean tensor with the result of the comparison.

source

fn float_greater_elem<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::BoolTensorPrimitive<D>

Greater than comparison of a tensor and a scalar.

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

A boolean tensor with the result of the comparison.

source

fn float_greater_equal<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::BoolTensorPrimitive<D>

Greater than or equal comparison of two tensors.

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

A boolean tensor with the result of the comparison.

source

fn float_greater_equal_elem<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::BoolTensorPrimitive<D>

Greater than or equal comparison of a tensor and a scalar.

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

A boolean tensor with the result of the comparison.

source

fn float_lower<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::BoolTensorPrimitive<D>

Less than comparison of two tensors.

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

A boolean tensor with the result of the comparison.

source

fn float_lower_elem<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::BoolTensorPrimitive<D>

Less than comparison of a tensor and a scalar.

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

A boolean tensor with the result of the comparison.

source

fn float_lower_equal<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::BoolTensorPrimitive<D>

Less than or equal comparison of two tensors.

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

A boolean tensor with the result of the comparison.

source

fn float_lower_equal_elem<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatElem ) -> <B as Backend>::BoolTensorPrimitive<D>

Less than or equal comparison of a tensor and a scalar.

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

A boolean tensor with the result of the comparison.

source

fn float_sum<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<1>

Sum of all elements in a tensor.

§Arguments
  • tensor - The tensor to sum.
§Returns

A scalar tensor with the sum of all elements in tensor.

source

fn float_sum_dim<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::FloatTensorPrimitive<D>

Sum of all elements in a tensor along a dimension.

§Arguments
  • tensor - The tensor to sum.
  • dim - The dimension along which to sum.
§Returns

A tensor with the sum of all elements in tensor along dim.

source

fn float_mean_dim<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::FloatTensorPrimitive<D>

Mean of all elements in a tensor along a dimension.

§Arguments
  • tensor - The tensor to mean.
  • dim - The dimension along which to mean.
§Returns

A tensor with the mean of all elements in tensor along dim.

source

fn float_to_full_precision<const D: usize>( tensor: &<B as Backend>::FloatTensorPrimitive<D> ) -> <<B as Backend>::FullPrecisionBackend as Backend>::FloatTensorPrimitive<D>

Converts a tensor to full precision.

§Arguments
  • tensor - The tensor to convert.
§Returns

A tensor with the same values as tensor but with full precision.

source

fn float_from_full_precision<const D: usize>( tensor: <<B as Backend>::FullPrecisionBackend as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Converts a tensor from full precision.

§Arguments
  • tensor - The tensor to convert.
§Returns

A tensor with the same values as tensor but with the precision of the backend.

source

fn float_exp<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with exponential values.

§Arguments
  • tensor - The tensor to exponentiate.
§Returns

A tensor with the same shape as tensor with exponential values.

source

fn float_log<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with natural logarithm values.

§Arguments
  • tensor - The tensor to take the logarithm of.
§Returns

A tensor with the same shape as tensor with natural logarithm values.

source

fn float_log1p<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with logarithm values of (1 + Xi).

§Arguments
  • tensor - The tensor to take the logarithm of.
§Returns

A tensor with the same shape as tensor with logarithm values of (1 + Xi).

source

fn float_powf<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Elementwise power with a FloatTensor.

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

The elements of lhs raised to the power of the elements of rhs.

source

fn float_powf_scalar<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, value: f32 ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with values raised to the power of float value.

§Arguments
  • tensor - The tensor to exponentiate.
  • value - The exponent.
§Returns

A tensor with the same shape as tensor with values raised to the power of value.

source

fn float_sqrt<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with square root values.

§Arguments
  • tensor - The tensor to take the square root of.
§Returns

A tensor with the same shape as tensor with square root values.

source

fn float_abs<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with absolute values.

§Arguments
  • tensor - The tensor to take absolute value of.
§Returns

A tensor with the same shape as tensor with absolute values.

source

fn float_cos<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with cosine values.

§Arguments
  • tensor - The tensor to take the cosine of.
§Returns

A tensor with the same shape as tensor with cosine values.

source

fn float_sin<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with sine values.

§Arguments
  • tensor - The tensor to take the sine of.
§Returns

A tensor with the same shape as tensor with sine values.

source

fn float_tanh<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with tangent values.

§Arguments
  • tensor - The tensor to take the tangent of.
§Returns

A tensor with the same shape as tensor with tangent values.

source

fn float_erf<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with the error function values.

§Arguments
  • tensor - The tensor to take the error function of.
§Returns

A tensor with the same shape as tensor with error function values.

source

fn float_cat<const D: usize>( tensors: Vec<<B as Backend>::FloatTensorPrimitive<D>>, dim: usize ) -> <B as Backend>::FloatTensorPrimitive<D>

Catcatenates tensors along a dimension.

§Arguments
  • tensors - The tensors to catcatenate.
  • dim - The dimension along which to catcatenate.
§Returns

A tensor with the catcatenated tensors along dim.

source

fn float_argmax<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::IntTensorPrimitive<D>

Gets the indices of the maximum elements of a tensor along an axis.

§Arguments
  • tensor - The tensor to get the maximum elements of.
  • dim - The dimension along which to get the maximum elements.
§Returns

A tensor with the indices of the maximum elements of tensor along dim.

source

fn float_argmin<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::IntTensorPrimitive<D>

Gets the indices of the minimum elements of a tensor along an axis.

§Arguments
  • tensor - The tensor to get the minimum elements of.
  • dim - The dimension along which to get the minimum elements.
§Returns

A tensor with the indices of the minimum elements of tensor along dim.

Provided Methods§

source

fn float_zeros<const D: usize>( shape: Shape<D>, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>

Creates a new tensor with zeros.

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

The tensor with the given shape and zeros.

source

fn float_ones<const D: usize>( shape: Shape<D>, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>

Creates a new tensor with ones.

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

The tensor with the given shape and ones.

source

fn float_full<const D: usize>( shape: Shape<D>, fill_value: <B as Backend>::FloatElem, device: &<B as Backend>::Device ) -> <B as Backend>::FloatTensorPrimitive<D>

Creates a tensor filled with given value.

§Arguments
  • shape - The shape of the tensor.
  • fill_value - The value with which to fill the tensor.
  • device - The device to create the tensor on.
§Returns

The tensor filled with given value

source

fn float_to_data<const D: usize>( tensor: &<B as Backend>::FloatTensorPrimitive<D> ) -> Reader<Data<<B as Backend>::FloatElem, D>>

Converts the tensor to a data structure.

§Arguments
  • tensor - The tensor.
§Returns

The data structure with the tensor’s data.

source

fn float_arange( range: Range<usize>, device: &<B as Backend>::Device ) -> <B as Backend>::IntTensorPrimitive<1>

Creates a new tensor with values from the given range.

§Arguments
  • range - The range of values.
  • device - The device to create the tensor on.
§Returns

The tensor with the given values.

§Remarks

Uses arange_step with a step size of 1 under the hood.

source

fn float_arange_step( range: Range<usize>, step: usize, device: &<B as Backend>::Device ) -> <B as Backend>::IntTensorPrimitive<1>

Creates a new tensor with values from the given range with the given step size.

§Arguments
  • range - The range of values.
  • step - The step size.
  • device - The device to create the tensor on.
§Returns

The tensor with the given values.

source

fn float_repeat<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize, times: usize ) -> <B as Backend>::FloatTensorPrimitive<D>

Repeat the tensor along the given dimension.

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

The tensor with the given dimension repeated.

source

fn float_clamp_min<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, min: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>

Clamps a tensor under a minimum value.

§Arguments
  • tensor - The tensor to clamp.
  • min - The minimum value.
§Returns

The clamped tensor.

source

fn float_clamp_max<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, max: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>

Clamps a tensor over a maximum value.

§Arguments
  • tensor - The tensor to clamp.
  • max - The maximum value.
§Returns

The clamped tensor.

source

fn float_clamp<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, min: <B as Backend>::FloatElem, max: <B as Backend>::FloatElem ) -> <B as Backend>::FloatTensorPrimitive<D>

Clamps a tensor between a minimum and maximum value.

§Arguments
  • tensor - The tensor to clamp.
  • min - The minimum value.
  • max - The maximum value.
§Returns

The clamped tensor.

source

fn float_neg<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Negates a tensor element-wise.

source

fn float_transpose<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Transposes a tensor.

§Arguments
  • tensor - The tensor to transpose.
§Returns

The transposed tensor.

source

fn float_detach<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Detaches a tensor from the computation graph.

source

fn float_set_require_grad<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, _require_grad: bool ) -> <B as Backend>::FloatTensorPrimitive<D>

Sets the require_grad flag of a tensor.

source

fn float_is_require_grad<const D: usize>( _tensor: &<B as Backend>::FloatTensorPrimitive<D> ) -> bool

Returns the require_grad flag of a tensor.

source

fn float_mean<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<1>

Mean of all elements in a tensor.

§Arguments
  • tensor - The tensor to mean.
§Returns

A scalar tensor with the mean of all elements in tensor.

source

fn float_powi<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::IntTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<D>

Elementwise power with an IntTensor.

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

The elements of lhs raised to the value of rhs. Result is an IntTensor.

source

fn float_powi_scalar<const D: usize>( lhs: <B as Backend>::FloatTensorPrimitive<D>, rhs: <B as Backend>::IntElem ) -> <B as Backend>::FloatTensorPrimitive<D>

raises a tensor to the power of a int scalar.

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

The elements of lhs raised to the value of rhs.

source

fn float_max<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<1>

Gets the maximum element of a tensor.

§Arguments
  • tensor - The tensor to get the maximum elements of.
§Returns

A tensor with the maximum element of tensor.

source

fn float_max_dim<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::FloatTensorPrimitive<D>

Gets the maximum elements of a tensor along an axis.

§Arguments
  • tensor - The tensor to get the maximum elements of.
  • dim - The dimension along which to get the maximum elements.
§Returns

A tensor with the maximum elements of tensor along dim.

source

fn float_max_dim_with_indices<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> (<B as Backend>::FloatTensorPrimitive<D>, <B as Backend>::IntTensorPrimitive<D>)

Gets the maximum elements of a tensor along an axis and their indices.

§Arguments
  • tensor - The tensor to get the maximum elements of.
  • dim - The dimension along which to get the maximum elements.
§Returns

A tuple with the maximum elements of tensor along dim and their indices.

source

fn float_min<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D> ) -> <B as Backend>::FloatTensorPrimitive<1>

Gets the minimum element of a tensor.

§Arguments
  • tensor - The tensor to get the minimum elements of.
§Returns

A tensor with the minimum element of tensor.

source

fn float_min_dim<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> <B as Backend>::FloatTensorPrimitive<D>

Gets the minimum elements of a tensor along an axis.

§Arguments
  • tensor - The tensor to get the minimum elements of.
  • dim - The dimension along which to get the minimum elements.
§Returns

A tensor with the minimum elements of tensor along dim.

source

fn float_min_dim_with_indices<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize ) -> (<B as Backend>::FloatTensorPrimitive<D>, <B as Backend>::IntTensorPrimitive<D>)

Gets the minimum elements of a tensor along an axis and their indices.

§Arguments
  • tensor - The tensor to get the minimum elements of.
  • dim - The dimension along which to get the minimum elements.
§Returns

A tuple with the minimum elements of tensor along dim and their indices.

source

fn float_narrow<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, dim: usize, start: usize, length: usize ) -> <B as Backend>::FloatTensorPrimitive<D>

Returns a new tensor with the given dimension narrowed to the given range.

§Arguments
  • dim - The dimension along which the tensor will be narrowed.
  • start - The starting point of the given range.
  • length - The ending point of the given range.
§Panics
  • If the dimension is greater than the number of dimensions of the tensor.
  • If the given range exceeds the number of elements on the given dimension.
§Returns

A new tensor with the given dimension narrowed to the given range.

source

fn float_chunk<const D: usize>( tensor: <B as Backend>::FloatTensorPrimitive<D>, chunks: usize, dim: usize ) -> Vec<<B as Backend>::FloatTensorPrimitive<D>>

Split the tensor along the given dimension into chunks.

§Arguments
  • tensor - The tensor.
  • chunks - The number of chunks to be produced
  • times - The dimension along which the tensor will be split.
§Returns

A vectors of tensors

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<B> FloatTensorOps<Autodiff<B>> for Autodiff<B>
where B: Backend,

source§

impl<B> FloatTensorOps<Fusion<B>> for Fusion<B>
where B: FusionBackend,

source§

impl<E> FloatTensorOps<LibTorch<E>> for LibTorch<E>
where E: TchElement,

source§

impl<E> FloatTensorOps<NdArray<E>> for NdArray<E>

source§

impl<F, I> FloatTensorOps<Candle<F, I>> for Candle<F, I>
where F: FloatCandleElement, I: IntCandleElement,

source§

impl<G, F, I> FloatTensorOps<Wgpu<G, F, I>> for Wgpu<G, F, I>
where G: GraphicsApi + 'static, F: FloatElement, I: IntElement,