Skip to main content

Flex

Struct Flex 

Source
pub struct Flex<E = f32, I = i32> { /* private fields */ }
Expand description

The Flex backend, a fast, portable CPU backend for Burn.

The E and I type parameters exist purely to match the shape of other Burn backends (e.g. NdArray<E, I, Q>) so Flex slots into burn-dispatch’s generic dispatch macros. The body of Flex uses runtime DType dispatch, so both parameters are phantom and unused at runtime.

§Limitations of the phantom generics

The Backend impl is provided only for the default instantiation Flex<f32, i32>. Writing Flex (with no arguments) resolves to the default and works exactly as before. Writing Flex<f64, i64> or any other non-default combination is a valid Rust type but will not satisfy trait bounds requiring Backend, producing errors like:

the trait bound `Flex<f64, i64>: Backend` is not satisfied

This is a deliberate compromise for the initial migration: making Flex generic over element types at the trait-impl level is a follow-up that would require rewriting all impl FooOps<Flex> for Flex blocks plus internal Flex::method() calls (tracked in #4762). Until then, treat the generic parameters as opaque shape placeholders; real element-type selection happens at runtime via DType.

The bound is locked in by a compile-fail doctest so that if someone later makes the Backend impl generic over E/I, this documentation gets flagged as out of date:

use burn_backend::Backend;
use burn_flex::Flex;
fn requires_backend<B: Backend>() {}
requires_backend::<Flex<f64, i64>>();

Trait Implementations§

Source§

impl ActivationOps<Flex> for Flex

Source§

fn relu(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Applies the ReLU activation function. Read more
Source§

fn relu_backward( output: FloatTensor<Flex>, grad: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Applies the ReLU activation function backward. Read more
Source§

fn leaky_relu( tensor: FloatTensor<Flex>, negative_slope: Scalar, ) -> FloatTensor<Flex>

Applies the LeakyReLU activation function. Read more
Source§

fn prelu( tensor: FloatTensor<Flex>, alpha: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Applies the PReLu activation function. Read more
Source§

fn gelu(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Applies the Gelu activation function. Read more
Source§

fn gelu_backward( x: FloatTensor<Flex>, grad: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Applies the Gelu activation function backward. Read more
Source§

fn sigmoid(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Applies the Sigmoid activation function. Read more
Source§

fn sigmoid_backward( output: FloatTensor<Flex>, grad: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Applies the Sigmoid activation function backward. Read more
Source§

fn hard_sigmoid( tensor: FloatTensor<Flex>, alpha: Scalar, beta: Scalar, ) -> FloatTensor<Flex>

Applies the hard Sigmoid activation function. Read more
Source§

fn log_sigmoid(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Applies the LogSigmoid activation function. Read more
Source§

fn log_sigmoid_backward( x: FloatTensor<Flex>, grad: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Applies the LogSigmoid activation function backward. Read more
Source§

fn softmax(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Applies the softmax function along the given dimension. Read more
Source§

fn log_softmax( tensor: <B as BackendTypes>::FloatTensorPrimitive, dim: usize, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies the log-softmax function along the given dimension. Read more
Source§

fn softmin( tensor: <B as BackendTypes>::FloatTensorPrimitive, dim: usize, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies the softmin function along the given dimension. Read more
Source§

impl Backend for Flex

Source§

fn name(_device: &Self::Device) -> String

Name of the backend.
Source§

fn seed(_device: &Self::Device, seed: u64)

Seeds the backend on the specified device. Read more
Source§

fn device_count(_type_id: u16) -> usize

Returns the number of devices available on this backend. device is a reference device used to determine the underlying backend that should be queried. A CUDA device will return all devices available to CUDA, a Vulkan device will return all devices available to Vulkan, etc.
Source§

fn dtype_usage(_device: &Self::Device, dtype: DType) -> DTypeUsageSet

Returns the DTypeUsageSet for the given DType on the specified device.
Source§

fn ad_enabled(_device: &Self::Device) -> bool

If autodiff is enabled.
Source§

fn memory_persistent_allocations<Output, Input, Func>( device: &Self::Device, input: Input, func: Func, ) -> Output
where Output: Send, Input: Send, Func: Fn(Input) -> Output + Send,

Sets the current allocation mode to persistent.
Source§

fn memory_cleanup(device: &Self::Device)

Manually triggers a memory cleanup on the given device.
Source§

fn sync(_device: &Self::Device) -> Result<(), ExecutionError>

Sync the backend, ensure that all computation are finished.
Source§

fn staging<'a, Iter>(_data: Iter, _device: &Self::Device)
where Iter: Iterator<Item = &'a mut TensorData>,

Marks the given data as being used as a staging buffer for transfer between CPU and accelerators like GPUs. Read more
Source§

fn supports_dtype(device: &Self::Device, dtype: DType) -> bool

Whether the type is fully supported by the specified device for general operations. Read more
Source§

impl BackendIr for Flex

Source§

type Handle = HandleKind<Flex>

The type that can be used to point to a tensor of any kind.
Source§

fn float_tensor(handle: TensorHandle<Self::Handle>) -> FlexTensor

Convert a handle to a float tensor.
Source§

fn int_tensor(handle: TensorHandle<Self::Handle>) -> FlexTensor

Convert a handle to an int tensor.
Source§

fn bool_tensor(handle: TensorHandle<Self::Handle>) -> FlexTensor

Convert a handle to a bool tensor.
Source§

fn quantized_tensor(handle: TensorHandle<Self::Handle>) -> FlexQTensor

Convert a handle to a quantized tensor.
Source§

fn float_tensor_handle(tensor: FlexTensor) -> Self::Handle

Convert a float tensor to a handle.
Source§

fn int_tensor_handle(tensor: FlexTensor) -> Self::Handle

Convert an int tensor to a handle.
Source§

fn bool_tensor_handle(tensor: FlexTensor) -> Self::Handle

Convert a bool tensor to a handle.
Source§

fn quantized_tensor_handle(tensor: FlexQTensor) -> Self::Handle

Convert a quantized tensor to a handle.
Source§

impl BackendTypes for Flex

Source§

type FloatElem = f32

Default float element type. Determines the dtype for .float() conversions and Tensor::from_data when no explicit dtype is provided. Prefer explicit dtypes via (&device, DType::F32).

Source§

type IntElem = i32

Default int element type. Determines the dtype for .int() conversions and Tensor::from_data when no explicit dtype is provided. Set to i32 to match burn’s ecosystem default (test suite, record settings, burn-remote). Prefer explicit dtypes via (&device, DType::I32).

Source§

type Device = FlexDevice

Device type.
Source§

type FloatTensorPrimitive = FlexTensor

Tensor primitive to be used for all float operations.
Source§

type IntTensorPrimitive = FlexTensor

Tensor primitive to be used for all int operations.
Source§

type BoolTensorPrimitive = FlexTensor

Tensor primitive to be used for all bool operations.
Source§

type BoolElem = bool

Tensor primitive to be used for all bool operations.
Source§

type QuantizedTensorPrimitive = FlexQTensor

Tensor primitive to be used for all quantized operations.
Source§

impl BoolTensorOps<Flex> for Flex

Source§

fn bool_from_data(data: TensorData, _device: &Device<Flex>) -> BoolTensor<Flex>

Creates a tensor from the data structure. Read more
Source§

async fn bool_into_data( tensor: BoolTensor<Flex>, ) -> Result<TensorData, ExecutionError>

Converts the tensor to a data structure. Read more
Source§

fn bool_device(_tensor: &BoolTensor<Flex>) -> Device<Flex>

Gets the device of the tensor. Read more
Source§

fn bool_to_device( tensor: BoolTensor<Flex>, _device: &Device<Flex>, ) -> BoolTensor<Flex>

Moves the tensor to the device.
Source§

fn bool_cat(tensors: Vec<BoolTensor<Flex>>, dim: usize) -> BoolTensor<Flex>

Concatenates the tensors along the given dimension. Read more
Source§

fn bool_reshape(tensor: BoolTensor<Flex>, shape: Shape) -> BoolTensor<Flex>

Reshapes the tensor. Read more
Source§

fn bool_slice(tensor: BoolTensor<Flex>, slices: &[Slice]) -> BoolTensor<Flex>

Gets the values from the tensor for the given ranges. Read more
Source§

fn bool_empty( shape: Shape, _device: &Device<Flex>, dtype: BoolDType, ) -> BoolTensor<Flex>

Creates a new bool tensor. Read more
Source§

fn bool_slice_assign( tensor: BoolTensor<Flex>, slices: &[Slice], value: BoolTensor<Flex>, ) -> BoolTensor<Flex>

Sets the values in the tensor for the given ranges. Read more
Source§

fn bool_into_int( tensor: BoolTensor<Flex>, out_dtype: IntDType, ) -> IntTensor<Flex>

Converts bool tensor to int tensor. Read more
Source§

fn bool_into_float( tensor: BoolTensor<Flex>, out_dtype: FloatDType, ) -> FloatTensor<Flex>

Converts bool tensor to float tensor. Read more
Source§

fn bool_swap_dims( tensor: BoolTensor<Flex>, dim1: usize, dim2: usize, ) -> BoolTensor<Flex>

Swaps two dimensions of a bool tensor. Read more
Source§

fn bool_permute(tensor: BoolTensor<Flex>, axes: &[usize]) -> BoolTensor<Flex>

Permutes the dimensions of a tensor. Read more
Source§

fn bool_flip(tensor: BoolTensor<Flex>, axes: &[usize]) -> BoolTensor<Flex>

Reverse the order of elements in a tensor along the given axes. Read more
Source§

fn bool_equal(lhs: BoolTensor<Flex>, rhs: BoolTensor<Flex>) -> BoolTensor<Flex>

Equates the two tensors. Read more
Source§

fn bool_not(tensor: BoolTensor<Flex>) -> BoolTensor<Flex>

Inverses boolean values. Read more
Source§

fn bool_and(lhs: BoolTensor<Flex>, rhs: BoolTensor<Flex>) -> BoolTensor<Flex>

Executes the logical and (&&) operation on two boolean tensors. Read more
Source§

fn bool_or(lhs: BoolTensor<Flex>, rhs: BoolTensor<Flex>) -> BoolTensor<Flex>

Executes the logical or (||) operation on two boolean tensors. Read more
Source§

fn bool_xor(lhs: BoolTensor<Flex>, rhs: BoolTensor<Flex>) -> BoolTensor<Flex>

Element-wise exclusive or. Read more
Source§

fn bool_expand(tensor: BoolTensor<Flex>, shape: Shape) -> BoolTensor<Flex>

Broadcasts the bool tensor to the given shape.
Source§

fn bool_zeros( shape: Shape, device: &Device<Flex>, dtype: BoolDType, ) -> BoolTensor<Flex>

Creates a new bool tensor filled false. Read more
Source§

fn bool_ones( shape: Shape, _device: &Device<Flex>, dtype: BoolDType, ) -> BoolTensor<Flex>

Creates a new bool tensor filled true. Read more
Source§

fn bool_mask_where( tensor: BoolTensor<Flex>, mask: BoolTensor<Flex>, value: BoolTensor<Flex>, ) -> BoolTensor<Flex>

Fills the tensor with values from the value tensor if the mask is true at the given indices. Read more
Source§

fn bool_mask_fill( tensor: BoolTensor<Flex>, mask: BoolTensor<Flex>, value: Scalar, ) -> BoolTensor<Flex>

Fills the tensor with the given value if the mask is true at the given indices. Read more
Source§

fn bool_gather( dim: usize, tensor: BoolTensor<Flex>, indices: IntTensor<Flex>, ) -> BoolTensor<Flex>

Gather elements from the tensor at the given indices. Read more
Source§

fn bool_scatter_or( dim: usize, tensor: BoolTensor<Flex>, indices: IntTensor<Flex>, value: BoolTensor<Flex>, ) -> BoolTensor<Flex>

Scatter a given value to the tensor at the given indices using boolean or reduction. Read more
Source§

fn bool_equal_elem(lhs: BoolTensor<Flex>, rhs: Scalar) -> BoolTensor<Flex>

Element-wise equality comparison with a scalar. Read more
Source§

fn bool_unfold( tensor: BoolTensor<Flex>, dim: usize, size: usize, step: usize, ) -> BoolTensor<Flex>

Unfold windows along a dimension. Read more
Source§

fn bool_not_equal( lhs: BoolTensor<Flex>, rhs: BoolTensor<Flex>, ) -> BoolTensor<Flex>

Element-wise non-equality comparison. Read more
Source§

fn bool_not_equal_elem(lhs: BoolTensor<Flex>, rhs: Scalar) -> BoolTensor<Flex>

Element-wise non-equality comparison with a scalar. Read more
Source§

fn bool_any(tensor: BoolTensor<Flex>) -> BoolTensor<Flex>

Tests if any element in the boolean tensor evaluates to True. Read more
Source§

fn bool_any_dim(tensor: BoolTensor<Flex>, dim: usize) -> BoolTensor<Flex>

Tests if any element in the boolean tensor evaluates to True along a given dimension dim. Read more
Source§

fn bool_all(tensor: BoolTensor<Flex>) -> BoolTensor<Flex>

Tests if all elements in the boolean tensor evaluate to True. Read more
Source§

fn bool_all_dim(tensor: BoolTensor<Flex>, dim: usize) -> BoolTensor<Flex>

Tests if all elements in the boolean tensor evaluate to True along a given dimension dim. Read more
Source§

fn bool_select( tensor: BoolTensor<Flex>, dim: usize, indices: IntTensor<Flex>, ) -> BoolTensor<Flex>

Select tensor elements along the given dimension corresponding to the given indices. Read more
Source§

fn bool_select_or( tensor: BoolTensor<Flex>, dim: usize, indices: IntTensor<Flex>, value: BoolTensor<Flex>, ) -> BoolTensor<Flex>

Assign the selected elements along the given dimension corresponding to the given indices to the given value using sum reduction. Read more
Source§

fn bool_transpose(tensor: BoolTensor<Flex>) -> BoolTensor<Flex>

Transposes a bool tensor. Read more
Source§

fn bool_repeat_dim( tensor: BoolTensor<Flex>, dim: usize, times: usize, ) -> BoolTensor<Flex>

Repeats one dimension of the tensor a given number of times along that dimension. Read more
Source§

async fn bool_argwhere( tensor: BoolTensor<Flex>, out_dtype: IntDType, ) -> IntTensor<Flex>

Compute the indices of the elements that are non-zero, grouped by element. Read more
Source§

impl<E: Clone, I: Clone> Clone for Flex<E, I>

Source§

fn clone(&self) -> Flex<E, I>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug, I: Debug> Debug for Flex<E, I>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: Default, I: Default> Default for Flex<E, I>

Source§

fn default() -> Flex<E, I>

Returns the “default value” for a type. Read more
Source§

impl FloatTensorOps<Flex> for Flex

Source§

fn float_from_data( data: TensorData, _device: &Device<Flex>, ) -> FloatTensor<Flex>

Creates a new tensor from the data structure. Read more
Source§

fn float_random( shape: Shape, distribution: Distribution, _device: &Device<Flex>, dtype: FloatDType, ) -> FloatTensor<Flex>

Creates a new tensor with random values. Read more
Source§

async fn float_into_data( tensor: FloatTensor<Flex>, ) -> Result<TensorData, ExecutionError>

Converts the tensor to a data structure. Read more
Source§

fn float_device(_tensor: &FloatTensor<Flex>) -> Device<Flex>

Gets the device of the tensor. Read more
Source§

fn float_to_device( tensor: FloatTensor<Flex>, _device: &Device<Flex>, ) -> FloatTensor<Flex>

Moves the tensor to the given device. Read more
Source§

fn float_detach(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Detaches a tensor from the computation graph.
Source§

fn float_into_int( tensor: FloatTensor<Flex>, out_dtype: IntDType, ) -> IntTensor<Flex>

Converts float tensor to int tensor. Read more
Source§

fn float_empty( shape: Shape, _device: &Device<Flex>, dtype: FloatDType, ) -> FloatTensor<Flex>

Creates an empty tensor with the given shape. Read more
Source§

fn float_add( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Adds two tensors together. Read more
Source§

fn float_add_scalar(lhs: FloatTensor<Flex>, rhs: Scalar) -> FloatTensor<Flex>

Adds a scalar to a tensor. Read more
Source§

fn float_sub( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Subtracts two tensors. Read more
Source§

fn float_sub_scalar(lhs: FloatTensor<Flex>, rhs: Scalar) -> FloatTensor<Flex>

Subtracts a scalar from a tensor. Read more
Source§

fn float_mul( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Multiplies two tensors together element-wise.
Source§

fn float_mul_scalar(lhs: FloatTensor<Flex>, rhs: Scalar) -> FloatTensor<Flex>

Multiplies a tensor by a scalar. Read more
Source§

fn float_div( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Divides two tensors element-wise. Read more
Source§

fn float_div_scalar(lhs: FloatTensor<Flex>, rhs: Scalar) -> FloatTensor<Flex>

Divides a tensor by a scalar. Read more
Source§

fn float_remainder( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Computes the remainder of division between two tensors element-wise. Read more
Source§

fn float_remainder_scalar( lhs: FloatTensor<Flex>, rhs: Scalar, ) -> FloatTensor<Flex>

Computes the modulus of a tensor given a scalar. Read more
Source§

fn float_matmul( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Multiplies two tensors together using matrix multiplication. Read more
Source§

fn float_cross( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, dim: usize, ) -> FloatTensor<Flex>

Computes the cross product of two tensors along a given dimension. Read more
Source§

fn float_recip(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Calculates the reciprocals element-wise
Source§

fn float_swap_dims( tensor: FloatTensor<Flex>, dim1: usize, dim2: usize, ) -> FloatTensor<Flex>

Swaps two dimensions of a tensor. Read more
Source§

fn float_permute(tensor: FloatTensor<Flex>, axes: &[usize]) -> FloatTensor<Flex>

Permutes the dimensions of a tensor. Read more
Source§

fn float_flip(tensor: FloatTensor<Flex>, axes: &[usize]) -> FloatTensor<Flex>

Reverse the order of elements in a tensor along the given axes. Read more
Source§

fn float_cat(tensors: Vec<FloatTensor<Flex>>, dim: usize) -> FloatTensor<Flex>

Concatenates tensors along a dimension. Read more
Source§

fn float_reshape(tensor: FloatTensor<Flex>, shape: Shape) -> FloatTensor<Flex>

Reshapes a tensor. Read more
Source§

fn float_gather( dim: usize, tensor: FloatTensor<Flex>, indices: IntTensor<Flex>, ) -> FloatTensor<Flex>

Gather elements from a tensor. Read more
Source§

fn float_scatter_add( dim: usize, tensor: FloatTensor<Flex>, indices: IntTensor<Flex>, value: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Scatter elements into a tensor using sum reduction. Read more
Source§

fn float_scatter_nd( data: FloatTensor<Flex>, indices: IntTensor<Flex>, values: FloatTensor<Flex>, reduction: IndexingUpdateOp, ) -> FloatTensor<Flex>

Multi-dimensional scatter: update data at locations specified by indices with values. Read more
Source§

fn float_gather_nd( data: FloatTensor<Flex>, indices: IntTensor<Flex>, ) -> FloatTensor<Flex>

Multi-dimensional gather: collect slices from data at locations specified by indices. Read more
Source§

fn float_select( tensor: FloatTensor<Flex>, dim: usize, indices: IntTensor<Flex>, ) -> FloatTensor<Flex>

Select tensor elements along the given dimension corresponding for the given indices. Read more
Source§

fn float_select_add( tensor: FloatTensor<Flex>, dim: usize, indices: IntTensor<Flex>, value: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Assign the selected elements along the given dimension corresponding for the given indices to the given value using sum reduction. Read more
Source§

fn float_slice(tensor: FloatTensor<Flex>, slices: &[Slice]) -> FloatTensor<Flex>

Select tensor elements corresponding to the given slices. Read more
Source§

fn float_slice_assign( tensor: FloatTensor<Flex>, slices: &[Slice], value: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Assign the selected elements corresponding to the given slices to the given value. Read more
Source§

fn float_mask_where( tensor: FloatTensor<Flex>, mask: BoolTensor<Flex>, value: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Update the given tensor with the value tensor where the mask is true. Read more
Source§

fn float_mask_fill( tensor: FloatTensor<Flex>, mask: BoolTensor<Flex>, value: Scalar, ) -> FloatTensor<Flex>

Update the given tensor with the value where the mask is true. Read more
Source§

fn float_equal( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Equal comparison of two tensors. Read more
Source§

fn float_equal_elem( lhs: FloatTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Equal comparison of a tensor and a scalar. Read more
Source§

fn float_greater( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Greater than comparison of two tensors. Read more
Source§

fn float_greater_elem( lhs: FloatTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Greater than comparison of a tensor and a scalar. Read more
Source§

fn float_greater_equal( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Greater than or equal comparison of two tensors. Read more
Source§

fn float_greater_equal_elem( lhs: FloatTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Greater than or equal comparison of a tensor and a scalar. Read more
Source§

fn float_lower( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Less than comparison of two tensors. Read more
Source§

fn float_lower_elem( lhs: FloatTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Less than comparison of a tensor and a scalar. Read more
Source§

fn float_lower_equal( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Less than or equal comparison of two tensors. Read more
Source§

fn float_lower_equal_elem( lhs: FloatTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Less than or equal comparison of a tensor and a scalar. Read more
Source§

fn float_not_equal( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise non-equality comparison. Read more
Source§

fn float_not_equal_elem( lhs: FloatTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise non-equality comparison with a scalar. Read more
Source§

fn float_neg(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Negates a tensor element-wise.
Source§

fn float_clamp( tensor: FloatTensor<Flex>, min: Scalar, max: Scalar, ) -> FloatTensor<Flex>

Clamps a tensor between a minimum and maximum value. Read more
Source§

fn float_clamp_min(tensor: FloatTensor<Flex>, min: Scalar) -> FloatTensor<Flex>

Clamps a tensor under a minimum value. Read more
Source§

fn float_clamp_max(tensor: FloatTensor<Flex>, max: Scalar) -> FloatTensor<Flex>

Clamps a tensor over a maximum value. Read more
Source§

fn float_sign(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns the signs of the float tensor. Read more
Source§

fn float_mean(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Mean of all elements in a tensor. Read more
Source§

fn float_max(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Gets the maximum element of a tensor. Read more
Source§

fn float_max_dim(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Gets the maximum elements of a tensor along an axis. Read more
Source§

fn float_min(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Gets the minimum element of a tensor. Read more
Source§

fn float_min_dim(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Gets the minimum elements of a tensor along an axis. Read more
Source§

fn float_max_dim_with_indices( tensor: FloatTensor<Flex>, dim: usize, indices_dtype: IntDType, ) -> (FloatTensor<Flex>, IntTensor<Flex>)

Gets the maximum elements of a tensor along an axis and their indices. Read more
Source§

fn float_min_dim_with_indices( tensor: FloatTensor<Flex>, dim: usize, indices_dtype: IntDType, ) -> (FloatTensor<Flex>, IntTensor<Flex>)

Gets the minimum elements of a tensor along an axis and their indices. Read more
Source§

fn float_any( tensor: FloatTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Tests if any element in the float tensor evaluates to True. Read more
Source§

fn float_any_dim( tensor: FloatTensor<Flex>, dim: usize, out_dtype: BoolDType, ) -> BoolTensor<Flex>

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

fn float_all( tensor: FloatTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Tests if all elements in the float tensor evaluate to True. Read more
Source§

fn float_all_dim( tensor: FloatTensor<Flex>, dim: usize, out_dtype: BoolDType, ) -> BoolTensor<Flex>

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

fn float_sum(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Sum of all elements in a tensor. Read more
Source§

fn float_sum_dim(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Sum of all elements in a tensor along a dimension. Read more
Source§

fn float_mean_dim(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Mean of all elements in a tensor along a dimension. Read more
Source§

fn float_prod(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Product of all elements in a tensor. Read more
Source§

fn float_prod_dim(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Product of all elements in a tensor along a dimension. Read more
Source§

fn float_cumsum(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Computes the cumulative sum of elements along a dimension. Read more
Source§

fn float_cumprod(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Computes the cumulative product of elements along a dimension. Read more
Source§

fn float_cummin(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Computes the cumulative minimum of elements along a dimension. Read more
Source§

fn float_cummax(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Computes the cumulative maximum of elements along a dimension. Read more
Source§

fn float_cast(tensor: FloatTensor<Flex>, dtype: FloatDType) -> FloatTensor<Flex>

Converts a tensor to another floating point data type. Read more
Source§

fn float_exp(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with exponential values. Read more
Source§

fn float_log(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with natural logarithm values. Read more
Source§

fn float_log1p(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with logarithm values of (1 + Xi). Read more
Source§

fn float_powf( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Element-wise power with a FloatTensor. Read more
Source§

fn float_powf_scalar_impl( tensor: FloatTensor<Flex>, value: Scalar, ) -> FloatTensor<Flex>

Returns a new tensor with values raised to the power of float value. Read more
Source§

fn float_sqrt(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with square root values. Read more
Source§

fn float_abs(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with absolute values. Read more
Source§

fn float_cos(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with cosine values. Read more
Source§

fn float_sin(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with sine values. Read more
Source§

fn float_tan(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with tangent values. Read more
Source§

fn float_cosh(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with hyperbolic cosine values. Read more
Source§

fn float_sinh(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with hyperbolic sine values. Read more
Source§

fn float_tanh(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with hyperbolic tangent values. Read more
Source§

fn float_acos(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with inverse cosine values. Read more
Source§

fn float_acosh(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with inverse hyperbolic cosine values. Read more
Source§

fn float_asin(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with inverse sine values. Read more
Source§

fn float_asinh(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with inverse hyperbolic sine values. Read more
Source§

fn float_atan(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with the inverse tangent values. Read more
Source§

fn float_atanh(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with the inverse hyperbolic tangent values. Read more
Source§

fn float_atan2( lhs: FloatTensor<Flex>, rhs: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Returns a tensor with the four-quadrant inverse tangent values of y and x. Read more
Source§

fn float_round(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with rounded values. Read more
Source§

fn float_floor(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with floored values. Read more
Source§

fn float_ceil(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with ceiled values. Read more
Source§

fn float_trunc(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with truncated values. Read more
Source§

fn float_erf(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Returns a new tensor with the error function values. Read more
Source§

fn float_argmax( tensor: FloatTensor<Flex>, dim: usize, out_dtype: IntDType, ) -> IntTensor<Flex>

Gets the indices of the maximum elements of a tensor along an axis. Read more
Source§

fn float_argtopk( _tensor: FloatTensor<Flex>, _dim: usize, _k: usize, _out_dtype: IntDType, ) -> IntTensor<Flex>

Gets the indices of the k maximum elements of a tensor along an axis. if two elements are equals, it will be ordered by lowest indices Read more
Source§

fn float_argmin( tensor: FloatTensor<Flex>, dim: usize, out_dtype: IntDType, ) -> IntTensor<Flex>

Gets the indices of the minimum elements of a tensor along an axis. Read more
Source§

fn float_expand(tensor: FloatTensor<Flex>, shape: Shape) -> FloatTensor<Flex>

Broadcasts the float tensor to the given shape.
Source§

fn float_unfold( tensor: FloatTensor<Flex>, dim: usize, size: usize, step: usize, ) -> FloatTensor<Flex>

Unfold windows along a dimension. Read more
Source§

fn float_grid_sample_2d( tensor: FloatTensor<Flex>, grid: FloatTensor<Flex>, options: GridSampleOptions, ) -> FloatTensor<Flex>

Samples tensor as a two-dimensional spatial grid of (possibly multi-channel) values, using the given locations in [-1, 1]. Read more
Source§

fn float_zeros( shape: Shape, _device: &Device<Flex>, dtype: FloatDType, ) -> FloatTensor<Flex>

Creates a new tensor with zeros. Read more
Source§

fn float_ones( shape: Shape, _device: &Device<Flex>, dtype: FloatDType, ) -> FloatTensor<Flex>

Creates a new tensor with ones. Read more
Source§

fn float_full( shape: Shape, fill_value: Scalar, _device: &Device<Flex>, dtype: FloatDType, ) -> FloatTensor<Flex>

Creates a tensor filled with given value. Read more
Source§

fn float_transpose(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Transposes a tensor. Read more
Source§

fn float_repeat_dim( tensor: FloatTensor<Flex>, dim: usize, times: usize, ) -> FloatTensor<Flex>

Repeat the tensor along the given dimension. Read more
Source§

fn float_sort( tensor: FloatTensor<Flex>, dim: usize, descending: bool, ) -> FloatTensor<Flex>

Sort the elements of the input tensor by value in along a given dimension. Read more
Source§

fn float_sort_with_indices( tensor: FloatTensor<Flex>, dim: usize, descending: bool, indices_dtype: IntDType, ) -> (FloatTensor<Flex>, IntTensor<Flex>)

Sort the elements of the input tensor by value in along a given dimension. Read more
Source§

fn float_argsort( tensor: FloatTensor<Flex>, dim: usize, descending: bool, out_dtype: IntDType, ) -> IntTensor<Flex>

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

fn float_powi(lhs: FloatTensor<Flex>, rhs: IntTensor<Flex>) -> FloatTensor<Flex>

Element-wise power with an IntTensor. Read more
Source§

fn float_powi_scalar(lhs: FloatTensor<Flex>, rhs: Scalar) -> FloatTensor<Flex>

Raises a tensor to the power of an int scalar. Read more
Source§

fn float_powf_scalar( tensor: FloatTensor<Flex>, value: Scalar, ) -> FloatTensor<Flex>

Returns a new tensor with values raised to the power of float value. Read more
Source§

fn float_max_abs(tensor: FloatTensor<Flex>) -> FloatTensor<Flex>

Gets the maximum absolute element of a tensor. Read more
Source§

fn float_max_abs_dim(tensor: FloatTensor<Flex>, dim: usize) -> FloatTensor<Flex>

Gets the maximum absolute elements of a tensor along an axis. Read more
Source§

fn float_is_nan( tensor: FloatTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Returns a new tensor with boolean elements indicating whether each element of the input is NaN. Read more
Source§

fn float_is_inf( tensor: FloatTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Returns a new tensor with boolean elements indicating whether each element of the input is infinite (either +INF or -INF). Read more
Source§

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

Sets the require_grad flag of a tensor.
Source§

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

Returns the require_grad flag of a tensor.
Source§

fn float_powi_scalar_impl( lhs: <B as BackendTypes>::FloatTensorPrimitive, rhs: Scalar, ) -> <B as BackendTypes>::FloatTensorPrimitive

Raises a tensor to the power of an int scalar. Read more
Source§

fn float_topk( tensor: <B as BackendTypes>::FloatTensorPrimitive, dim: usize, k: usize, ) -> <B as BackendTypes>::FloatTensorPrimitive

Gets the values of the k maximum elements of a tensor along an axis. Read more
Source§

impl IntTensorOps<Flex> for Flex

Source§

fn int_gather( dim: usize, tensor: IntTensor<Flex>, indices: IntTensor<Flex>, ) -> IntTensor<Flex>

Gather ints along dim at the given indices.

The tensor dispatches on its own int dtype (I8/I16/I32/I64 signed or U8/U16/U32/U64 unsigned). The indices tensor may be any of those widths too - it’s normalised to isize by the shared read_indices helper in ops::gather_scatter before the kernel runs, so callers are not required to pre-convert to I64.

Source§

fn int_scatter_add( dim: usize, tensor: IntTensor<Flex>, indices: IntTensor<Flex>, value: IntTensor<Flex>, ) -> IntTensor<Flex>

Scatter-add int values at the given indices along dim.

tensor and value must share the same int dtype; indices may be any supported int width. See int_gather for the full index-width policy.

Source§

fn int_select( tensor: IntTensor<Flex>, dim: usize, indices: IntTensor<Flex>, ) -> IntTensor<Flex>

Select ints along dim by a 1D index tensor.

The indices tensor may be any supported int width. See int_gather for the full index-width policy.

Source§

fn int_select_add( tensor: IntTensor<Flex>, dim: usize, indices: IntTensor<Flex>, value: IntTensor<Flex>, ) -> IntTensor<Flex>

Select-add int values at a 1D index tensor along dim.

tensor and value must share the same int dtype; indices may be any supported int width. See int_gather for the full index-width policy.

Source§

fn int_from_data(data: TensorData, _device: &Device<Flex>) -> IntTensor<Flex>

Creates a tensor from the data structure. Read more
Source§

async fn int_into_data( tensor: IntTensor<Flex>, ) -> Result<TensorData, ExecutionError>

Converts the tensor to a data structure. Read more
Source§

fn int_device(_tensor: &IntTensor<Flex>) -> Device<Flex>

Gets the device of the tensor. Read more
Source§

fn int_to_device( tensor: IntTensor<Flex>, _device: &Device<Flex>, ) -> IntTensor<Flex>

Moves the tensor to the given device.
Source§

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

Concatenates the given tensors along the given dimension. Read more
Source§

fn int_reshape(tensor: IntTensor<Flex>, shape: Shape) -> IntTensor<Flex>

Reshapes the tensor. Read more
Source§

fn int_slice(tensor: IntTensor<Flex>, slices: &[Slice]) -> IntTensor<Flex>

Gets the element at the given indices. Read more
Source§

fn int_empty( shape: Shape, _device: &Device<Flex>, dtype: IntDType, ) -> IntTensor<Flex>

Creates a new int tensor. Read more
Source§

fn int_mask_where( tensor: IntTensor<Flex>, mask: BoolTensor<Flex>, value: IntTensor<Flex>, ) -> IntTensor<Flex>

Fills the tensor with values from the value tensor if the mask is true at the given indices. Read more
Source§

fn int_mask_fill( tensor: IntTensor<Flex>, mask: BoolTensor<Flex>, value: Scalar, ) -> IntTensor<Flex>

Fills the tensor with the given value if the mask is true at the given indices. Read more
Source§

fn int_slice_assign( tensor: IntTensor<Flex>, slices: &[Slice], value: IntTensor<Flex>, ) -> IntTensor<Flex>

Sets the values in the tensor for the given ranges. Read more
Source§

fn int_scatter_nd( data: IntTensor<Flex>, indices: IntTensor<Flex>, values: IntTensor<Flex>, reduction: IndexingUpdateOp, ) -> IntTensor<Flex>

Multi-dimensional scatter for int tensors.
Source§

fn int_gather_nd( data: IntTensor<Flex>, indices: IntTensor<Flex>, ) -> IntTensor<Flex>

Multi-dimensional gather for int tensors.
Source§

fn int_equal( lhs: IntTensor<Flex>, rhs: IntTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise equality comparison. Read more
Source§

fn int_equal_elem( lhs: IntTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise equality comparison with a scalar. Read more
Source§

fn int_greater( lhs: IntTensor<Flex>, rhs: IntTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise greater than comparison. Read more
Source§

fn int_greater_elem( lhs: IntTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise greater than comparison with a scalar. Read more
Source§

fn int_greater_equal( lhs: IntTensor<Flex>, rhs: IntTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise greater than or equal comparison. Read more
Source§

fn int_greater_equal_elem( lhs: IntTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise greater than or equal comparison with a scalar. Read more
Source§

fn int_lower( lhs: IntTensor<Flex>, rhs: IntTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise less than comparison. Read more
Source§

fn int_lower_elem( lhs: IntTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise less than comparison with a scalar. Read more
Source§

fn int_lower_equal( lhs: IntTensor<Flex>, rhs: IntTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise less than or equal comparison. Read more
Source§

fn int_lower_equal_elem( lhs: IntTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise less than or equal comparison with a scalar. Read more
Source§

fn int_add(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex>

Element-wise addition. Read more
Source§

fn int_add_scalar(lhs: IntTensor<Flex>, rhs: Scalar) -> IntTensor<Flex>

Element-wise addition with a scalar. Read more
Source§

fn int_sub(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex>

Element-wise subtraction. Read more
Source§

fn int_sub_scalar(lhs: IntTensor<Flex>, rhs: Scalar) -> IntTensor<Flex>

Element-wise subtraction with a scalar. Read more
Source§

fn int_mul(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex>

Element-wise multiplication. Read more
Source§

fn int_mul_scalar(lhs: IntTensor<Flex>, rhs: Scalar) -> IntTensor<Flex>

Element-wise multiplication with a scalar. Read more
Source§

fn int_div(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex>

Element-wise division. Read more
Source§

fn int_div_scalar(lhs: IntTensor<Flex>, rhs: Scalar) -> IntTensor<Flex>

Element-wise division with a scalar. Read more
Source§

fn int_remainder(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex>

Element-wise modulus. Read more
Source§

fn int_remainder_scalar(lhs: IntTensor<Flex>, rhs: Scalar) -> IntTensor<Flex>

Element-wise modulus with a scalar. Read more
Source§

fn int_into_float( tensor: IntTensor<Flex>, out_dtype: FloatDType, ) -> FloatTensor<Flex>

Converts int tensor to float tensor. Read more
Source§

fn int_swap_dims( tensor: IntTensor<Flex>, dim1: usize, dim2: usize, ) -> IntTensor<Flex>

Swaps two dimensions of an int tensor. Read more
Source§

fn int_permute(tensor: IntTensor<Flex>, axes: &[usize]) -> IntTensor<Flex>

Permutes the dimensions of a tensor. Read more
Source§

fn int_flip(tensor: IntTensor<Flex>, axes: &[usize]) -> IntTensor<Flex>

Reverse the order of elements in a tensor along the given axes. Read more
Source§

fn int_random( shape: Shape, distribution: Distribution, _device: &Device<Flex>, dtype: IntDType, ) -> IntTensor<Flex>

Creates a new int tensor with random values. Read more
Source§

fn int_expand(tensor: IntTensor<Flex>, shape: Shape) -> IntTensor<Flex>

Broadcasts the int tensor to the given shape.
Source§

fn int_matmul(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex>

Multiplies two tensors together using matrix multiplication. Read more
Source§

fn int_sum(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Sums all elements in the tensor. Read more
Source§

fn int_sum_dim(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Sums all elements in the tensor along a dimension. Read more
Source§

fn int_prod(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Computes the product of all elements in the tensor. Read more
Source§

fn int_prod_dim(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Computes the product of all elements in the tensor along a dimension. Read more
Source§

fn int_mean_dim(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Computes the mean of all elements in the tensor along a dimension. Read more
Source§

fn int_cumsum(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Computes the cumulative sum of elements along a dimension. Read more
Source§

fn int_cumprod(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Computes the cumulative product of elements along a dimension. Read more
Source§

fn int_cummin(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Computes the cumulative minimum of elements along a dimension. Read more
Source§

fn int_cummax(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Computes the cumulative maximum of elements along a dimension. Read more
Source§

fn int_argmax(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Gets the indices of the maximum elements along a dimension. Read more
Source§

fn int_argtopk( _tensor: IntTensor<Flex>, _dim: usize, _k: usize, ) -> IntTensor<Flex>

Gets the indices of the k maximum elements along a dimension. If two elements share the same value, it will be ordered by the lowest coordinate Read more
Source§

fn int_argmin(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Gets the indices of the minimum elements along a dimension. Read more
Source§

fn int_abs(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Returns a new tensor with absolute values. Read more
Source§

fn bitwise_and(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex>

Bitwise AND operation for Int Tensors
Source§

fn bitwise_and_scalar(lhs: IntTensor<Flex>, rhs: Scalar) -> IntTensor<Flex>

Bitwise AND operation for Int Tensors with a scalar
Source§

fn bitwise_or(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex>

Bitwise OR operation for Int Tensors
Source§

fn bitwise_or_scalar(lhs: IntTensor<Flex>, rhs: Scalar) -> IntTensor<Flex>

Bitwise OR operation for Int Tensors with a scalar
Source§

fn bitwise_xor(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex>

Bitwise XOR operation for Int Tensors
Source§

fn bitwise_xor_scalar(lhs: IntTensor<Flex>, rhs: Scalar) -> IntTensor<Flex>

Bitwise XOR operation for Int Tensors with a scalar
Source§

fn bitwise_not(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Bitwise NOT operation for Int Tensors
Source§

fn bitwise_left_shift( lhs: IntTensor<Flex>, rhs: IntTensor<Flex>, ) -> IntTensor<Flex>

Bitwise left shift operation for Int Tensors
Source§

fn bitwise_left_shift_scalar( lhs: IntTensor<Flex>, rhs: Scalar, ) -> IntTensor<Flex>

Bitwise left shift operation for Int Tensors with a scalar
Source§

fn bitwise_right_shift( lhs: IntTensor<Flex>, rhs: IntTensor<Flex>, ) -> IntTensor<Flex>

Bitwise right shift operation for Int Tensors
Source§

fn bitwise_right_shift_scalar( lhs: IntTensor<Flex>, rhs: Scalar, ) -> IntTensor<Flex>

Bitwise right shift operation for Int Tensors with a scalar
Source§

fn int_cast(tensor: IntTensor<Flex>, dtype: IntDType) -> IntTensor<Flex>

Converts a tensor to another integer data type. Read more
Source§

fn int_unfold( tensor: IntTensor<Flex>, dim: usize, size: usize, step: usize, ) -> IntTensor<Flex>

Unfold windows along a dimension. Read more
Source§

fn int_neg(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Element-wise negation. Read more
Source§

fn int_clamp( tensor: IntTensor<Flex>, min: Scalar, max: Scalar, ) -> IntTensor<Flex>

Clamps a tensor between a minimum and maximum value. Read more
Source§

fn int_clamp_min(tensor: IntTensor<Flex>, min: Scalar) -> IntTensor<Flex>

Clamps a tensor under a minimum value. Read more
Source§

fn int_clamp_max(tensor: IntTensor<Flex>, max: Scalar) -> IntTensor<Flex>

Clamps a tensor over a maximum value. Read more
Source§

fn int_sign(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Returns the signs of the int tensor. Read more
Source§

fn int_mean(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Computes the mean of all elements in the tensor. Read more
Source§

fn int_max(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Gets the maximum element in the tensor. Read more
Source§

fn int_max_dim(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Gets the maximum element in the tensor along a dimension. Read more
Source§

fn int_min(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Gets the minimum element in the tensor. Read more
Source§

fn int_min_dim(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Gets the minimum elements in the tensor along a dimension. Read more
Source§

fn int_max_dim_with_indices( tensor: IntTensor<Flex>, dim: usize, ) -> (IntTensor<Flex>, IntTensor<Flex>)

Gets the maximum elements and corresponding indices along a dimension. Read more
Source§

fn int_min_dim_with_indices( tensor: IntTensor<Flex>, dim: usize, ) -> (IntTensor<Flex>, IntTensor<Flex>)

Gets the minimum elements and corresponding indices along a dimension. Read more
Source§

fn int_any(tensor: IntTensor<Flex>, out_dtype: BoolDType) -> BoolTensor<Flex>

Tests if any element in the int tensor evaluates to True. Read more
Source§

fn int_any_dim( tensor: IntTensor<Flex>, dim: usize, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Tests if any element in the int tensor evaluates to True along a given dimension dim. Read more
Source§

fn int_all(tensor: IntTensor<Flex>, out_dtype: BoolDType) -> BoolTensor<Flex>

Tests if all elements in the int tensor evaluate to True. Read more
Source§

fn int_all_dim( tensor: IntTensor<Flex>, dim: usize, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Tests if all elements in the int tensor evaluate to True along a given dimension dim. Read more
Source§

fn int_powi(lhs: IntTensor<Flex>, rhs: IntTensor<Flex>) -> IntTensor<Flex>

Element-wise power with a IntTensor. Read more
Source§

fn int_zeros( shape: Shape, _device: &Device<Flex>, dtype: IntDType, ) -> IntTensor<Flex>

Creates a tensor of zeros. Read more
Source§

fn int_ones( shape: Shape, _device: &Device<Flex>, dtype: IntDType, ) -> IntTensor<Flex>

Creates a tensor of ones. Read more
Source§

fn int_full( shape: Shape, fill_value: Scalar, _device: &Device<Flex>, dtype: IntDType, ) -> IntTensor<Flex>

Creates a tensor filled with given value. Read more
Source§

fn int_transpose(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Transposes an int tensor. Read more
Source§

fn int_repeat_dim( tensor: IntTensor<Flex>, dim: usize, times: usize, ) -> IntTensor<Flex>

Repeats the tensor along the given dimension the given number of times. Read more
Source§

fn int_not_equal( lhs: IntTensor<Flex>, rhs: IntTensor<Flex>, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise non-equality comparison. Read more
Source§

fn int_not_equal_elem( lhs: IntTensor<Flex>, rhs: Scalar, out_dtype: BoolDType, ) -> BoolTensor<Flex>

Element-wise non-equality comparison with a scalar. Read more
Source§

fn int_sort( tensor: IntTensor<Flex>, dim: usize, descending: bool, ) -> IntTensor<Flex>

Sort the elements of the input tensor by value along a given dimension. Read more
Source§

fn int_sort_with_indices( tensor: IntTensor<Flex>, dim: usize, descending: bool, ) -> (IntTensor<Flex>, IntTensor<Flex>)

Sort the elements of the input tensor by value along a given dimension. Read more
Source§

fn int_argsort( tensor: IntTensor<Flex>, dim: usize, descending: bool, ) -> IntTensor<Flex>

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

fn int_powi_scalar(lhs: IntTensor<Flex>, rhs: Scalar) -> IntTensor<Flex>

Element-wise power with a scalar. Read more
Source§

fn int_powi_scalar_impl(lhs: IntTensor<Flex>, rhs: Scalar) -> IntTensor<Flex>

Element-wise power with a scalar. Read more
Source§

fn int_max_abs(tensor: IntTensor<Flex>) -> IntTensor<Flex>

Gets the maximum absolute element in the tensor. Read more
Source§

fn int_max_abs_dim(tensor: IntTensor<Flex>, dim: usize) -> IntTensor<Flex>

Gets the maximum absolute element in the tensor along a dimension. Read more
Source§

fn int_arange( range: Range<i64>, _device: &Device<Flex>, dtype: IntDType, ) -> IntTensor<Flex>

Creates a new tensor with values from the given range. Read more
Source§

fn int_arange_step( range: Range<i64>, step: usize, _device: &Device<Flex>, dtype: IntDType, ) -> IntTensor<Flex>

Creates a new tensor with values from the given range with the given step size. Read more
Source§

fn int_topk( tensor: <B as BackendTypes>::IntTensorPrimitive, dim: usize, k: usize, ) -> <B as BackendTypes>::IntTensorPrimitive

Gets the values of the k maximum elements along a dimension. Read more
Source§

impl ModuleOps<Flex> for Flex

Source§

fn conv1d( x: FloatTensor<Flex>, weight: FloatTensor<Flex>, bias: Option<FloatTensor<Flex>>, options: ConvOptions<1>, ) -> FloatTensor<Flex>

One dimensional convolution. Read more
Source§

fn conv2d( x: FloatTensor<Flex>, weight: FloatTensor<Flex>, bias: Option<FloatTensor<Flex>>, options: ConvOptions<2>, ) -> FloatTensor<Flex>

Two dimensional convolution. Read more
Source§

fn deform_conv2d( x: FloatTensor<Flex>, offset: FloatTensor<Flex>, weight: FloatTensor<Flex>, mask: Option<FloatTensor<Flex>>, bias: Option<FloatTensor<Flex>>, options: DeformConvOptions<2>, ) -> FloatTensor<Flex>

Two dimensional deformable convolution. Read more
Source§

fn deform_conv2d_backward( x: FloatTensor<Flex>, offset: FloatTensor<Flex>, weight: FloatTensor<Flex>, mask: Option<FloatTensor<Flex>>, bias: Option<FloatTensor<Flex>>, output_grad: FloatTensor<Flex>, options: DeformConvOptions<2>, ) -> DeformConv2dBackward<Flex>

Backward pass for the deform_conv2d operation.
Source§

fn conv3d( x: FloatTensor<Flex>, weight: FloatTensor<Flex>, bias: Option<FloatTensor<Flex>>, options: ConvOptions<3>, ) -> FloatTensor<Flex>

Three dimensional convolution. Read more
Source§

fn conv_transpose1d( x: FloatTensor<Flex>, weight: FloatTensor<Flex>, bias: Option<FloatTensor<Flex>>, options: ConvTransposeOptions<1>, ) -> FloatTensor<Flex>

One dimensional transposed convolution. Read more
Source§

fn conv_transpose2d( x: FloatTensor<Flex>, weight: FloatTensor<Flex>, bias: Option<FloatTensor<Flex>>, options: ConvTransposeOptions<2>, ) -> FloatTensor<Flex>

Two dimensional transposed convolution. Read more
Source§

fn conv_transpose3d( x: FloatTensor<Flex>, weight: FloatTensor<Flex>, bias: Option<FloatTensor<Flex>>, options: ConvTransposeOptions<3>, ) -> FloatTensor<Flex>

Three dimensional transposed convolution. Read more
Source§

fn avg_pool2d( x: FloatTensor<Flex>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], count_include_pad: bool, ceil_mode: bool, ) -> FloatTensor<Flex>

Two dimensional avg pooling. Read more
Source§

fn avg_pool2d_backward( x: FloatTensor<Flex>, grad: FloatTensor<Flex>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], count_include_pad: bool, _divisor_override: bool, ) -> FloatTensor<Flex>

Backward pass for the avg pooling 2d operation.
Source§

fn adaptive_avg_pool2d( x: FloatTensor<Flex>, output_size: [usize; 2], ) -> FloatTensor<Flex>

Two dimensional adaptive avg pooling. Read more
Source§

fn adaptive_avg_pool2d_backward( x: FloatTensor<Flex>, grad: FloatTensor<Flex>, ) -> FloatTensor<Flex>

Backward pass for the adaptive avg pooling 2d operation.
Source§

fn max_pool2d( x: FloatTensor<Flex>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2], ceil_mode: bool, ) -> FloatTensor<Flex>

Two dimensional max pooling. Read more
Source§

fn max_pool2d_with_indices( x: FloatTensor<Flex>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2], ceil_mode: bool, ) -> MaxPool2dWithIndices<Flex>

Two dimensional max pooling with indices. Read more
Source§

fn max_pool2d_with_indices_backward( x: FloatTensor<Flex>, _kernel_size: [usize; 2], _stride: [usize; 2], _padding: [usize; 2], _dilation: [usize; 2], _ceil_mode: bool, output_grad: FloatTensor<Flex>, indices: IntTensor<Flex>, ) -> MaxPool2dBackward<Flex>

Backward pass for the max pooling 2d operation.
Source§

fn interpolate( x: FloatTensor<Flex>, output_size: [usize; 2], options: InterpolateOptions, ) -> FloatTensor<Flex>

Down/up samples the input. Read more
Source§

fn interpolate_backward( x: FloatTensor<Flex>, grad: FloatTensor<Flex>, output_size: [usize; 2], options: InterpolateOptions, ) -> FloatTensor<Flex>

Backward pass for the interpolate operation.
Source§

fn attention( query: FloatTensor<Flex>, key: FloatTensor<Flex>, value: FloatTensor<Flex>, mask: Option<BoolTensor<Flex>>, attn_bias: Option<FloatTensor<Flex>>, options: AttentionModuleOptions, ) -> FloatTensor<Flex>

Computes scaled dot-product attention: softmax(QKᵗ * scale) · V, where scale defaults to 1/sqrt(head_dim). Optionally applies masking, additive bias, causal masking, and softcap to the attention scores. Read more
Source§

fn rfft( signal: FloatTensor<Flex>, dim: usize, n: Option<usize>, ) -> (FloatTensor<Flex>, FloatTensor<Flex>)

Real-valued FFT with optional size parameter. Read more
Source§

fn irfft( spectrum_re: FloatTensor<Flex>, spectrum_im: FloatTensor<Flex>, dim: usize, n: Option<usize>, ) -> FloatTensor<Flex>

Inverse real-valued FFT with optional output size. Read more
Source§

fn embedding( weights: FloatTensor<Flex>, indices: IntTensor<Flex>, ) -> FloatTensor<Flex>

Embedding operation. Read more
Source§

fn layer_norm( tensor: FloatTensor<Flex>, gamma: FloatTensor<Flex>, beta: Option<FloatTensor<Flex>>, epsilon: f64, ) -> FloatTensor<Flex>

Applies Layer Normalization over the last dimension of the input tensor. Read more
Source§

fn embedding_backward( weights: FloatTensor<Flex>, output_grad: FloatTensor<Flex>, indices: IntTensor<Flex>, ) -> FloatTensor<Flex>

Embedding backward operation. Read more
Source§

fn linear( x: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, bias: Option<<B as BackendTypes>::FloatTensorPrimitive>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Linear transformation. Read more
Source§

fn linear_x_backward( weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for linear, returning the gradient for x.
Source§

fn linear_weight_backward( x: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for linear, returning the gradient for weight.
Source§

fn linear_bias_backward( output_grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for linear, returning the gradient for bias.
Source§

fn conv1d_x_backward( x: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvOptions<1>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv1d operation, returning the gradient for x.
Source§

fn conv1d_weight_backward( x: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvOptions<1>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv1d operation, returning the gradient for weight.
Source§

fn conv1d_bias_backward( x: <B as BackendTypes>::FloatTensorPrimitive, bias: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv1d operation, returning the gradient for bias.
Source§

fn conv2d_x_backward( x: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvOptions<2>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv2d operation, returning the gradient for x.
Source§

fn conv2d_weight_backward( x: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvOptions<2>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv2d operation, returning the gradient for weight.
Source§

fn conv2d_bias_backward( x: <B as BackendTypes>::FloatTensorPrimitive, bias: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv2d operation, returning the gradient for bias.
Source§

fn conv3d_x_backward( x: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvOptions<3>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv3d operation, returning the gradient for x.
Source§

fn conv3d_weight_backward( x: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvOptions<3>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv3d operation, returning the gradient for weight.
Source§

fn conv3d_bias_backward( x: <B as BackendTypes>::FloatTensorPrimitive, bias: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv3d operation, returning the gradient for bias.
Source§

fn conv_transpose1d_x_backward( weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvTransposeOptions<1>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv transpose 1d operation, returning the gradient for x.
Source§

fn conv_transpose1d_weight_backward( x: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvTransposeOptions<1>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv transpose 1d operation, returning the gradient for weight.
Source§

fn conv_transpose1d_bias_backward( x: <B as BackendTypes>::FloatTensorPrimitive, bias: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv transpose 1d operation, returning the gradient for bias.
Source§

fn conv_transpose2d_x_backward( weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvTransposeOptions<2>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv transpose 2d operation, returning the gradient for x.
Source§

fn conv_transpose2d_weight_backward( x: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvTransposeOptions<2>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv transpose 2d operation, returning the gradient for weight.
Source§

fn conv_transpose2d_bias_backward( x: <B as BackendTypes>::FloatTensorPrimitive, bias: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv transpose 2d operation, returning the gradient for bias.
Source§

fn conv_transpose3d_x_backward( weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvTransposeOptions<3>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv transpose 3d operation, returning the gradient for x.
Source§

fn conv_transpose3d_weight_backward( x: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, options: ConvTransposeOptions<3>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv transpose 3d operation, returning the gradient for weight.
Source§

fn conv_transpose3d_bias_backward( x: <B as BackendTypes>::FloatTensorPrimitive, bias: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the conv transpose 3d operation, returning the gradient for bias.
Source§

fn unfold4d( x: <B as BackendTypes>::FloatTensorPrimitive, kernel_size: [usize; 2], options: UnfoldOptions, ) -> <B as BackendTypes>::FloatTensorPrimitive

Four-dimensional unfolding. Read more
Source§

fn avg_pool1d( x: <B as BackendTypes>::FloatTensorPrimitive, kernel_size: usize, stride: usize, padding: usize, count_include_pad: bool, ceil_mode: bool, ) -> <B as BackendTypes>::FloatTensorPrimitive

One dimensional avg pooling. Read more
Source§

fn avg_pool1d_backward( x: <B as BackendTypes>::FloatTensorPrimitive, grad: <B as BackendTypes>::FloatTensorPrimitive, kernel_size: usize, stride: usize, padding: usize, count_include_pad: bool, ceil_mode: bool, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the avg pooling 1d operation.
Source§

fn adaptive_avg_pool1d( x: <B as BackendTypes>::FloatTensorPrimitive, output_size: usize, ) -> <B as BackendTypes>::FloatTensorPrimitive

One dimensional adaptive avg pooling. Read more
Source§

fn adaptive_avg_pool1d_backward( x: <B as BackendTypes>::FloatTensorPrimitive, grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for the adaptive avg pooling 1d operation.
Source§

fn max_pool1d( x: <B as BackendTypes>::FloatTensorPrimitive, kernel_size: usize, stride: usize, padding: usize, dilation: usize, ceil_mode: bool, ) -> <B as BackendTypes>::FloatTensorPrimitive

One dimensional max pooling. Read more
Source§

fn max_pool1d_with_indices( x: <B as BackendTypes>::FloatTensorPrimitive, kernel_size: usize, stride: usize, padding: usize, dilation: usize, ceil_mode: bool, ) -> MaxPool1dWithIndices<B>

One dimensional max pooling with indices. Read more
Source§

fn max_pool1d_with_indices_backward( x: <B as BackendTypes>::FloatTensorPrimitive, kernel_size: usize, stride: usize, padding: usize, dilation: usize, ceil_mode: bool, output_grad: <B as BackendTypes>::FloatTensorPrimitive, indices: <B as BackendTypes>::IntTensorPrimitive, ) -> MaxPool1dBackward<B>

Backward pass for the max pooling 1d operation.
Source§

fn ctc_loss( log_probs: <B as BackendTypes>::FloatTensorPrimitive, targets: <B as BackendTypes>::IntTensorPrimitive, input_lengths: <B as BackendTypes>::IntTensorPrimitive, target_lengths: <B as BackendTypes>::IntTensorPrimitive, blank: usize, ) -> <B as BackendTypes>::FloatTensorPrimitive

Computes the Connectionist Temporal Classification (CTC) loss. Read more
Source§

fn has_ctc_loss_backward() -> bool

Returns true if this backend implements ctc_loss_backward natively. Read more
Source§

fn ctc_loss_backward( _log_probs: <B as BackendTypes>::FloatTensorPrimitive, _targets: <B as BackendTypes>::IntTensorPrimitive, _input_lengths: <B as BackendTypes>::IntTensorPrimitive, _target_lengths: <B as BackendTypes>::IntTensorPrimitive, _grad_loss: <B as BackendTypes>::FloatTensorPrimitive, _blank: usize, ) -> <B as BackendTypes>::FloatTensorPrimitive

Backward pass for ctc_loss: gradient w.r.t. log_probs. Read more
Source§

impl QTensorOps<Flex> for Flex

Source§

fn q_from_data( data: TensorData, _device: &Device<Flex>, ) -> QuantizedTensor<Flex>

Creates a new tensor from the data structure. Read more
Source§

fn quantize_dynamic( tensor: FloatTensor<Flex>, scheme: &QuantScheme, ) -> QuantizedTensor<Flex>

Dynamically convert the tensor to a lower precision data type based on the quantization scheme.
Source§

fn quantize( tensor: FloatTensor<Flex>, scheme: &QuantScheme, qparams: QuantizationParametersPrimitive<Flex>, ) -> QuantizedTensor<Flex>

Convert the tensor to a lower precision data type based on the quantization scheme and parameters.
Source§

fn dequantize( tensor: QuantizedTensor<Flex>, dtype: FloatDType, ) -> FloatTensor<Flex>

Convert the tensor back to a higher precision data type.
Source§

fn q_device(_tensor: &QuantizedTensor<Flex>) -> Device<Flex>

Gets the device of the tensor. Read more
Source§

fn q_to_device( tensor: QuantizedTensor<Flex>, _device: &Device<Flex>, ) -> QuantizedTensor<Flex>

Moves the tensor to the given device. Read more
Source§

fn q_reshape( tensor: QuantizedTensor<Flex>, shape: Shape, ) -> QuantizedTensor<Flex>

Reshapes a tensor. Read more
Source§

async fn q_into_data( tensor: QuantizedTensor<Flex>, ) -> Result<TensorData, ExecutionError>

Converts the tensor to a data structure. Read more
Source§

fn q_swap_dims( tensor: QuantizedTensor<Flex>, dim1: usize, dim2: usize, ) -> QuantizedTensor<Flex>

Swaps two dimensions of a tensor. Read more
Source§

fn q_permute( tensor: QuantizedTensor<Flex>, axes: &[usize], ) -> QuantizedTensor<Flex>

Permutes the dimensions of a tensor. Read more
Source§

fn q_flip( tensor: QuantizedTensor<Flex>, axes: &[usize], ) -> QuantizedTensor<Flex>

Reverse the order of elements in a tensor along the given axes. Read more
Source§

fn q_expand( tensor: QuantizedTensor<Flex>, shape: Shape, ) -> QuantizedTensor<Flex>

Broadcasts the tensor to the given shape.
Source§

fn q_select( tensor: QuantizedTensor<Flex>, dim: usize, indices: IntTensor<Flex>, ) -> QuantizedTensor<Flex>

Select tensor elements along the given dimension corresponding for the given indices. Read more
Source§

fn q_slice( tensor: QuantizedTensor<Flex>, slices: &[Slice], ) -> QuantizedTensor<Flex>

Select tensor elements corresponding to the given slices. Read more
Source§

fn q_argmax( tensor: QuantizedTensor<Flex>, dim: usize, out_dtype: IntDType, ) -> IntTensor<Flex>

Gets the indices of the maximum elements of a tensor along an axis. Read more
Source§

fn q_argmin( tensor: QuantizedTensor<Flex>, dim: usize, out_dtype: IntDType, ) -> IntTensor<Flex>

Gets the indices of the minimum elements of a tensor along an axis. Read more
Source§

fn q_gather( dim: usize, tensor: QuantizedTensor<Flex>, indices: IntTensor<Flex>, ) -> QuantizedTensor<Flex>

Gather elements from a tensor. Read more
Source§

fn q_detach( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Detaches a tensor from the computation graph.
Source§

fn q_set_require_grad( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, _require_grad: bool, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Sets the require_grad flag of a tensor.
Source§

fn q_is_require_grad( _tensor: &<B as BackendTypes>::QuantizedTensorPrimitive, ) -> bool

Returns the require_grad flag of a tensor.
Source§

fn q_transpose( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Transposes a tensor. Read more
Source§

fn q_repeat_dim( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, times: usize, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Repeat the tensor along the given dimension. Read more
Source§

fn q_add( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Adds two tensors together. Read more
Source§

fn q_add_scalar( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: Scalar, ) -> TensorPrimitive<B>

Adds a scalar to a tensor. Read more
Source§

fn q_clamp_min( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, min: Scalar, ) -> TensorPrimitive<B>

Clamps a tensor under a minimum value. Read more
Source§

fn q_clamp_max( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, max: Scalar, ) -> TensorPrimitive<B>

Clamps a tensor over a maximum value. Read more
Source§

fn q_clamp( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, min: Scalar, max: Scalar, ) -> TensorPrimitive<B>

Clamps a tensor between a minimum and maximum value. Read more
Source§

fn q_sub( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Subtracts two tensors. Read more
Source§

fn q_sub_scalar( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: Scalar, ) -> TensorPrimitive<B>

Subtracts a scalar from a tensor. Read more
Source§

fn q_mul( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Multiplies two tensors together element-wise.
Source§

fn q_mul_scalar( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: Scalar, ) -> TensorPrimitive<B>

Multiplies a tensor by a scalar. Read more
Source§

fn q_div( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Divides two tensors element-wise. Read more
Source§

fn q_div_scalar( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: Scalar, ) -> TensorPrimitive<B>

Divides a tensor by a scalar. Read more
Source§

fn q_matmul( lhs: TensorPrimitive<B>, rhs: TensorPrimitive<B>, ) -> TensorPrimitive<B>

Multiplies two tensors together using matrix multiplication. Read more
Source§

fn q_neg( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Negates a tensor element-wise.
Source§

fn q_recip( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Calculates the reciprocals element-wise
Source§

fn q_sum( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Sum of all elements in a tensor. Read more
Source§

fn q_sum_dim( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, ) -> TensorPrimitive<B>

Sum of all elements in a tensor along a dimension. Read more
Source§

fn q_prod( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Product of all elements in a tensor. Read more
Source§

fn q_prod_dim( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, ) -> TensorPrimitive<B>

Product of all elements in a tensor along a dimension. Read more
Source§

fn q_mean( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Mean of all elements in a tensor. Read more
Source§

fn q_mean_dim( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, ) -> TensorPrimitive<B>

Mean of all elements in a tensor along a dimension. Read more
Source§

fn q_cumsum( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, ) -> TensorPrimitive<B>

Computes the cumulative sum of elements along a dimension. Read more
Source§

fn q_cumprod( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, ) -> TensorPrimitive<B>

Computes the cumulative product of elements along a dimension. Read more
Source§

fn q_cummin( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, ) -> TensorPrimitive<B>

Computes the cumulative minimum of elements along a dimension. Read more
Source§

fn q_cummax( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, ) -> TensorPrimitive<B>

Computes the cumulative maximum of elements along a dimension. Read more
Source§

fn q_exp( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with exponential values. Read more
Source§

fn q_log( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with natural logarithm values. Read more
Source§

fn q_log1p( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with logarithm values of (1 + Xi). Read more
Source§

fn q_powf( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Element-wise power with another tensor. Read more
Source§

fn q_powi( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: <B as BackendTypes>::IntTensorPrimitive, ) -> TensorPrimitive<B>

Element-wise power with an IntTensor. Read more
Source§

fn q_powi_scalar( lhs: <B as BackendTypes>::QuantizedTensorPrimitive, rhs: Scalar, ) -> TensorPrimitive<B>

Element-wise power with an int scalar. Read more
Source§

fn q_powf_scalar( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, value: Scalar, ) -> TensorPrimitive<B>

Element-wise power with a float scalar. Read more
Source§

fn q_sqrt( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with square root values. Read more
Source§

fn q_abs( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Returns a new tensor with absolute values. Read more
Source§

fn q_cos( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with cosine values. Read more
Source§

fn q_sin( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with sine values. Read more
Source§

fn q_tan( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with tangent values. Read more
Source§

fn q_cosh( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with hyperbolic cosine values. Read more
Source§

fn q_sinh( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with hyperbolic sine values. Read more
Source§

fn q_tanh( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with hyperbolic tangent values. Read more
Source§

fn q_erf( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> TensorPrimitive<B>

Returns a new tensor with the error function values. Read more
Source§

fn q_cat( tensors: Vec<<B as BackendTypes>::QuantizedTensorPrimitive>, dim: usize, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Concatenates tensors along a dimension. Read more
Source§

fn q_argtopk( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, k: usize, out_dtype: IntDType, ) -> <B as BackendTypes>::IntTensorPrimitive

Gets the indices of the k maximum elements of a tensor along an axis. If two elements are equals, order them by the lowest indices Read more
Source§

fn q_topk( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, k: usize, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Gets the values of the k maximum elements of a tensor along an axis. Read more
Source§

fn q_max( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Gets the maximum element of a tensor. Read more
Source§

fn q_max_dim( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Gets the maximum elements of a tensor along an axis. Read more
Source§

fn q_max_dim_with_indices( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, out_dtype: IntDType, ) -> (<B as BackendTypes>::QuantizedTensorPrimitive, <B as BackendTypes>::IntTensorPrimitive)

Gets the maximum elements of a tensor along an axis and their indices. Read more
Source§

fn q_min( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Gets the minimum element of a tensor. Read more
Source§

fn q_min_dim( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Gets the minimum elements of a tensor along an axis. Read more
Source§

fn q_min_dim_with_indices( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, out_dtype: IntDType, ) -> (<B as BackendTypes>::QuantizedTensorPrimitive, <B as BackendTypes>::IntTensorPrimitive)

Gets the minimum elements of a tensor along an axis and their indices. Read more
Source§

fn q_max_abs( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Gets the maximum element of a tensor. Read more
Source§

fn q_max_abs_dim( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Gets the maximum elements of a tensor along an axis. Read more
Source§

fn q_any( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

Tests if any element in the tensor evaluates to True. Read more
Source§

fn q_any_dim( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

fn q_all( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

Tests if all elements in the tensor evaluate to True. Read more
Source§

fn q_all_dim( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

Tests if all elements in the tensor evaluate to True along a given dimension dim. Read more
Source§

fn q_sort( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, descending: bool, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Sort the elements of the input tensor by value in along a given dimension. Read more
Source§

fn q_sort_with_indices( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, descending: bool, out_dtype: IntDType, ) -> (<B as BackendTypes>::QuantizedTensorPrimitive, <B as BackendTypes>::IntTensorPrimitive)

Sort the elements of the input tensor by value in along a given dimension. Read more
Source§

fn q_argsort( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, descending: bool, out_dtype: IntDType, ) -> <B as BackendTypes>::IntTensorPrimitive

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

impl TransactionOps<Flex> for Flex

Source§

fn tr_execute( transaction: TransactionPrimitive<B>, ) -> impl Future<Output = Result<TransactionPrimitiveData, ExecutionError>> + Send

Executes a transaction and return its data.
Source§

impl<E: Copy, I: Copy> Copy for Flex<E, I>

Auto Trait Implementations§

§

impl<E, I> Freeze for Flex<E, I>

§

impl<E, I> RefUnwindSafe for Flex<E, I>

§

impl<E, I> Send for Flex<E, I>
where E: Send, I: Send,

§

impl<E, I> Sync for Flex<E, I>
where E: Sync, I: Sync,

§

impl<E, I> Unpin for Flex<E, I>
where E: Unpin, I: Unpin,

§

impl<E, I> UnsafeUnpin for Flex<E, I>

§

impl<E, I> UnwindSafe for Flex<E, I>
where E: UnwindSafe, I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.