Skip to main content

NdArray

Struct NdArray 

Source
pub struct NdArray;
๐Ÿ‘ŽDeprecated since 0.22.0:

burn-ndarray is deprecated and will be removed in a future release. Use burn-flex for pure-Rust CPU execution (std, no_std, WebAssembly), or one of the CubeCL backends (burn-cuda, burn-rocm, burn-wgpu, burn-cpu) for GPU acceleration.

Expand description

Tensor backend that uses the ndarray crate for executing tensor operations.

This backend is compatible with CPUs and can be compiled for almost any platform, including wasm, arm, and x86.

Trait Implementationsยง

Sourceยง

impl ActivationOps<NdArray> for NdArray

Sourceยง

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

Applies the ReLU activation function. Read more
Sourceยง

fn leaky_relu( tensor: <B as BackendTypes>::FloatTensorPrimitive, negative_slope: Scalar, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies the LeakyReLU activation function. Read more
Sourceยง

fn relu_backward( output: <B as BackendTypes>::FloatTensorPrimitive, grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies the ReLU activation function backward. Read more
Sourceยง

fn gelu( tensor: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies the Gelu activation function. Read more
Sourceยง

fn prelu( tensor: <B as BackendTypes>::FloatTensorPrimitive, alpha: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies the PReLu activation function. Read more
Sourceยง

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

Applies the Gelu activation function backward. Read more
Sourceยง

fn sigmoid( tensor: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies the Sigmoid activation function. Read more
Sourceยง

fn sigmoid_backward( output: <B as BackendTypes>::FloatTensorPrimitive, grad: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies the Sigmoid activation function backward. Read more
Sourceยง

fn hard_sigmoid( tensor: <B as BackendTypes>::FloatTensorPrimitive, alpha: Scalar, beta: Scalar, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies the hard Sigmoid activation function. Read more
Sourceยง

fn log_sigmoid( tensor: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies the LogSigmoid activation function. Read more
Sourceยง

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

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ยง

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

Applies the LogSigmoid activation function backward. Read more
Sourceยง

impl Backend for NdArray

Sourceยง

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

If autodiff is enabled.
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 dtype_usage(_device: &Self::Device, dtype: DType) -> DTypeUsageSet

Returns the DTypeUsageSet for the given DType on the specified device.
Sourceยง

fn device_count(_: 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 flush(_device: &Self::Device)

Flush any pending operation of the backend.
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 memory_install_pools( device: &Self::Device, layout: MemoryPoolLayout, ) -> Result<(), InstallMemoryPoolsError>

Install a layout for the deviceโ€™s dynamic memory pools. Read more
Sourceยง

fn memory_pool_report(device: &Self::Device) -> Option<Vec<SlicedPoolReport>>

The dynamic poolsโ€™ measured state, in the order allocations are routed through them. None on a backend that does not report one, or whose stream has failed. Read more
Sourceยง

fn memory_pool_usage(device: &Self::Device) -> Option<MemoryPoolUsage>

The device allocatorโ€™s current state. None on a backend that does not report one, or whose stream has failed.
Sourceยง

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

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

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

Prepare device for an upcoming graph capture: route allocations into a stable pool so every buffer allocated before graph_stop_capture can be pinned. Call before the warmup run. No-op by default. Read more
Sourceยง

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

Begin recording launches on device into a graph (see graph_stop_capture). Errors on backends without hardware graph support, so callers fall back to re-running.
Sourceยง

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

Stop recording and return the captured graph, ready to graph_replay.
Sourceยง

unsafe fn graph_replay( _device: &Self::Device, _graph: &Self::GraphPrimitive, ) -> Result<(), ExecutionError>

Replay a captured graph โ€” one dispatch re-running the recorded launches against their original buffers. Read more
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 NdArray

Sourceยง

type Handle = HandleKind<NdArray>

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

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

Convert a handle to a float tensor.
Sourceยง

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

Convert a handle to an int tensor.
Sourceยง

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

Convert a handle to a bool tensor.
Sourceยง

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

Convert a handle to a quantized tensor.
Sourceยง

fn float_tensor_handle(tensor: FloatTensor<Self>) -> Self::Handle

Convert a float tensor to a handle.
Sourceยง

fn int_tensor_handle(tensor: IntTensor<Self>) -> Self::Handle

Convert an int tensor to a handle.
Sourceยง

fn bool_tensor_handle(tensor: BoolTensor<Self>) -> Self::Handle

Convert a bool tensor to a handle.
Sourceยง

fn quantized_tensor_handle(tensor: QuantizedTensor<Self>) -> Self::Handle

Convert a quantized tensor to a handle.
Sourceยง

impl BackendTypes for NdArray

Sourceยง

type Device = NdArrayDevice

Device type.
Sourceยง

type FloatTensorPrimitive = NdArrayTensor

Tensor primitive to be used for all float operations.
Sourceยง

type IntTensorPrimitive = NdArrayTensor

Tensor primitive to be used for all int operations.
Sourceยง

type BoolTensorPrimitive = NdArrayTensor

Tensor primitive to be used for all bool operations.
Sourceยง

type QuantizedTensorPrimitive = NdArrayQTensor

Tensor primitive to be used for all quantized operations.
Sourceยง

type GraphPrimitive = GraphUnsupported

Captured graph primitive returned by Backend::graph_stop_capture and consumed by Backend::graph_replay: a backend-owned recording of a launch sequence that replays as a single dispatch. Read more
Sourceยง

impl BoolTensorOps<NdArray> for NdArray

Sourceยง

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

Creates a tensor from the data structure. Read more
Sourceยง

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

Converts the tensor to a data structure. Read more
Sourceยง

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

Moves the tensor to the device.
Sourceยง

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

Reshapes the tensor. Read more
Sourceยง

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

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

fn bool_into_int(tensor: NdArrayTensor, out_dtype: IntDType) -> NdArrayTensor

Converts bool tensor to int tensor. Read more
Sourceยง

fn bool_empty( shape: Shape, _device: &NdArrayDevice, dtype: BoolDType, ) -> NdArrayTensor

Creates a new bool tensor. Read more
Sourceยง

fn bool_zeros( shape: Shape, _device: &NdArrayDevice, _dtype: BoolDType, ) -> NdArrayTensor

Creates a new bool tensor filled false. Read more
Sourceยง

fn bool_ones( shape: Shape, _device: &NdArrayDevice, _dtype: BoolDType, ) -> NdArrayTensor

Creates a new bool tensor filled true. Read more
Sourceยง

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

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

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

Concatenates the tensors along the given dimension. Read more
Sourceยง

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

Equates the two tensors. Read more
Sourceยง

fn bool_not(tensor: NdArrayTensor) -> NdArrayTensor

Inverses boolean values. Read more
Sourceยง

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

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

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

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

fn bool_into_float( tensor: NdArrayTensor, out_dtype: FloatDType, ) -> FloatTensor<Self>

Converts bool tensor to float tensor. Read more
Sourceยง

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

Swaps two dimensions of a bool tensor. Read more
Sourceยง

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

Permutes the dimensions of a tensor. Read more
Sourceยง

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

Broadcasts the bool tensor to the given shape.
Sourceยง

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

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

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

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_flip(tensor: NdArrayTensor, axes: &[usize]) -> NdArrayTensor

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

fn bool_unfold( tensor: NdArrayTensor, dim: usize, size: usize, step: usize, ) -> NdArrayTensor

Unfold windows along a dimension. Read more
Sourceยง

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

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<Self>, mask: BoolTensor<Self>, value: Scalar, ) -> BoolTensor<Self>

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<Self>, indices: IntTensor<Self>, ) -> BoolTensor<Self>

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

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

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

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

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

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

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

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

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

fn bool_mask_select( tensor: <B as BackendTypes>::BoolTensorPrimitive, mask: <B as BackendTypes>::BoolTensorPrimitive, ) -> impl Future<Output = <B as BackendTypes>::BoolTensorPrimitive> + Send + 'static

Selects the elements of the tensor where the mask is true, returned as a 1D tensor. Read more
Sourceยง

fn bool_repeat_dim( tensor: <B as BackendTypes>::BoolTensorPrimitive, dim: usize, times: usize, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

fn bool_not_equal( lhs: <B as BackendTypes>::BoolTensorPrimitive, rhs: <B as BackendTypes>::BoolTensorPrimitive, ) -> <B as BackendTypes>::BoolTensorPrimitive

Element-wise non-equality comparison. Read more
Sourceยง

fn bool_not_equal_elem( lhs: <B as BackendTypes>::BoolTensorPrimitive, rhs: Scalar, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

fn bool_xor( lhs: <B as BackendTypes>::BoolTensorPrimitive, rhs: <B as BackendTypes>::BoolTensorPrimitive, ) -> <B as BackendTypes>::BoolTensorPrimitive

Element-wise exclusive or. Read more
Sourceยง

fn bool_transpose( tensor: <B as BackendTypes>::BoolTensorPrimitive, ) -> <B as BackendTypes>::BoolTensorPrimitive

Transposes a bool tensor. Read more
Sourceยง

fn bool_any_dim( tensor: <B as BackendTypes>::BoolTensorPrimitive, dim: usize, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

fn bool_all_dim( tensor: <B as BackendTypes>::BoolTensorPrimitive, dim: usize, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

fn bool_argwhere( tensor: <B as BackendTypes>::BoolTensorPrimitive, out_dtype: IntDType, ) -> impl Future<Output = <B as BackendTypes>::IntTensorPrimitive> + Send + 'static

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

impl Clone for NdArray

Sourceยง

fn clone(&self) -> NdArray

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 Copy for NdArray

Sourceยง

impl Debug for NdArray

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl Default for NdArray

Sourceยง

fn default() -> NdArray

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl DistributedOps<NdArray> for NdArray

Sourceยง

fn start_communication_server( devices: &[<B as BackendTypes>::Device], config: DistributedConfig, )

Start the communication server used to orchestrate tensor syncing between devices. Read more
Sourceยง

fn close_communication_server(_device: &<B as BackendTypes>::Device)

Close the communication server used to orchestrate syncing between devices. Read more
Sourceยง

fn register_sync_parameters( _device: &<B as BackendTypes>::Device, distributed_params: Vec<DistributedParams>, )

Register the parameters that will require gradient synchronization for the upcoming backward pass. Read more
Sourceยง

fn submit_sync_collective(device: &<B as BackendTypes>::Device)

Tell the gradient sync server that this device has submitted all its sync operations and is ready to be synchronized. Read more
Sourceยง

fn submit_gradient_sync( tensor: TensorRef<B>, distributed_params: DistributedParams, )

Submit a gradient tensor for synchronization across all devices. Read more
Sourceยง

fn all_reduce( _tensor: <B as BackendTypes>::FloatTensorPrimitive, _op: ReduceOperation, _device_ids: Vec<DeviceId>, ) -> CollectiveTensor<B>

all_reduce operation. Read more
Sourceยง

fn sync_collective(_device: &<B as BackendTypes>::Device)

Sync the collective operations. Read more
Sourceยง

unsafe fn comm_device(tensor: &TensorRef<B>) -> <B as BackendTypes>::Device

Get the device of the tensor reference. Read more
Sourceยง

unsafe fn float_from_ref( tensor: &TensorRef<B>, ) -> <B as BackendTypes>::FloatTensorPrimitive

Returns a clone of the float tensor from the tensor reference. Read more
Sourceยง

impl FloatTensorOps<NdArray> for NdArray

Sourceยง

fn float_from_data( data: TensorData, _device: &NdArrayDevice, ) -> FloatTensor<Self>

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

fn float_random( shape: Shape, distribution: Distribution, device: &NdArrayDevice, dtype: FloatDType, ) -> FloatTensor<Self>

Creates a new tensor with random values. Read more
Sourceยง

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

Converts the tensor to a data structure. Read more
Sourceยง

fn float_to_device( tensor: FloatTensor<Self>, _device: &NdArrayDevice, ) -> FloatTensor<Self>

Moves the tensor to the given device. Read more
Sourceยง

fn float_empty( shape: Shape, device: &NdArrayDevice, dtype: FloatDType, ) -> FloatTensor<Self>

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

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

Adds two tensors together. Read more
Sourceยง

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

Adds a scalar to a tensor. Read more
Sourceยง

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

Subtracts two tensors. Read more
Sourceยง

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

Subtracts a scalar from a tensor. Read more
Sourceยง

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

Multiplies two tensors together element-wise.
Sourceยง

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

Multiplies a tensor by a scalar. Read more
Sourceยง

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

Divides two tensors element-wise. Read more
Sourceยง

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

Divides a tensor by a scalar. Read more
Sourceยง

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

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

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

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

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

Multiplies two tensors together using matrix multiplication. Read more
Sourceยง

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

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

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

Calculates the reciprocals element-wise
Sourceยง

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

Swaps two dimensions of a tensor. Read more
Sourceยง

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

Reshapes a tensor. Read more
Sourceยง

fn float_gather( dim: usize, tensor: FloatTensor<Self>, indices: NdArrayTensor, ) -> FloatTensor<Self>

Gather elements from a tensor. Read more
Sourceยง

fn float_scatter_add( dim: usize, tensor: FloatTensor<Self>, indices: NdArrayTensor, value: FloatTensor<Self>, ) -> FloatTensor<Self>

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

fn float_scatter( dim: usize, tensor: FloatTensor<Self>, indices: NdArrayTensor, value: FloatTensor<Self>, update: IndexingUpdateOp, ) -> FloatTensor<Self>

Scatter elements into a tensor using the specified update operation. Read more
Sourceยง

fn float_scatter_nd( data: FloatTensor<Self>, indices: NdArrayTensor, values: FloatTensor<Self>, reduction: IndexingUpdateOp, ) -> FloatTensor<Self>

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

fn float_gather_nd( data: FloatTensor<Self>, indices: NdArrayTensor, ) -> FloatTensor<Self>

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

fn float_select( tensor: FloatTensor<Self>, dim: usize, indices: NdArrayTensor, ) -> FloatTensor<Self>

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

fn float_select_add( tensor: FloatTensor<Self>, dim: usize, indices: NdArrayTensor, value: FloatTensor<Self>, ) -> FloatTensor<Self>

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_select_assign( tensor: FloatTensor<Self>, dim: usize, indices: NdArrayTensor, value: FloatTensor<Self>, update: IndexingUpdateOp, ) -> FloatTensor<Self>

Assign selected elements along a dimension using the specified update operation. Read more
Sourceยง

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

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

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

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

fn float_mask_where( tensor: FloatTensor<Self>, mask: NdArrayTensor, value: FloatTensor<Self>, ) -> FloatTensor<Self>

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

fn float_mask_fill( tensor: FloatTensor<Self>, mask: NdArrayTensor, value: Scalar, ) -> FloatTensor<Self>

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

fn float_equal( lhs: FloatTensor<Self>, rhs: FloatTensor<Self>, _out_dtype: BoolDType, ) -> NdArrayTensor

Equal comparison of two tensors. Read more
Sourceยง

fn float_equal_elem( lhs: FloatTensor<Self>, rhs: Scalar, _out_dtype: BoolDType, ) -> NdArrayTensor

Equal comparison of a tensor and a scalar. Read more
Sourceยง

fn float_greater( lhs: FloatTensor<Self>, rhs: FloatTensor<Self>, _out_dtype: BoolDType, ) -> NdArrayTensor

Greater than comparison of two tensors. Read more
Sourceยง

fn float_greater_elem( lhs: FloatTensor<Self>, rhs: Scalar, _out_dtype: BoolDType, ) -> NdArrayTensor

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

fn float_greater_equal( lhs: FloatTensor<Self>, rhs: FloatTensor<Self>, _out_dtype: BoolDType, ) -> NdArrayTensor

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

fn float_greater_equal_elem( lhs: FloatTensor<Self>, rhs: Scalar, _out_dtype: BoolDType, ) -> NdArrayTensor

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

fn float_lower( lhs: FloatTensor<Self>, rhs: FloatTensor<Self>, _out_dtype: BoolDType, ) -> NdArrayTensor

Less than comparison of two tensors. Read more
Sourceยง

fn float_lower_elem( lhs: FloatTensor<Self>, rhs: Scalar, _out_dtype: BoolDType, ) -> NdArrayTensor

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

fn float_lower_equal( lhs: FloatTensor<Self>, rhs: FloatTensor<Self>, _out_dtype: BoolDType, ) -> NdArrayTensor

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

fn float_lower_equal_elem( lhs: FloatTensor<Self>, rhs: Scalar, _out_dtype: BoolDType, ) -> NdArrayTensor

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

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

Detaches a tensor from the computation graph.
Sourceยง

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

Mean of all elements in a tensor. Read more
Sourceยง

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

Sum of all elements in a tensor. Read more
Sourceยง

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

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

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

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

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

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

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

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

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

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

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

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

fn float_argmax( tensor: FloatTensor<Self>, dim: usize, out_dtype: IntDType, ) -> NdArrayTensor

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

fn float_argmin( tensor: FloatTensor<Self>, dim: usize, out_dtype: IntDType, ) -> NdArrayTensor

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

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

Returns a new tensor with exponential values. Read more
Sourceยง

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

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

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

Product of all elements in a tensor. Read more
Sourceยง

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

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

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

Gets the maximum element of a tensor. Read more
Sourceยง

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

Gets the minimum element of a tensor. Read more
Sourceยง

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

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

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

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

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

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

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

Returns a new tensor with absolute values. Read more
Sourceยง

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

Returns a new tensor with cosine values. Read more
Sourceยง

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

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

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

Returns a new tensor with sine values. Read more
Sourceยง

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

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

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

Returns a new tensor with tangent values. Read more
Sourceยง

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Returns a new tensor with rounded values. Read more
Sourceยง

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

Returns a new tensor with floored values. Read more
Sourceยง

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

Returns a new tensor with ceiled values. Read more
Sourceยง

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

Returns a new tensor with truncated values. Read more
Sourceยง

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

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

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

Concatenates tensors along a dimension. Read more
Sourceยง

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

Clamps a tensor under a minimum value. Read more
Sourceยง

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

Clamps a tensor over a maximum value. Read more
Sourceยง

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

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

fn float_into_int( tensor: FloatTensor<Self>, out_dtype: IntDType, ) -> NdArrayTensor

Converts float tensor to int tensor. Read more
Sourceยง

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

Element-wise power with a FloatTensor. Read more
Sourceยง

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

Permutes the dimensions of a tensor. Read more
Sourceยง

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

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

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

Returns the signs of the float tensor. Read more
Sourceยง

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

Broadcasts the float tensor to the given shape.
Sourceยง

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

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

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

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_unfold( tensor: FloatTensor<Self>, dim: usize, size: usize, step: usize, ) -> FloatTensor<Self>

Unfold windows along a dimension. Read more
Sourceยง

fn float_hypot( lhs: FloatTensor<Self>, rhs: FloatTensor<Self>, ) -> FloatTensor<Self>

Returns a new tensor with the Euclidean distance values. Read more
Sourceยง

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

Creates a new tensor with zeros. Read more
Sourceยง

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

Creates a new tensor with ones. Read more
Sourceยง

fn float_full( shape: Shape, fill_value: Scalar, device: &<B as BackendTypes>::Device, dtype: FloatDType, ) -> <B as BackendTypes>::FloatTensorPrimitive

Creates a tensor filled with given value. Read more
Sourceยง

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

Repeat the tensor along the given dimension. Read more
Sourceยง

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

Negates a tensor element-wise.
Sourceยง

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

Transposes a tensor. Read more
Sourceยง

fn float_mask_select( tensor: <B as BackendTypes>::FloatTensorPrimitive, mask: <B as BackendTypes>::BoolTensorPrimitive, ) -> impl Future<Output = <B as BackendTypes>::FloatTensorPrimitive> + Send + 'static

Selects the elements of the tensor where the mask is true, returned as a 1D tensor. Read more
Sourceยง

fn float_not_equal( lhs: <B as BackendTypes>::FloatTensorPrimitive, rhs: <B as BackendTypes>::FloatTensorPrimitive, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

Element-wise non-equality comparison. Read more
Sourceยง

fn float_not_equal_elem( lhs: <B as BackendTypes>::FloatTensorPrimitive, rhs: Scalar, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

Element-wise non-equality comparison with a scalar. 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( lhs: <B as BackendTypes>::FloatTensorPrimitive, rhs: <B as BackendTypes>::IntTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Element-wise power with an IntTensor. Read more
Sourceยง

fn float_powi_scalar( 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_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_powf_scalar( tensor: <B as BackendTypes>::FloatTensorPrimitive, value: Scalar, ) -> <B as BackendTypes>::FloatTensorPrimitive

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

fn float_argtopk( tensor: <B as BackendTypes>::FloatTensorPrimitive, 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, it will be ordered by lowest indices 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ยง

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

Gets the values of the k maximum elements of a tensor along an axis, and their indices. Read more
Sourceยง

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

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

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

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

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

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

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

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

fn float_max_abs( tensor: <B as BackendTypes>::FloatTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

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

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

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

fn float_any( tensor: <B as BackendTypes>::FloatTensorPrimitive, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

fn float_any_dim( tensor: <B as BackendTypes>::FloatTensorPrimitive, 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 float_all( tensor: <B as BackendTypes>::FloatTensorPrimitive, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

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

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

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

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

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

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

fn float_argsort( tensor: <B as BackendTypes>::FloatTensorPrimitive, 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ยง

fn float_is_nan( tensor: <B as BackendTypes>::FloatTensorPrimitive, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

fn float_is_inf( tensor: <B as BackendTypes>::FloatTensorPrimitive, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

impl IntTensorOps<NdArray> for NdArray

Sourceยง

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

Creates a tensor from the data structure. Read more
Sourceยง

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

Converts the tensor to a data structure. Read more
Sourceยง

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

Moves the tensor to the given device.
Sourceยง

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

Reshapes the tensor. Read more
Sourceยง

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

Gets the element at the given indices. Read more
Sourceยง

fn int_empty( shape: Shape, device: &NdArrayDevice, dtype: IntDType, ) -> NdArrayTensor

Creates a new int tensor. Read more
Sourceยง

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

Multiplies two tensors together using matrix multiplication. Read more
Sourceยง

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

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: NdArrayTensor, mask: NdArrayTensor, value: Scalar, ) -> NdArrayTensor

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

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

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

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

Concatenates the given tensors along the given dimension. Read more
Sourceยง

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

Element-wise equality comparison. Read more
Sourceยง

fn int_equal_elem( lhs: NdArrayTensor, rhs: Scalar, _out_dtype: BoolDType, ) -> NdArrayTensor

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

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

Element-wise greater than comparison. Read more
Sourceยง

fn int_greater_elem( lhs: NdArrayTensor, rhs: Scalar, _out_dtype: BoolDType, ) -> NdArrayTensor

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

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

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

fn int_greater_equal_elem( lhs: NdArrayTensor, rhs: Scalar, _out_dtype: BoolDType, ) -> NdArrayTensor

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

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

Element-wise less than comparison. Read more
Sourceยง

fn int_lower_elem( lhs: NdArrayTensor, rhs: Scalar, _out_dtype: BoolDType, ) -> NdArrayTensor

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

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

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

fn int_lower_equal_elem( lhs: NdArrayTensor, rhs: Scalar, _out_dtype: BoolDType, ) -> NdArrayTensor

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

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

Element-wise addition. Read more
Sourceยง

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

Element-wise addition with a scalar. Read more
Sourceยง

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

Element-wise subtraction. Read more
Sourceยง

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

Element-wise subtraction with a scalar. Read more
Sourceยง

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

Element-wise multiplication. Read more
Sourceยง

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

Element-wise multiplication with a scalar. Read more
Sourceยง

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

Element-wise division. Read more
Sourceยง

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

Element-wise division with a scalar. Read more
Sourceยง

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

Element-wise modulus. Read more
Sourceยง

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

Element-wise modulus with a scalar. Read more
Sourceยง

fn int_sum(tensor: NdArrayTensor) -> NdArrayTensor

Sums all elements in the tensor. Read more
Sourceยง

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

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

fn int_prod(tensor: NdArrayTensor) -> NdArrayTensor

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

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

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

fn int_mean(tensor: NdArrayTensor) -> NdArrayTensor

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

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

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

fn int_max(tensor: NdArrayTensor) -> NdArrayTensor

Gets the maximum element in the tensor. Read more
Sourceยง

fn int_min(tensor: NdArrayTensor) -> NdArrayTensor

Gets the minimum element in the tensor. Read more
Sourceยง

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

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

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

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

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

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

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

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

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

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

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

Scatter a given value to the tensor at the given indices using sum reduction. Read more
Sourceยง

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

Scatter elements into a tensor using the specified update operation. Read more
Sourceยง

fn int_scatter_nd( data: NdArrayTensor, indices: NdArrayTensor, values: NdArrayTensor, reduction: IndexingUpdateOp, ) -> NdArrayTensor

Multi-dimensional scatter for int tensors.
Sourceยง

fn int_gather_nd(data: NdArrayTensor, indices: NdArrayTensor) -> NdArrayTensor

Multi-dimensional gather for int tensors.
Sourceยง

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

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

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

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

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

Assign selected elements along a dimension using the specified update operation. Read more
Sourceยง

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

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

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

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

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

Clamps a tensor under a minimum value. Read more
Sourceยง

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

Clamps a tensor over a maximum value. Read more
Sourceยง

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

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

fn int_abs(tensor: NdArrayTensor) -> NdArrayTensor

Returns a new tensor with absolute values. Read more
Sourceยง

fn int_into_float( tensor: NdArrayTensor, out_dtype: FloatDType, ) -> FloatTensor<Self>

Converts int tensor to float tensor. Read more
Sourceยง

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

Swaps two dimensions of an int tensor. Read more
Sourceยง

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

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

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

Element-wise power with a IntTensor. Read more
Sourceยง

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

Permutes the dimensions of a tensor. Read more
Sourceยง

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

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

fn int_sign(tensor: NdArrayTensor) -> NdArrayTensor

Returns the signs of the int tensor. Read more
Sourceยง

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

Broadcasts the int tensor to the given shape.
Sourceยง

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

Bitwise AND operation for Int Tensors
Sourceยง

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

Bitwise AND operation for Int Tensors with a scalar
Sourceยง

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

Bitwise OR operation for Int Tensors
Sourceยง

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

Bitwise OR operation for Int Tensors with a scalar
Sourceยง

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

Bitwise XOR operation for Int Tensors
Sourceยง

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

Bitwise XOR operation for Int Tensors with a scalar
Sourceยง

fn bitwise_not(tensor: NdArrayTensor) -> NdArrayTensor

Bitwise NOT operation for Int Tensors
Sourceยง

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

Bitwise left shift operation for Int Tensors
Sourceยง

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

Bitwise left shift operation for Int Tensors with a scalar
Sourceยง

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

Bitwise right shift operation for Int Tensors
Sourceยง

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

Bitwise right shift operation for Int Tensors with a scalar
Sourceยง

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

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

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

Unfold windows along a dimension. Read more
Sourceยง

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

Element-wise power with a scalar. Read more
Sourceยง

fn int_mask_select( tensor: <B as BackendTypes>::IntTensorPrimitive, mask: <B as BackendTypes>::BoolTensorPrimitive, ) -> impl Future<Output = <B as BackendTypes>::IntTensorPrimitive> + Send + 'static

Selects the elements of the tensor where the mask is true, returned as a 1D tensor. Read more
Sourceยง

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

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

fn int_not_equal( lhs: <B as BackendTypes>::IntTensorPrimitive, rhs: <B as BackendTypes>::IntTensorPrimitive, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

Element-wise non-equality comparison. Read more
Sourceยง

fn int_not_equal_elem( lhs: <B as BackendTypes>::IntTensorPrimitive, rhs: Scalar, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

fn int_square( tensor: <B as BackendTypes>::IntTensorPrimitive, ) -> <B as BackendTypes>::IntTensorPrimitive

Element-wise square with a IntTensor. Read more
Sourceยง

fn int_powi_scalar( lhs: <B as BackendTypes>::IntTensorPrimitive, rhs: Scalar, ) -> <B as BackendTypes>::IntTensorPrimitive

Element-wise power with a scalar. Read more
Sourceยง

fn int_neg( tensor: <B as BackendTypes>::IntTensorPrimitive, ) -> <B as BackendTypes>::IntTensorPrimitive

Element-wise negation. Read more
Sourceยง

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

Creates a tensor of zeros. Read more
Sourceยง

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

Creates a tensor of ones. Read more
Sourceยง

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

Creates a tensor filled with given value. Read more
Sourceยง

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

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_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ยง

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

Gets the values of the k maximum elements along a dimension, and their indices. Read more
Sourceยง

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

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

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

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

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

Gets the maximum absolute element in the tensor. Read more
Sourceยง

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

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

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

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

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

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

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

Transposes an int tensor. Read more
Sourceยง

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

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

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

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

fn int_any( tensor: <B as BackendTypes>::IntTensorPrimitive, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

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

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

fn int_all( tensor: <B as BackendTypes>::IntTensorPrimitive, out_dtype: BoolStore, ) -> <B as BackendTypes>::BoolTensorPrimitive

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

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

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

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

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

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

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

fn int_argsort( tensor: <B as BackendTypes>::IntTensorPrimitive, dim: usize, descending: bool, ) -> <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 ModuleOps<NdArray> for NdArray

Sourceยง

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

Two dimensional convolution. Read more
Sourceยง

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

Two dimensional deformable convolution. Read more
Sourceยง

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

Backward pass for the deform_conv2d operation.
Sourceยง

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

Two dimensional transposed convolution. Read more
Sourceยง

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

Two dimensional avg pooling. Read more
Sourceยง

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

Backward pass for the avg pooling 2d operation.
Sourceยง

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

Two dimensional max pooling. Read more
Sourceยง

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

Two dimensional max pooling with indices. Read more
Sourceยง

fn max_pool2d_with_indices_backward( x: FloatTensor<Self>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2], ceil_mode: bool, output_grad: FloatTensor<Self>, indices: NdArrayTensor, ) -> MaxPool2dBackward<Self>

Backward pass for the max pooling 2d operation.
Sourceยง

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

Two dimensional adaptive avg pooling. Read more
Sourceยง

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

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

fn adaptive_avg_pool3d( x: FloatTensor<Self>, output_size: [usize; 3], ) -> FloatTensor<Self>

Three dimensional adaptive avg pooling. Read more
Sourceยง

fn adaptive_avg_pool3d_backward( x: FloatTensor<Self>, grad: FloatTensor<Self>, ) -> FloatTensor<Self>

Backward pass for the adaptive avg pooling 3d operation.
Sourceยง

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

Down/up samples the input. Read more
Sourceยง

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

Backward pass for the interpolate operation.
Sourceยง

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

Three dimensional convolution. Read more
Sourceยง

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

Three dimensional transposed convolution. Read more
Sourceยง

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

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<Self>, _dim: usize, _n: Option<usize>, ) -> (FloatTensor<Self>, FloatTensor<Self>)

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

fn irfft( _spectrum_re: FloatTensor<Self>, _spectrum_im: FloatTensor<Self>, _dim: usize, _n: Option<usize>, ) -> FloatTensor<Self>

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

fn batch_norm( x: <B as BackendTypes>::FloatTensorPrimitive, gamma: <B as BackendTypes>::FloatTensorPrimitive, beta: <B as BackendTypes>::FloatTensorPrimitive, mean: <B as BackendTypes>::FloatTensorPrimitive, variance: <B as BackendTypes>::FloatTensorPrimitive, epsilon: f64, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies batch normalization using explicitly supplied channel statistics. Read more
Sourceยง

fn embedding( weights: <B as BackendTypes>::FloatTensorPrimitive, indices: <B as BackendTypes>::IntTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

Embedding operation. Read more
Sourceยง

fn embedding_backward( weights: <B as BackendTypes>::FloatTensorPrimitive, output_grad: <B as BackendTypes>::FloatTensorPrimitive, indices: <B as BackendTypes>::IntTensorPrimitive, ) -> <B as BackendTypes>::FloatTensorPrimitive

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: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, bias: Option<<B as BackendTypes>::FloatTensorPrimitive>, options: ConvOptions<1>, ) -> <B as BackendTypes>::FloatTensorPrimitive

One dimensional convolution. Read more
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: <B as BackendTypes>::FloatTensorPrimitive, weight: <B as BackendTypes>::FloatTensorPrimitive, bias: Option<<B as BackendTypes>::FloatTensorPrimitive>, options: ConvTransposeOptions<1>, ) -> <B as BackendTypes>::FloatTensorPrimitive

One dimensional transposed convolution. Read more
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 fold4d( x: <B as BackendTypes>::FloatTensorPrimitive, output_size: [usize; 2], kernel_size: [usize; 2], options: UnfoldOptions, ) -> <B as BackendTypes>::FloatTensorPrimitive

Four dimensional fold (col2im), the adjoint of unfold4d. 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, indices_dtype: IntDType, ) -> 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 layer_norm( tensor: <B as BackendTypes>::FloatTensorPrimitive, gamma: <B as BackendTypes>::FloatTensorPrimitive, beta: Option<<B as BackendTypes>::FloatTensorPrimitive>, epsilon: f64, ) -> <B as BackendTypes>::FloatTensorPrimitive

Applies Layer Normalization over the last dimension of the input tensor. Read more
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<NdArray> for NdArray

Sourceยง

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

Matrix multiplication with at least one quantized operand.

Fast path โ€” BitNet b1.58 ternary weights: when rhs is a Q2S symmetric per-tensor weight (values in {-1, 0, +1}) and lhs is an f32 activation, the product is computed WITHOUT dequantizing the weight and WITHOUT a single multiply in the inner loop: +1 => add, -1 => subtract, 0 => skip, then the per-tensor scale ฮณ is applied once per output element โ€” the multiply-free compute path BitNet is built on. The result matches the dequantize-then-float_matmul path to within f32 rounding.

Every other case (Q8, per-block, non-f32 activation, batched weights, โ€ฆ) falls through to the regular dequantize -> float_matmul path โ€” byte-for-byte the default behaviour.

Sourceยง

fn q_from_data( data: TensorData, _device: &NdArrayDevice, ) -> QuantizedTensor<Self>

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

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

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

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

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

fn q_to_device( tensor: QuantizedTensor<Self>, _device: &NdArrayDevice, ) -> QuantizedTensor<Self>

Moves the tensor to the given device. Read more
Sourceยง

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

Reshapes a tensor. Read more
Sourceยง

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

Converts the tensor to a data structure. Read more
Sourceยง

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

Swaps two dimensions of a tensor. Read more
Sourceยง

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

Permutes the dimensions of a tensor. Read more
Sourceยง

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

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

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

Gather elements from a tensor. Read more
Sourceยง

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

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

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

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

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

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

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

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

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

Broadcasts the tensor to the given shape.
Sourceยง

fn quantize_dynamic( tensor: <B as BackendTypes>::FloatTensorPrimitive, scheme: &QuantScheme, ) -> <B as BackendTypes>::QuantizedTensorPrimitive

Dynamically convert the tensor to a lower precision data type based on the quantization scheme.
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_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_topk_with_indices( tensor: <B as BackendTypes>::QuantizedTensorPrimitive, dim: usize, k: usize, out_dtype: IntDType, ) -> (<B as BackendTypes>::QuantizedTensorPrimitive, <B as BackendTypes>::IntTensorPrimitive)

Gets the values of the k maximum elements of a tensor along an axis, and their indices. 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<NdArray> for NdArray

Sourceยง

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

Executes a transaction and return its data.

Auto Trait Implementationsยง

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Sourceยง

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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.