Trait IntTensorOps

pub trait IntTensorOps<B>
where B: Backend,
{
Show 103 methods // Required methods fn int_empty( shape: Shape, device: &<B as Backend>::Device, dtype: IntDType, ) -> <B as Backend>::IntTensorPrimitive; fn int_into_data( tensor: <B as Backend>::IntTensorPrimitive, ) -> impl Future<Output = TensorData> + Send; fn int_from_data( data: TensorData, device: &<B as Backend>::Device, ) -> <B as Backend>::IntTensorPrimitive; fn int_device( tensor: &<B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::Device; fn int_to_device( tensor: <B as Backend>::IntTensorPrimitive, device: &<B as Backend>::Device, ) -> <B as Backend>::IntTensorPrimitive; fn int_reshape( tensor: <B as Backend>::IntTensorPrimitive, shape: Shape, ) -> <B as Backend>::IntTensorPrimitive; fn int_slice( tensor: <B as Backend>::IntTensorPrimitive, slices: &[Slice], ) -> <B as Backend>::IntTensorPrimitive; fn int_slice_assign( tensor: <B as Backend>::IntTensorPrimitive, slices: &[Slice], value: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_into_float( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::FloatTensorPrimitive; fn int_mask_where( tensor: <B as Backend>::IntTensorPrimitive, mask: <B as Backend>::BoolTensorPrimitive, source: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_mask_fill( tensor: <B as Backend>::IntTensorPrimitive, mask: <B as Backend>::BoolTensorPrimitive, value: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn int_gather( dim: usize, tensor: <B as Backend>::IntTensorPrimitive, indices: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_scatter( dim: usize, tensor: <B as Backend>::IntTensorPrimitive, indices: <B as Backend>::IntTensorPrimitive, value: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_select( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, indices: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_select_assign( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, indices: <B as Backend>::IntTensorPrimitive, value: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_equal( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive; fn int_equal_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive; fn int_greater( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive; fn int_greater_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive; fn int_greater_equal( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive; fn int_greater_equal_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive; fn int_lower( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive; fn int_lower_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive; fn int_lower_equal( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive; fn int_lower_equal_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive; fn int_add( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_add_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn int_sub( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_sub_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn int_mul( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_mul_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn int_div( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_div_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn int_remainder( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_remainder_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn int_matmul( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_sum( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_sum_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn int_prod( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_prod_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn int_mean_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn int_cumsum( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn int_cumprod( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn int_cummin( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn int_cummax( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn int_argmax( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn int_argmin( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive; fn int_abs( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn int_swap_dims( tensor: <B as Backend>::IntTensorPrimitive, dim1: usize, dim2: usize, ) -> <B as Backend>::IntTensorPrimitive; fn int_permute( tensor: <B as Backend>::IntTensorPrimitive, axes: &[usize], ) -> <B as Backend>::IntTensorPrimitive; fn int_flip( tensor: <B as Backend>::IntTensorPrimitive, axes: &[usize], ) -> <B as Backend>::IntTensorPrimitive; fn int_random( shape: Shape, distribution: Distribution, device: &<B as Backend>::Device, ) -> <B as Backend>::IntTensorPrimitive; fn int_expand( tensor: <B as Backend>::IntTensorPrimitive, shape: Shape, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_and( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_and_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_or( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_or_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_xor( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_xor_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_not( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_left_shift( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_left_shift_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_right_shift( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive; fn bitwise_right_shift_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive; fn int_cast( tensor: <B as Backend>::IntTensorPrimitive, dtype: IntDType, ) -> <B as Backend>::IntTensorPrimitive; fn int_unfold( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, size: usize, step: usize, ) -> <B as Backend>::IntTensorPrimitive; // Provided methods fn int_repeat_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, times: usize, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_cat( tensors: Vec<<B as Backend>::IntTensorPrimitive>, dim: usize, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_not_equal( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn int_not_equal_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn int_powi( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_powf( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::FloatTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_powi_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_powi_scalar_impl( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_powf_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: f32, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_powf_scalar_impl( lhs: <B as Backend>::IntTensorPrimitive, rhs: f32, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_clamp_min( tensor: <B as Backend>::IntTensorPrimitive, min: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_clamp_max( tensor: <B as Backend>::IntTensorPrimitive, max: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_clamp( tensor: <B as Backend>::IntTensorPrimitive, min: <B as Backend>::IntElem, max: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_neg( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_zeros( shape: Shape, device: &<B as Backend>::Device, dtype: IntDType, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_ones( shape: Shape, device: &<B as Backend>::Device, dtype: IntDType, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_full( shape: Shape, fill_value: <B as Backend>::IntElem, device: &<B as Backend>::Device, dtype: IntDType, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_mean( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_max( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_max_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_max_dim_with_indices( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> (<B as Backend>::IntTensorPrimitive, <B as Backend>::IntTensorPrimitive) { ... } fn int_max_abs( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_max_abs_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_min( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_min_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_min_dim_with_indices( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> (<B as Backend>::IntTensorPrimitive, <B as Backend>::IntTensorPrimitive) { ... } fn int_transpose( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_arange_step( range: Range<i64>, step: usize, device: &<B as Backend>::Device, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_arange( range: Range<i64>, device: &<B as Backend>::Device, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_any( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn int_any_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn int_all( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn int_all_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive { ... } fn int_sign( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_sort( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, descending: bool, ) -> <B as Backend>::IntTensorPrimitive { ... } fn int_sort_with_indices( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, descending: bool, ) -> (<B as Backend>::IntTensorPrimitive, <B as Backend>::IntTensorPrimitive) { ... } fn int_argsort( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, descending: bool, ) -> <B as Backend>::IntTensorPrimitive { ... }
}
Expand description

