Skip to main content

Module module

Module module 

Source
Available on crate feature api only.
Expand description

The neural network module.

Functions§

adaptive_avg_pool1d
Applies a 1D adaptive avg pooling.
adaptive_avg_pool2d
Applies a 2D adaptive avg pooling.
adaptive_avg_pool3d
Adaptive average pooling to explicit [depth, height, width] extents.
attention
Computes scaled dot-product attention: softmax(QKᵗ * scale) · V, where scale defaults to 1/sqrt(head_dim) (configurable via options.scale). Optionally applies masking, additive bias, causal masking, and softcap.
attention_fallback
Exports attention fallback to test backend’s attention against.
avg_pool1d
Applies a 1D avg pooling.
avg_pool1d_padded
Average pooling with explicit (left, right) padding.
avg_pool2d
Applies a 2D avg pooling.
avg_pool2d_padded
Average pooling with explicit height and width (before, after) pairs.
avg_pool3d
Average-pool native [batch, channels, depth, height, width] activations.
avg_pool3d_padded
Average pooling with depth, height and width (before, after) pairs.
conv1d
Applies a 1D convolution.
conv2d
Applies a 2D convolution.
conv3d
Applies a 3D convolution.
conv_transpose1d
Applies a 1D transposed convolution.
conv_transpose1d_with_output_size
Apply a 1D transposed convolution with an explicit output length.
conv_transpose2d
Applies a 2D transposed convolution.
conv_transpose2d_with_output_size
Apply a 2D transposed convolution with explicit output height and width.
conv_transpose3d
Applies a 3D transposed convolution](crate::api::ops::ModuleOps::conv_transpose3d).
conv_transpose3d_with_output_size
Apply a 3D transposed convolution with explicit output depth, height and width.
ctc_loss
Computes the CTC loss.
deform_conv2d
Applies a Deformable 2D convolution.
embedding
Applies the embedding module.
group_norm
Channel GroupNorm on [batch, channels, ...], with independently optional affine leaves. Uses biased variance and saved FP32 statistics for low-precision training; F64 retains FP64.
interpolate
Applies a 2D interpolation.
interpolate1d
Resize native [batch, channels, length] activations.
interpolate3d
Resize native [batch, channels, depth, height, width] activations.
linear
Applies a linear transformation to the input tensor using the given weight and bias.
max_pool1d
Applies a 1D max pooling.
max_pool1d_padded
Maximum pooling with explicit (left, right) padding and native dilation.
max_pool1d_with_indices
Applies a 1D max pooling.
max_pool1d_with_indices_padded
Maximum pooling with asymmetric length padding and original input positions.
max_pool2d
Applies a 2D max pooling.
max_pool2d_padded
Maximum pooling with explicit height and width (before, after) pairs.
max_pool2d_with_indices
Applies a 2D max pooling with indices.
max_pool2d_with_indices_padded
Maximum pooling with asymmetric spatial padding and original h * W + w indices.
max_pool3d
Maximum-pool native volumes using the backend’s volume operation.
max_pool3d_padded
Maximum pooling with explicit depth, height and width padding pairs.
max_pool3d_with_indices
Native volume maxima and flattened I64 positions in the original input. Empty selections are -1; tie/NaN selection retains spatial-then-depth order.
max_pool3d_with_indices_padded
Maximum volume pooling with asymmetric padding and original flattened positions.
rms_norm
Last-axis RMSNorm with working arithmetic and one output-storage cast. F32/F16/BF16 activations use FP32 statistics; F64 activations retain FP64.
unfold4d
Applies a 4D to 3D unfold.