Trait burn::tensor::ops::FloatTensorOps

pub trait FloatTensorOps<B>
where B: Backend,
{
Show 99 methods // Required methods fn float_from_data( data: TensorData, device: &<B as Backend>::Device, ) -> <B as Backend>::FloatTensorPrimitive; fn float_random( shape: Shape, distribution: Distribution, device: &<B as Backend>::Device, ) -> <B as Backend>::FloatTensorPrimitive; fn float_shape(tensor: &<B as Backend>::FloatTensorPrimitive) -> Shape; fn float_into_data( tensor: <B as Backend>::FloatTensorPrimitive, ) -> impl Future<Output = TensorData> + Send; fn float_device( tensor: &<B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::Device; fn float_to_device( tensor: <B as Backend>::FloatTensorPrimitive, device: &<B as Backend>::Device, ) -> <B as Backend>::FloatTensorPrimitive; fn float_into_int( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn float_empty( shape: Shape, device: &<B as Backend>::Device, ) -> <B as Backend>::FloatTensorPrimitive; fn float_add( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_add_scalar( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::FloatTensorPrimitive; fn float_sub( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_sub_scalar( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::FloatTensorPrimitive; fn float_mul( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_mul_scalar( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::FloatTensorPrimitive; fn float_div( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_div_scalar( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::FloatTensorPrimitive; fn float_remainder_scalar( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::FloatTensorPrimitive; fn float_matmul( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_recip( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_swap_dims( tensor: <B as Backend>::FloatTensorPrimitive, dim1: usize, dim2: usize, ) -> <B as Backend>::FloatTensorPrimitive; fn float_permute( tensor: <B as Backend>::FloatTensorPrimitive, axes: &[usize], ) -> <B as Backend>::FloatTensorPrimitive; fn float_flip( tensor: <B as Backend>::FloatTensorPrimitive, axes: &[usize], ) -> <B as Backend>::FloatTensorPrimitive; fn float_reshape( tensor: <B as Backend>::FloatTensorPrimitive, shape: Shape, ) -> <B as Backend>::FloatTensorPrimitive; fn float_gather( dim: usize, tensor: <B as Backend>::FloatTensorPrimitive, indices: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_scatter( dim: usize, tensor: <B as Backend>::FloatTensorPrimitive, indices: <B as Backend>::IntTensorPrimitive, value: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_select( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, indices: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_select_assign( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, indices: <B as Backend>::IntTensorPrimitive, value: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_slice( tensor: <B as Backend>::FloatTensorPrimitive, ranges: &[Range<usize>], ) -> <B as Backend>::FloatTensorPrimitive; fn float_slice_assign( tensor: <B as Backend>::FloatTensorPrimitive, ranges: &[Range<usize>], value: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_mask_where( tensor: <B as Backend>::FloatTensorPrimitive, mask: <B as Backend>::BoolTensorPrimitive, value: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_mask_fill( tensor: <B as Backend>::FloatTensorPrimitive, mask: <B as Backend>::BoolTensorPrimitive, value: <B as Backend>::FloatElem, ) -> <B as Backend>::FloatTensorPrimitive; fn float_equal( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive; fn float_equal_elem( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::BoolTensorPrimitive; fn float_greater( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive; fn float_greater_elem( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::BoolTensorPrimitive; fn float_greater_equal( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive; fn float_greater_equal_elem( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::BoolTensorPrimitive; fn float_lower( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive; fn float_lower_elem( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::BoolTensorPrimitive; fn float_lower_equal( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive; fn float_lower_equal_elem( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::BoolTensorPrimitive; fn float_sum( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_sum_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::FloatTensorPrimitive; fn float_mean_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::FloatTensorPrimitive; fn float_exp( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_log( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_log1p( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_powf( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_powf_scalar( tensor: <B as Backend>::FloatTensorPrimitive, value: f32, ) -> <B as Backend>::FloatTensorPrimitive; fn float_sqrt( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_abs( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_cos( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_sin( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_tanh( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_round( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_floor( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_ceil( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_erf( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn float_argmax( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn float_argmin( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn float_expand( tensor: <B as Backend>::FloatTensorPrimitive, shape: Shape, ) -> <B as Backend>::FloatTensorPrimitive; // Provided methods fn float_zeros( shape: Shape, device: &<B as Backend>::Device, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_ones( shape: Shape, device: &<B as Backend>::Device, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_full( shape: Shape, fill_value: <B as Backend>::FloatElem, device: &<B as Backend>::Device, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_repeat_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, times: usize, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_clamp_min( tensor: <B as Backend>::FloatTensorPrimitive, min: <B as Backend>::FloatElem, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_clamp_max( tensor: <B as Backend>::FloatTensorPrimitive, max: <B as Backend>::FloatElem, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_clamp( tensor: <B as Backend>::FloatTensorPrimitive, min: <B as Backend>::FloatElem, max: <B as Backend>::FloatElem, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_neg( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_transpose( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_not_equal( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn float_not_equal_elem( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn float_detach( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_set_require_grad( tensor: <B as Backend>::FloatTensorPrimitive, _require_grad: bool, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_is_require_grad( _tensor: &<B as Backend>::FloatTensorPrimitive, ) -> bool { ... } fn float_prod( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_prod_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_mean( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_into_full_precision( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <<<B as Backend>::FullPrecisionBridge as BackendBridge<B>>::Target as Backend>::FloatTensorPrimitive { ... } fn float_from_full_precision( tensor: <<<B as Backend>::FullPrecisionBridge as BackendBridge<B>>::Target as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_powi( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_powi_scalar( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_cat( tensors: Vec<<B as Backend>::FloatTensorPrimitive>, dim: usize, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_max( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_max_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_max_dim_with_indices( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> (<B as Backend>::FloatTensorPrimitive, <B as Backend>::IntTensorPrimitive) { ... } fn float_min( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_min_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_min_dim_with_indices( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> (<B as Backend>::FloatTensorPrimitive, <B as Backend>::IntTensorPrimitive) { ... } fn float_narrow( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, start: usize, length: usize, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_chunk( tensor: <B as Backend>::FloatTensorPrimitive, chunks: usize, dim: usize, ) -> Vec<<B as Backend>::FloatTensorPrimitive> { ... } fn float_any( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn float_any_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn float_all( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn float_all_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn float_sign( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_sort( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, descending: bool, ) -> <B as Backend>::FloatTensorPrimitive { ... } fn float_sort_with_indices( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, descending: bool, ) -> (<B as Backend>::FloatTensorPrimitive, <B as Backend>::IntTensorPrimitive) { ... } fn float_argsort( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, descending: bool, ) -> <B as Backend>::IntTensorPrimitive { ... }
}
Expand description

