functional
110 memberslucid.nn.functionalFunctions
relu→ TensorApply the rectified linear unit function element-wise.
leaky_relu→ TensorLeaky rectified linear unit activation.
elu→ TensorExponential linear unit activation.
celu→ TensorContinuously-differentiable Exponential Linear Unit (Barron 2017).
selu→ TensorScaled exponential linear unit activation.
gelu→ TensorGaussian Error Linear Unit activation.
silu→ TensorSigmoid Linear Unit (a.k.a. Swish-1) activation.
mish→ TensorMish activation function.
hardswish→ TensorHard Swish activation — piecewise linear approximation of `silu`.
hardsigmoid→ TensorHard sigmoid — piecewise linear approximation of `sigmoid`.
sigmoid→ TensorLogistic sigmoid activation.
tanh→ TensorHyperbolic tangent activation.
softmax→ TensorApply the softmax function along a dimension.
log_softmax→ TensorNumerically stable log-softmax along a dimension.
softplus→ TensorSmooth approximation of `relu`.
relu6→ TensorRectified linear unit clipped at six.
softmin→ TensorSoftmin — softmax applied to the negation of the input.
glu→ TensorGated Linear Unit (Dauphin et al. 2017).
prelu→ TensorParametric Rectified Linear Unit (He et al. 2015).
hardshrink→ TensorHard shrinkage operator.
tanhshrink→ TensorTanh shrinkage activation.
softshrink→ TensorSoft shrinkage operator — proximal operator of $\lambda \|\cdot\|_1$.
normalize→ TensorNormalize a tensor to unit $L_p$ norm along a dimension.
cosine_similarity→ TensorCosine similarity between two tensors along a dimension.
pairwise_distance→ TensorElement-wise $L_p$ distance between two equally-shaped tensors.
hardtanh→ TensorHardtanh — element-wise clamp to $[\text{min\_val}, \text{max\_val}]$.
logsigmoid→ TensorNumerically stable $\log \sigma(x)$.
softsign→ TensorSoftsign activation.
threshold→ TensorThreshold activation — gate elements by a scalar cutoff.
rrelu→ TensorRandomised leaky ReLU (Xu et al. 2015).
gumbel_softmax→ TensorGumbel-Softmax — differentiable relaxation of categorical sampling.
bilinear→ TensorBilinear transformation applied to two inputs.
fused_linear_relu→ TensorFused linear + ReLU forward kernel.
fused_linear_gelu→ TensorFused linear + GELU forward kernel.
conv1d→ Tensor1-D cross-correlation over batched 3-D input.
conv2d→ Tensor2-D cross-correlation over batched 4-D input.
conv3d→ Tensor3-D cross-correlation over batched 5-D input.
conv_transpose1d→ TensorTransposed 1-D convolution (a.k.a. "fractionally-strided" conv).
conv_transpose2d→ TensorTransposed 2-D convolution — the standard upsampling primitive.
conv_transpose3d→ TensorTransposed 3-D convolution — volumetric upsampling.
batch_norm→ TensorBatch normalization (Ioffe & Szegedy, 2015).
layer_norm→ TensorLayer normalization (Ba, Kiros & Hinton, 2016).
group_norm→ TensorGroup normalization (Wu & He, 2018).
rms_norm→ TensorRoot-mean-square layer normalization (Zhang & Sennrich, 2019).
instance_norm→ TensorInstance normalization (Ulyanov, Vedaldi & Lempitsky, 2016).
local_response_norm→ TensorLocal response normalization (Krizhevsky, Sutskever & Hinton, 2012).
max_pool1d→ Tensor1-D max pooling over a sliding window.
max_pool2d→ Tensor2-D max pooling over a sliding window.
max_pool3d→ Tensor3-D max pooling over a sliding window.
avg_pool1d→ Tensor1-D average pooling over a sliding window.
avg_pool2d→ Tensor2-D average pooling over a sliding window.
avg_pool3d→ Tensor3-D average pooling over a sliding window.
adaptive_avg_pool1d→ Tensor1-D adaptive average pooling — produces a fixed output length.
adaptive_avg_pool2d→ Tensor2-D adaptive average pooling — produces a fixed `(H, W)`.
adaptive_avg_pool3d→ Tensor3-D adaptive average pooling — produces a fixed `(D, H, W)`.
adaptive_max_pool2d→ Tensor2-D adaptive max pooling — fixed-shape `(H, W)` via per-cell max.
adaptive_max_pool1d→ Tensor1-D adaptive max pooling — produces a fixed output length.
adaptive_max_pool3d→ Tensor3-D adaptive max pooling — produces a fixed `(D, H, W)`.
lp_pool1d→ Tensor1-D Lp-norm pooling — $\big(\sum |x|^p\big)^{1/p}$.
lp_pool2d→ Tensor2-D Lp-norm pooling — $\big(\sum |x|^p\big)^{1/p}$.
lp_pool3d→ Tensor3-D Lp-norm pooling — $\big(\sum |x|^p\big)^{1/p}$.
max_unpool1d→ TensorInverse of `max_pool1d` via scatter at saved argmax indices.
max_unpool2d→ TensorInverse of `max_pool2d` via scatter at saved argmax indices.
max_unpool3d→ TensorInverse of `max_pool3d` via scatter at saved argmax indices.
fractional_max_pool2d→ Tensor or (Tensor, Tensor)Fractional max-pooling over a 2-D input (Graham, 2014).
fractional_max_pool3d→ Tensor or (Tensor, Tensor)Fractional max-pooling over a 3-D input (Graham, 2014).
dropout1d→ TensorChannel-wise dropout for 1-D sequence / feature inputs.
dropout2d→ TensorChannel-wise dropout for 2-D (spatial) feature maps.
dropout3d→ TensorChannel-wise dropout for 3-D (volumetric) feature maps.
alpha_dropout→ TensorAlpha dropout — variance-preserving dropout for SELU networks.
feature_alpha_dropout→ TensorChannel-wise alpha dropout for SELU convolutional networks.
scaled_dot_product_attention→ TensorScaled dot-product attention — the core of every Transformer block.
mse_loss→ TensorMean-squared-error (L2) loss between input and target.
l1_loss→ TensorMean-absolute-error (L1) loss between input and target.
smooth_l1_loss→ TensorSmooth L1 loss — a quadratic-near-zero, linear-far-from-zero hybrid.
huber_loss→ TensorHuber loss — robust regression with a tunable transition point.
cross_entropy→ TensorCross-entropy loss for multi-class classification.
nll_loss→ TensorNegative log-likelihood loss for multi-class classification.
binary_cross_entropy→ TensorBinary cross-entropy between predicted probabilities and targets.
binary_cross_entropy_with_logits→ TensorBinary cross-entropy from raw logits (numerically stable).
kl_div→ TensorKullback-Leibler divergence between two distributions.
triplet_margin_loss→ TensorTriplet margin loss for metric learning.
triplet_margin_with_distance_loss→ TensorTriplet margin loss with a user-supplied distance function.
cosine_embedding_loss→ TensorCosine embedding loss for pairwise similarity learning.
margin_ranking_loss→ TensorPairwise ranking hinge loss.
hinge_embedding_loss→ TensorHinge embedding loss.
poisson_nll_loss→ TensorPoisson negative log-likelihood loss for count regression.
gaussian_nll_loss→ TensorGaussian negative log-likelihood for heteroscedastic regression.
ctc_loss→ TensorConnectionist Temporal Classification (CTC) loss.
multi_margin_loss→ TensorMulti-class hinge (margin) loss — Crammer-Singer SVM objective.
multilabel_margin_loss→ TensorMulti-label hinge loss for set-valued targets.
soft_margin_loss→ TensorLogistic (softplus) loss for binary classification with ±1 labels.
multilabel_soft_margin_loss→ TensorPer-class logistic loss averaged over labels (multi-label BCE).
embedding→ TensorLook up rows of an embedding table by integer indices.
one_hot→ TensorOne-hot encode an integer class index tensor.
apply_rotary_emb→ tuple[Tensor, Tensor]Apply Rotary Position Embedding (RoPE) to query and key tensors.
sinusoidal_embedding→ TensorBuild the 1-D sinusoidal positional encoding table from "Attention Is All You Need".
sinusoidal_embedding_2d→ TensorBuild the 2-D sinusoidal positional encoding from DETR (Carion et al., 2020).
interpolate→ TensorResample an N-D tensor to a target spatial size or scale factor.
grid_sample→ TensorSample an input feature map at flow-field coordinates.
affine_grid→ TensorGenerate a sampling grid from a batch of affine transform matrices.
pad→ TensorPad an N-D tensor along an arbitrary set of trailing dimensions.
unfold→ TensorExtract sliding local blocks (im2col) from a batched 4-D tensor.
fold→ TensorCombine an array of sliding local blocks back into an image (col2im).
embedding_bag→ TensorAggregate embeddings into per-bag pooled vectors.
pixel_shuffle→ TensorSub-pixel upsampling: rearrange channels into spatial resolution.
pixel_unshuffle→ TensorInverse of `pixel_shuffle`: pack spatial blocks into channels.
multi_head_attention_forward→ (Tensor, Tensor or None)Stateless functional multi-head attention forward pass.
channel_shuffle→ TensorGroup-then-transpose channel rearrangement (ShuffleNet).
pdist→ TensorPairwise $L_p$ distances between rows of a 2-D tensor.