Int Tensor API for basic and numeric operations, see tensor for documentation on each function.

Required Methods§

fn int_empty( shape: Shape, device: &<B as Backend>::Device, dtype: IntDType, ) -> <B as Backend>::IntTensorPrimitive

Creates a new int tensor.

§Arguments
  • shape - The shape of the tensor.
  • device - The device to create the tensor on.
  • dtype - The target data type.
§Returns

The integer tensor with the given shape.

fn int_into_data( tensor: <B as Backend>::IntTensorPrimitive, ) -> 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 int_from_data( data: TensorData, device: &<B as Backend>::Device, ) -> <B as Backend>::IntTensorPrimitive

Creates a tensor from the data structure.

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

The tensor with the data.

fn int_device( tensor: &<B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::Device

Gets the device of the tensor.

§Arguments
  • tensor - The tensor.
§Returns

The device of the tensor.

fn int_to_device( tensor: <B as Backend>::IntTensorPrimitive, device: &<B as Backend>::Device, ) -> <B as Backend>::IntTensorPrimitive

Moves the tensor to the given device.

fn int_reshape( tensor: <B as Backend>::IntTensorPrimitive, shape: Shape, ) -> <B as Backend>::IntTensorPrimitive

Reshapes the tensor.

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

The tensor with the new shape.

fn int_slice( tensor: <B as Backend>::IntTensorPrimitive, slices: &[Slice], ) -> <B as Backend>::IntTensorPrimitive

Gets the element at the given indices.

§Arguments
  • tensor - The tensor.
  • slices - The slices specifying ranges and steps for each dimension.
§Returns

The elements at the given indices.

fn int_slice_assign( tensor: <B as Backend>::IntTensorPrimitive, slices: &[Slice], value: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive

Sets the values in the tensor for the given ranges.

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

The tensor with the values set for the given ranges.

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

Converts int tensor to float tensor.

§Arguments
  • tensor - The tensor.
§Returns

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

fn int_mask_where( tensor: <B as Backend>::IntTensorPrimitive, mask: <B as Backend>::BoolTensorPrimitive, source: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive

Fills the tensor with values from the source tensor if the mask is true at the given indices.

§Arguments
  • tensor - The tensor.
  • mask - The mask.
  • source - The source tensor.
§Returns

The tensor with the values filled.

fn int_mask_fill( tensor: <B as Backend>::IntTensorPrimitive, mask: <B as Backend>::BoolTensorPrimitive, value: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Fills the tensor with the given value if the mask is true at the given indices.

§Arguments
  • tensor - The tensor.
  • mask - The mask.
  • value - The value.
§Returns

The tensor with the values filled.

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

Gather elements from the tensor at the given indices.

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

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

Scatter a given value to the tensor at the given indices.

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

The tensor with the values scattered.

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

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

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

The tensor with the selected elements.

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

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

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

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

fn int_equal( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise equality comparison.

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

The boolean tensor with the result of the comparison.

fn int_equal_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise equality comparison with a scalar.

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

The boolean tensor with the result of the comparison.

fn int_greater( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise greater than comparison.

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

The boolean tensor with the result of the comparison.

fn int_greater_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise greater than comparison with a scalar.

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

The boolean tensor with the result of the comparison.

fn int_greater_equal( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise greater than or equal comparison.

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

The boolean tensor with the result of the comparison.

fn int_greater_equal_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise greater than or equal comparison with a scalar.

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

The boolean tensor with the result of the comparison.

fn int_lower( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise less than comparison.

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

The boolean tensor with the result of the comparison.

fn int_lower_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise less than comparison with a scalar.

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

The boolean tensor with the result of the comparison.

fn int_lower_equal( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise less than or equal comparison.

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

The boolean tensor with the result of the comparison.

fn int_lower_equal_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise less than or equal comparison with a scalar.

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

The boolean tensor with the result of the comparison.

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

Element-wise addition.

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

The result of the addition.

fn int_add_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Element-wise addition with a scalar.

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

The result of the addition.

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

Element-wise subtraction.

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

The result of the subtraction.

fn int_sub_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Element-wise subtraction with a scalar.

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

The result of the subtraction.

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

Element-wise multiplication.

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

The result of the multiplication.

fn int_mul_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Element-wise multiplication with a scalar.

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

The result of the multiplication.

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

Element-wise division.

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

The result of the division.

fn int_div_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Element-wise division with a scalar.

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

The result of the division.

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

Element-wise modulus.

§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 int_remainder_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Element-wise modulus with 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 int_matmul( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive

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 int_sum( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive

Sums all elements in the tensor.

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

The sum of all elements in the tensor.

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

Sums all elements in the tensor along a dimension.

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

The sum of all elements in the tensor along the dimension.

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

Computes the product of all elements in the tensor.

§Arguments
  • tensor - The tensor to compute the product of.
§Returns

The product of all elements in the tensor.

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

Computes the product of all elements in the tensor along a dimension.

§Arguments
  • tensor - The tensor to compute the product of.
  • dim - The dimension to compute the product along.
§Returns

The product of all elements in the tensor along the dimension.

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

Computes the mean of all elements in the tensor along a dimension.

§Arguments
  • tensor - The tensor to compute the mean of.
§Returns

The mean of all elements in the tensor along the dimension.

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

Computes the cumulative sum of elements along a dimension.

§Arguments
  • tensor - The tensor to compute the cumulative sum of.
  • dim - The dimension along which to compute the cumulative sum.
§Returns

A tensor with the same shape where each element is the cumulative sum of all elements up to and including that position along the dimension.

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

Computes the cumulative product of elements along a dimension.

§Arguments
  • tensor - The tensor to compute the cumulative product of.
  • dim - The dimension along which to compute the cumulative product.
§Returns

A tensor with the same shape where each element is the cumulative product of all elements up to and including that position along the dimension.

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

Computes the cumulative minimum of elements along a dimension.

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

A tensor with the same shape where each element is the minimum of all elements up to and including that position along the dimension.

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

Computes the cumulative maximum of elements along a dimension.

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

A tensor with the same shape where each element is the maximum of all elements up to and including that position along the dimension.

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

Gets the indices of the maximum elements along a dimension.

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

The indices of the maximum elements along the dimension.

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

Gets the indices of the minimum elements along a dimension.

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

The indices of the minimum elements along the dimension.

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

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 int_swap_dims( tensor: <B as Backend>::IntTensorPrimitive, dim1: usize, dim2: usize, ) -> <B as Backend>::IntTensorPrimitive

Swaps two dimensions of an int 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 int_permute( tensor: <B as Backend>::IntTensorPrimitive, axes: &[usize], ) -> <B as Backend>::IntTensorPrimitive

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 int_flip( tensor: <B as Backend>::IntTensorPrimitive, axes: &[usize], ) -> <B as Backend>::IntTensorPrimitive

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 int_random( shape: Shape, distribution: Distribution, device: &<B as Backend>::Device, ) -> <B as Backend>::IntTensorPrimitive

Creates a new int 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 int_expand( tensor: <B as Backend>::IntTensorPrimitive, shape: Shape, ) -> <B as Backend>::IntTensorPrimitive

Broadcasts the int tensor to the given shape.

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

Bitwise AND operation for Int Tensors

fn bitwise_and_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Bitwise AND operation for Int Tensors with a scalar

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

Bitwise OR operation for Int Tensors

fn bitwise_or_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Bitwise OR operation for Int Tensors with a scalar

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

Bitwise XOR operation for Int Tensors

fn bitwise_xor_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Bitwise XOR operation for Int Tensors with a scalar

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

Bitwise NOT operation for Int Tensors

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

Bitwise left shift operation for Int Tensors

fn bitwise_left_shift_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Bitwise left shift operation for Int Tensors with a scalar

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

Bitwise right shift operation for Int Tensors

fn bitwise_right_shift_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Bitwise right shift operation for Int Tensors with a scalar

fn int_cast( tensor: <B as Backend>::IntTensorPrimitive, dtype: IntDType, ) -> <B as Backend>::IntTensorPrimitive

Converts a tensor to another integer data type.

§Arguments
  • tensor - The tensor to convert.
  • dtype - The target data type.
§Returns

A tensor with the same values as tensor but in the target integer data type.

fn int_unfold( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, size: usize, step: usize, ) -> <B as Backend>::IntTensorPrimitive

Unfold windows along a dimension.

Returns a view of the tensor with all complete windows of size size in dimension dim; where windows are advanced by step at each index.

The number of windows is max(0, (shape[dim] - size).ceil_div(step)).

§Arguments
  • tensor - The input tensor to unfold; of shape [pre=..., dim shape, post=...]
  • dim - the selected dim.
  • size - the size of each unfolded window.
  • step - the step between each window.
§Returns

A tensor view with shape [pre=..., windows, size, post=...].

Provided Methods§

fn int_repeat_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, times: usize, ) -> <B as Backend>::IntTensorPrimitive

Repeats the tensor along the given dimension the given number of times.

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

The tensor with the given dimension repeated the given number of times.

fn int_cat( tensors: Vec<<B as Backend>::IntTensorPrimitive>, dim: usize, ) -> <B as Backend>::IntTensorPrimitive

Concatenates the given tensors along the given dimension.

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

The concatenated tensor.

fn int_not_equal( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Element-wise non-equality comparison.

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

The boolean tensor with the result of the comparison.

fn int_not_equal_elem( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <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

The boolean tensor with the result of the comparison.

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

Element-wise power with a IntTensor.

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

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

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

Element-wise power with a floatTensor.

§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 int_powi_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Element-wise power with a scalar.

§Backend Implementors Note

A number of common exponent cases can be implemented with operations which are much cheaper than generic exponentiation.

This (Backend impl overridable) operation handles generic optimizations for several common integer exponent cases; and then dispatches to the (Backend impl overridable) Self::int_powi_scalar_impl operation to handle the generic case.

§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 int_powi_scalar_impl( lhs: <B as Backend>::IntTensorPrimitive, rhs: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Element-wise power with a scalar.

§Backend Implementors Note

This is the generic implementation of integer exponentiation called by Self::int_powi_scalar in the fallback case.

By default, this performs a relatively expensive conversion to float, exponentiation in float, and conversion back to int. This reduces the minimal operation set for Backends, at the cost of performance.

This is a good target for specialized optimizations in Backend implementations.

As a general rule, this should not be called directly.

§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 int_powf_scalar( lhs: <B as Backend>::IntTensorPrimitive, rhs: f32, ) -> <B as Backend>::IntTensorPrimitive

Element-wise power with a floatTensor.

Handles a number of special cases, then calls Self::int_powf_scalar_impl.

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

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

fn int_powf_scalar_impl( lhs: <B as Backend>::IntTensorPrimitive, rhs: f32, ) -> <B as Backend>::IntTensorPrimitive

Element-wise power with a floatTensor.

Fallback handler for Self::int_powf_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. Result is an IntTensor.

fn int_clamp_min( tensor: <B as Backend>::IntTensorPrimitive, min: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Clamps a tensor under a minimum value.

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

The clamped tensor.

fn int_clamp_max( tensor: <B as Backend>::IntTensorPrimitive, max: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

Clamps a tensor over a maximum value.

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

The clamped tensor.

fn int_clamp( tensor: <B as Backend>::IntTensorPrimitive, min: <B as Backend>::IntElem, max: <B as Backend>::IntElem, ) -> <B as Backend>::IntTensorPrimitive

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 int_neg( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive

Element-wise negation.

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

The negated tensor.

fn int_zeros( shape: Shape, device: &<B as Backend>::Device, dtype: IntDType, ) -> <B as Backend>::IntTensorPrimitive

Creates a tensor of zeros.

§Arguments
  • shape - The shape of the tensor.
  • device - The device to create the tensor on.
  • dtype - The target data type.
§Returns

The tensor of zeros.

fn int_ones( shape: Shape, device: &<B as Backend>::Device, dtype: IntDType, ) -> <B as Backend>::IntTensorPrimitive

Creates a tensor of ones.

§Arguments
  • shape - The shape of the tensor.
  • device - The device to create the tensor on.
  • dtype - The target data type.
§Returns

The tensor of ones.

fn int_full( shape: Shape, fill_value: <B as Backend>::IntElem, device: &<B as Backend>::Device, dtype: IntDType, ) -> <B as Backend>::IntTensorPrimitive

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.
  • dtype - The target data type.
§Returns

The tensor filled with given value

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

Computes the mean of all elements in the tensor.

§Arguments
  • tensor - The tensor to compute the mean of.
§Returns

The mean of all elements in the tensor.

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

Gets the maximum element in the tensor.

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

The maximum element in the tensor.

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

Gets the maximum element in the tensor along a dimension.

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

The maximum element in the tensor along the dimension.

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

Gets the maximum elements and corresponding indices along a dimension.

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

The maximum elements and corresponding indices along the dimension.

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

Gets the maximum absolute element in the tensor.

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

The maximum element in the tensor.

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

Gets the maximum absolute element in the tensor along a dimension.

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

The maximum element in the tensor along the dimension.

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

Gets the minimum element in the tensor.

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

The minimum element in the tensor.

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

Gets the minimum elements in the tensor along a dimension.

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

The minimum element in the tensor along the dimension.

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

Gets the minimum elements and corresponding indices along a dimension.

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

The minimum elements and corresponding indices along the dimension.

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

Transposes an int tensor.

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

The transposed tensor.

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

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.

fn int_arange( range: Range<i64>, device: &<B as Backend>::Device, ) -> <B as Backend>::IntTensorPrimitive

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.

fn int_any( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Tests if any element in the int 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 int_any_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive

Tests if any element in the int 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 int_all( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::BoolTensorPrimitive

Tests if all elements in the int 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 int_all_dim( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, ) -> <B as Backend>::BoolTensorPrimitive

Tests if all elements in the int 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 int_sign( tensor: <B as Backend>::IntTensorPrimitive, ) -> <B as Backend>::IntTensorPrimitive

Returns the signs of the int 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 int_sort( tensor: <B as Backend>::IntTensorPrimitive, dim: usize, descending: bool, ) -> <B as Backend>::IntTensorPrimitive

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, where the elements are sorted by value.

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

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.
§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 int_argsort( tensor: <B as Backend>::IntTensorPrimitive, 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl<E, I, Q> IntTensorOps<NdArray<E, I, Q>> for NdArray<E, I, Q>
where E: FloatNdArrayElement, I: IntNdArrayElement, Q: QuantElement, NdArrayTensor: From<ArrayBase<OwnedArcRepr<E>, Dim<IxDynImpl>>> + From<ArrayBase<OwnedArcRepr<I>, Dim<IxDynImpl>>>,

§

fn int_from_data(data: TensorData, _device: &NdArrayDevice) -> NdArrayTensor

§

async fn int_into_data(tensor: NdArrayTensor) -> TensorData

§

fn int_to_device( tensor: NdArrayTensor, _device: &NdArrayDevice, ) -> NdArrayTensor

§

fn int_reshape(tensor: NdArrayTensor, shape: Shape) -> NdArrayTensor

§

fn int_slice(tensor: NdArrayTensor, slices: &[Slice]) -> NdArrayTensor

§

fn int_device(_tensor: &NdArrayTensor) -> <NdArray<E> as Backend>::Device

§

fn int_empty( shape: Shape, device: &<NdArray<E> as Backend>::Device, dtype: IntDType, ) -> NdArrayTensor

§

fn int_matmul( lhs: <NdArray<E, I, Q> as Backend>::IntTensorPrimitive, rhs: <NdArray<E, I, Q> as Backend>::IntTensorPrimitive, ) -> <NdArray<E, I, Q> as Backend>::IntTensorPrimitive

§

fn int_mask_where( tensor: NdArrayTensor, mask: NdArrayTensor, source: NdArrayTensor, ) -> NdArrayTensor

§

fn int_mask_fill( tensor: NdArrayTensor, mask: NdArrayTensor, value: I, ) -> NdArrayTensor

§

fn int_slice_assign( tensor: NdArrayTensor, slices: &[Slice], value: NdArrayTensor, ) -> NdArrayTensor

§

fn int_cat(tensors: Vec<NdArrayTensor>, dim: usize) -> NdArrayTensor

§

fn int_equal(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_equal_elem(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_greater(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_greater_elem(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_greater_equal(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_greater_equal_elem(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_lower(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_lower_elem(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_lower_equal(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_lower_equal_elem(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_add(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_add_scalar(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_sub(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_sub_scalar(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_mul(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_mul_scalar(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_div(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_div_scalar(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_remainder(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_remainder_scalar(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_neg(tensor: NdArrayTensor) -> NdArrayTensor

§

fn int_sum(tensor: NdArrayTensor) -> NdArrayTensor

§

fn int_sum_dim(tensor: NdArrayTensor, dim: usize) -> NdArrayTensor

§

fn int_prod(tensor: NdArrayTensor) -> NdArrayTensor

§

fn int_prod_dim(tensor: NdArrayTensor, dim: usize) -> NdArrayTensor

§

fn int_mean(tensor: NdArrayTensor) -> NdArrayTensor

§

fn int_mean_dim(tensor: NdArrayTensor, dim: usize) -> NdArrayTensor

§

fn int_cumsum(tensor: NdArrayTensor, dim: usize) -> NdArrayTensor

§

fn int_cumprod(tensor: NdArrayTensor, dim: usize) -> NdArrayTensor

§

fn int_cummin(tensor: NdArrayTensor, dim: usize) -> NdArrayTensor

§

fn int_cummax(tensor: NdArrayTensor, dim: usize) -> NdArrayTensor

§

fn int_gather( dim: usize, tensor: NdArrayTensor, indices: NdArrayTensor, ) -> NdArrayTensor

§

fn int_scatter( dim: usize, tensor: NdArrayTensor, indices: NdArrayTensor, value: NdArrayTensor, ) -> NdArrayTensor

§

fn int_select( tensor: NdArrayTensor, dim: usize, indices: NdArrayTensor, ) -> NdArrayTensor

§

fn int_select_assign( tensor: NdArrayTensor, dim: usize, indices: NdArrayTensor, value: NdArrayTensor, ) -> NdArrayTensor

§

fn int_argmax(tensor: NdArrayTensor, dim: usize) -> NdArrayTensor

§

fn int_argmin(tensor: NdArrayTensor, dim: usize) -> NdArrayTensor

§

fn int_clamp_min(tensor: NdArrayTensor, min: I) -> NdArrayTensor

§

fn int_clamp_max(tensor: NdArrayTensor, max: I) -> NdArrayTensor

§

fn int_clamp(tensor: NdArrayTensor, min: I, max: I) -> NdArrayTensor

§

fn int_abs(tensor: NdArrayTensor) -> NdArrayTensor

§

fn int_into_float( tensor: NdArrayTensor, ) -> <NdArray<E, I, Q> as Backend>::FloatTensorPrimitive

§

fn int_swap_dims( tensor: NdArrayTensor, dim1: usize, dim2: usize, ) -> NdArrayTensor

§

fn int_random( shape: Shape, distribution: Distribution, device: &NdArrayDevice, ) -> NdArrayTensor

§

fn int_powi(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn int_powf( lhs: NdArrayTensor, rhs: <NdArray<E, I, Q> as Backend>::FloatTensorPrimitive, ) -> NdArrayTensor

§

fn int_powf_scalar_impl(lhs: NdArrayTensor, rhs: f32) -> NdArrayTensor

§

fn int_permute(tensor: NdArrayTensor, axes: &[usize]) -> NdArrayTensor

§

fn int_flip(tensor: NdArrayTensor, axes: &[usize]) -> NdArrayTensor

§

fn int_sign(tensor: NdArrayTensor) -> NdArrayTensor

§

fn int_expand(tensor: NdArrayTensor, shape: Shape) -> NdArrayTensor

§

fn bitwise_and(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn bitwise_and_scalar(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn bitwise_or(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn bitwise_or_scalar(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn bitwise_xor(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn bitwise_xor_scalar(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn bitwise_not(tensor: NdArrayTensor) -> NdArrayTensor

§

fn bitwise_left_shift(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn bitwise_left_shift_scalar(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn bitwise_right_shift(lhs: NdArrayTensor, rhs: NdArrayTensor) -> NdArrayTensor

§

fn bitwise_right_shift_scalar(lhs: NdArrayTensor, rhs: I) -> NdArrayTensor

§

fn int_cast( tensor: <NdArray<E, I, Q> as Backend>::IntTensorPrimitive, dtype: IntDType, ) -> <NdArray<E, I, Q> as Backend>::IntTensorPrimitive

§

fn int_unfold( tensor: <NdArray<E, I, Q> as Backend>::IntTensorPrimitive, dim: usize, size: usize, step: usize, ) -> <NdArray<E, I, Q> as Backend>::IntTensorPrimitive

Implementors§

§

impl<B, C> IntTensorOps<Autodiff<B, C>> for Autodiff<B, C>
where B: Backend, C: CheckpointStrategy,