Operations on float tensors.

Required Methods§

fn float_from_data( data: TensorData, device: &<B as Backend>::Device, ) -> <B as Backend>::FloatTensorPrimitive

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.

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

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.

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

Gets the shape of the tensor.

§Arguments
  • tensor - The tensor.
§Returns

The shape of the tensor.

fn float_into_data( tensor: <B as Backend>::FloatTensorPrimitive, ) -> impl Future<Output = TensorData> + Send

Converts the tensor to a data structure.

§Arguments
  • tensor - The tensor.
§Returns

The data structure with the tensor’s data.

fn float_device( tensor: &<B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::Device

Gets the device of the tensor.

§Arguments
  • tensor - The tensor.
§Returns

The device of the tensor.

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

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.

fn float_into_int( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive

Converts float tensor to int tensor.

§Arguments
  • tensor - The tensor.
§Returns

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

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

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.

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

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.

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

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.

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

Subtracts two tensors.

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

The result of subtracting the two tensors.

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

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.

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

Multiplies two tensors together element-wise.

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

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.

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

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.

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

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.

fn float_remainder_scalar( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::FloatTensorPrimitive

Computes the modulus of a tensor given a scalar.

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

The result of applying the modulus of the scalar to the tensor.

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

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.

fn float_recip( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

Calculates the reciprocals element-wise

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

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.

fn float_permute( tensor: <B as Backend>::FloatTensorPrimitive, axes: &[usize], ) -> <B as Backend>::FloatTensorPrimitive

Permutes the dimensions of a tensor.

§Arguments
  • tensor - The tensor to permute the dimensions of.
  • axes - The new order of the dimensions.
§Returns

The tensor with the dimensions permuted.

fn float_flip( tensor: <B as Backend>::FloatTensorPrimitive, axes: &[usize], ) -> <B as Backend>::FloatTensorPrimitive

Reverse the order of elements in a tensor along the given axes.

§Arguments
  • tensor - The tensor to reverse.
  • axes - The axes to reverse.

The tensor with the elements reversed.

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

Reshapes a tensor.

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

The tensor with the new shape.

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

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.

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

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.

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

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.

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

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.

fn float_slice( tensor: <B as Backend>::FloatTensorPrimitive, ranges: &[Range<usize>], ) -> <B as Backend>::FloatTensorPrimitive

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

fn float_sum( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

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

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.

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

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.

fn float_exp( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

fn float_log( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

fn float_log1p( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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).

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

Element-wise 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.

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

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.

fn float_sqrt( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

fn float_abs( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

fn float_cos( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

fn float_sin( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

fn float_tanh( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

fn float_round( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

Returns a new tensor with rounded values.

This function should implement the round half to even strategy, with halfway cases rounded to the nearest even integer value.

§Arguments
  • tensor - The tensor to be rounded.
§Returns

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

fn float_floor( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

Returns a new tensor with floored values.

§Arguments
  • tensor - The tensor to be floored.
§Returns

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

fn float_ceil( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

Returns a new tensor with ceiled values.

§Arguments
  • tensor - The tensor to be ceiled.
§Returns

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

fn float_erf( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

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

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.

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

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.

fn float_expand( tensor: <B as Backend>::FloatTensorPrimitive, shape: Shape, ) -> <B as Backend>::FloatTensorPrimitive

Broadcasts the float tensor to the given shape.

Provided Methods§

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

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.

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

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.

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

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

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

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.

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

Clamps a tensor under a minimum value.

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

The clamped tensor.

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

Clamps a tensor over a maximum value.

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

The clamped tensor.

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

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.

fn float_neg( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

Negates a tensor element-wise.

fn float_transpose( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

Transposes a tensor.

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

The transposed tensor.

fn float_not_equal( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise non-equality comparison.

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

A boolean tensor with the result of the comparison.

fn float_not_equal_elem( lhs: <B as Backend>::FloatTensorPrimitive, rhs: <B as Backend>::FloatElem, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise non-equality comparison with 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.

fn float_detach( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

Detaches a tensor from the computation graph.

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

Sets the require_grad flag of a tensor.

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

Returns the require_grad flag of a tensor.

fn float_prod( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

Product of all elements in a tensor.

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

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

fn float_prod_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::FloatTensorPrimitive

Product of all elements in a tensor along a dimension.

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

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

fn float_mean( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

fn float_into_full_precision( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <<<B as Backend>::FullPrecisionBridge as BackendBridge<B>>::Target as Backend>::FloatTensorPrimitive

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.

fn float_from_full_precision( tensor: <<<B as Backend>::FullPrecisionBridge as BackendBridge<B>>::Target as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

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

Element-wise 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.

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

raises a tensor to the power of an 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.

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

Concatenates tensors along a dimension.

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

A tensor with the concatenated tensors along dim.

fn float_max( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

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

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.

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

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.

fn float_min( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

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.

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

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.

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

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.

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

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.

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

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 vector of tensors

fn float_any( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Tests if any element in the float tensor evaluates to True.

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

A boolean tensor with a single element, True if any element in the tensor is True, False otherwise.

fn float_any_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive

Tests if any element in the float tensor evaluates to True along a given dimension dim.

§Arguments
  • tensor - The tensor to test.
  • dim - The axis along which to test.
§Returns

A boolean tensor Tensor<B, D, Bool> with the same size as input tensor, except in the dim axis where the size is 1. The elem in the dim axis is True if any element along this dim in the input evaluates to True, False otherwise.

fn float_all( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Tests if all elements in the float tensor evaluate to True.

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

A boolean tensor Tensor<B, 1, Bool> with a single element, True if all elements in the input tensor evaluate to True, False otherwise.

fn float_all_dim( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive

Tests if all elements in the float tensor evaluate to True along a given dimension dim.

§Arguments
  • tensor - The tensor to test.
  • dim - The axis along which to test.
§Returns

A boolean tensor Tensor<B, D, Bool> with the same size as input tensor, except in the dim axis where the size is 1. The elem in the dim axis is True if all elements along this dim in the input evaluates to True, False otherwise.

fn float_sign( tensor: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive

Returns the signs of the float tensor.

§Arguments
  • tensor - The tensor to extract the signs from.
§Returns

A tensor with the same shape as tensor containing the signs of the elements of tensor.

fn float_sort( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, descending: bool, ) -> <B as Backend>::FloatTensorPrimitive

Sort the elements of the input tensor by value in along a given dimension.

This sort is unstable (i.e., may reorder equal elements).

§Arguments
  • tensor - The input tensor.
  • dim - The axis along which to sort.
  • descending - The sorting order.
§Returns

A tensor with the same shape as the input tensor, where the elements are sorted by value.

fn float_sort_with_indices( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, descending: bool, ) -> (<B as Backend>::FloatTensorPrimitive, <B as Backend>::IntTensorPrimitive)

Sort the elements of the input tensor by value in along a given dimension.

This sort is unstable (i.e., may reorder equal elements).

§Arguments
  • tensor - The input tensor.
  • dim - The axis along which to sort.
  • descending - The sorting order.
§Returns

A tensor with the same shape as the input tensor and corresponding indices, where the elements are sorted by value and the indices map back to the original input tensor.

fn float_argsort( tensor: <B as Backend>::FloatTensorPrimitive, dim: usize, descending: bool, ) -> <B as Backend>::IntTensorPrimitive

Returns the indices that sort the elements of the input tensor by value along a given dimension.

This sort is unstable (i.e., may reorder equal elements).

§Arguments
  • tensor - The input tensor.
  • dim - The axis along which to sort.
  • descending - The sorting order.
§Returns

A tensor with the same shape as the input tensor the indices map back to the original input tensor.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

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

§

fn float_from_data( data: TensorData, device: &<Fusion<B> as Backend>::Device, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

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

§

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

§

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

§

fn float_shape(tensor: &<Fusion<B> as Backend>::FloatTensorPrimitive) -> Shape

§

async fn float_into_data( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> TensorData

§

fn float_device( tensor: &<Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::Device

§

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

§

fn float_into_int( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::IntTensorPrimitive

§

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

§

fn float_add( lhs: <Fusion<B> as Backend>::FloatTensorPrimitive, rhs: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

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

§

fn float_sub( lhs: <Fusion<B> as Backend>::FloatTensorPrimitive, rhs: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

fn float_mul( lhs: <Fusion<B> as Backend>::FloatTensorPrimitive, rhs: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

fn float_div( lhs: <Fusion<B> as Backend>::FloatTensorPrimitive, rhs: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

fn float_remainder_scalar( lhs: <Fusion<B> as Backend>::FloatTensorPrimitive, rhs: <Fusion<B> as Backend>::FloatElem, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_matmul( lhs: <Fusion<B> as Backend>::FloatTensorPrimitive, rhs: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

fn float_reshape( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, shape: Shape, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

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

§

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

§

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

§

fn float_slice( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ranges: &[Range<usize>], ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_slice_assign( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ranges: &[Range<usize>], value: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

fn float_sum( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

fn float_mean( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

fn float_exp( lhs: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_log( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_log1p( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_powf_scalar( lhs: <Fusion<B> as Backend>::FloatTensorPrimitive, rhs: f32, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_sqrt( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_abs( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_cos( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_sin( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_tanh( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_recip( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_erf( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

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

§

fn float_repeat_dim( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, dim: usize, times: usize, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

fn float_max( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

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

§

fn float_min( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

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

§

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

§

fn float_powf( lhs: <Fusion<B> as Backend>::FloatTensorPrimitive, rhs: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_permute( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, axes: &[usize], ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_expand( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, shape: Shape, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_flip( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, axes: &[usize], ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_round( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_floor( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn float_ceil( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

Implementors§

§

impl<B, C> FloatTensorOps<Autodiff<B, C>> for Autodiff<B, C>

§

impl<E, I, Q> FloatTensorOps<NdArray<E, I, Q>> for NdArray<E, I, Q>
where E: FloatNdArrayElement, I: IntNdArrayElement, Q: QuantElement,

§

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

§

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

§

impl<R, F, I> FloatTensorOps<JitBackend<R, F, I>> for JitBackend<R, F, I>
where R: JitRuntime, F: FloatElement, I: IntElement,