ops
163 memberslucid.opsThe engine-bound primitive ops, grouped by arity.
158 ops registered in lucid/_ops/_registry.py and bound onto the top level at import time — elementwise maths, comparisons, reductions, shape moves and their in-place _-suffixed forms.
These are the leaves of the autograd graph: each maps to one engine kernel with a hand-written backward, which is what distinguishes them from the composites in lucid.ops.composite. The page is split by arity (unary / binary / variadic) because a flat list of 158 is not navigable.
Sub-packages
Functions
neg→ TensorElement-wise negation.
abs→ Tensorsign→ TensorElement-wise sign function.
exp→ TensorElement-wise natural exponential.
log→ TensorElement-wise natural logarithm.
log2→ TensorElement-wise base-2 logarithm.
sqrt→ TensorElement-wise square root.
square→ TensorElement-wise square.
reciprocal→ TensorElement-wise multiplicative inverse.
floor→ TensorElement-wise floor (round toward ).
ceil→ TensorElement-wise ceiling (round toward ).
round→ Tensorsin→ TensorElement-wise sine (input in radians).
cos→ TensorElement-wise cosine (input in radians).
tan→ TensorElement-wise tangent (input in radians).
arcsin→ TensorElement-wise inverse sine in radians.
arccos→ TensorElement-wise inverse cosine in radians.
arctan→ TensorElement-wise inverse tangent in radians.
sinh→ TensorElement-wise hyperbolic sine.
cosh→ TensorElement-wise hyperbolic cosine.
tanh→ TensorElement-wise hyperbolic tangent.
relu→ TensorElement-wise rectified linear unit.
sigmoid→ TensorElement-wise logistic sigmoid.
selu→ TensorScaled exponential linear unit activation.
ravel→ Tensorcontiguous→ TensorReturn a tensor with C-contiguous (row-major) memory layout.
add→ TensorElement-wise addition with broadcasting and dtype promotion.
sub→ TensorElement-wise subtraction with broadcasting and dtype promotion.
mul→ TensorElement-wise multiplication (Hadamard product) with broadcasting.
div→ TensorElement-wise division with broadcasting and dtype promotion, rounded as asked.
pow→ Tensormaximum→ TensorElement-wise maximum with broadcasting.
minimum→ TensorElement-wise minimum with broadcasting.
matmul→ TensorMatrix product with full broadcasting semantics.
cumsum→ TensorReturn the cumulative sum of elements along dim.
cumprod→ TensorReturn the cumulative product of elements along dim.
cummax→ Tensorcummin→ TensorReturn the running minimum of input along dim.
erf→ Tensorerfinv→ Tensortrace→ TensorSum of the main diagonal of a 2-D tensor.
reshape→ TensorReshape a tensor to shape.
unsqueeze→ TensorInsert a new size-1 dimension at position dim.
flatten→ TensorCollapse a contiguous range of dimensions into a single dim.
permute→ TensorReturn input with its dimensions rearranged.
transpose→ TensorReverse the axes of input, or swap the two named.
broadcast_to→ TensorBroadcast a tensor to a target shape.
expand→ TensorBroadcast the singleton dimensions of input to new sizes.
as_strided→ TensorView a tensor's storage through chosen sizes and strides.
tile→ TensorConstruct a tensor by repeating input dims times per axis.
flip→ TensorReverse the order of elements along the specified dims.
fliplr→ TensorFlip a 2-D-or-higher tensor left-to-right (along axis 1).
flipud→ TensorFlip a 1-D-or-higher tensor upside-down (along axis 0).
roll→ TensorCyclically shift the elements of input along dims.
tril→ TensorReturn the lower-triangular part of a 2-D-or-higher tensor.
triu→ TensorReturn the upper-triangular part of a 2-D-or-higher tensor.
sort→ TensorSort input along dim and return the sorted values.
argsort→ TensorReturn the indices that would sort input along dim.
nonzero→ Tensor or tuple of TensorReturn the indices of all non-zero (or True) elements.
unique→ Tensor or tuple of TensorReturn the sorted unique elements of input.
topk→ tuple of (Tensor, Tensor)Return the k largest (or smallest) values along dim and their indices.
diagonal→ TensorExtract a (off-)diagonal from each matrix in a batched input.
equal→ TensorElement-wise equality predicate.
not_equal→ TensorElement-wise inequality predicate.
greater→ TensorElement-wise strict greater-than predicate.
greater_equal→ TensorElement-wise greater-than-or-equal predicate.
less→ TensorElement-wise strict less-than predicate.
less_equal→ TensorElement-wise less-than-or-equal predicate.
where→ Tensor or tuple of TensorElementwise selection between input and other based on condition.
masked_fill→ TensorReturn input with positions where mask is True set to value.
cat→ TensorConcatenate tensors along an existing dimension.
stack→ TensorStack tensors along a new dimension.
hstack→ TensorStack tensors horizontally (column-wise).
vstack→ TensorStack tensors vertically (row-wise).
chunk→ list of TensorSplit a tensor into at most chunks pieces along dim.
unbind→ list of TensorRemove dim and return the slices along it.
softmax→ TensorApply the softmax function along a dimension.
log_softmax→ TensorNumerically stable log-softmax along a dimension.
rsqrt→ TensorElement-wise reciprocal square root.
any→ Tensorall→ Tensorclip→ TensorElement-wise clamping to a closed interval.
isinf→ TensorElement-wise IEEE 754 infinity check.
isnan→ TensorElement-wise NaN check.
isfinite→ TensorElement-wise IEEE 754 finiteness check.
nan_to_num→ TensorReplace NaN, positive and negative infinity entries with finite values.
detach→ TensorReturn a tensor that shares data but is detached from the autograd graph.
clone→ TensorReturn a deep copy of input with its own storage.
clamp→ TensorElement-wise clamping to a closed interval.
clamp_min→ Tensorclamp_max→ Tensorscatter_add→ TensorAccumulate src into input along dim at positions index.
log10→ TensorElement-wise base-10 logarithm.
log1p→ TensorElement-wise natural logarithm of 1 + x.
exp2→ TensorElement-wise base-2 exponential.
trunc→ TensorElement-wise truncation toward zero.
frac→ TensorElement-wise fractional part.
atan2→ TensorElement-wise quadrant-aware inverse tangent.
fmod→ TensorElement-wise C-style floating-point remainder.
remainder→ TensorElement-wise Python-style modulo.
hypot→ TensorElement-wise Euclidean norm of two operands, computed in a numerically stable way.
logaddexp→ TensorElement-wise log-sum-exp of two operands.
nextafter→ TensorElement-wise IEEE 754 next representable floating-point value.
logsumexp→ TensorCompute the numerically stable log-sum-exp along dim.
mm→ TensorStrict 2-D matrix multiplication.
bmm→ TensorBatched matrix multiplication.
kron→ TensorKronecker product of two tensors.
logical_and→ TensorElement-wise logical AND.
logical_or→ TensorElement-wise logical OR.
logical_xor→ TensorElement-wise logical exclusive-OR.
logical_not→ TensorElement-wise logical NOT.
take→ TensorReturn elements of input at the given flat index.
index_select→ TensorSelect slices of input along dim given index.
narrow→ TensorReturn a slice of input along dim.
scatter→ TensorWrite src into input along dim at positions index.
kthvalue→ TensorReturn the k-th smallest value along dim.
movedim→ TensorMove one or more dimensions to new positions.
unflatten→ TensorInverse of flatten — split a single dim into a tuple of dims.
histc→ TensorCompute a histogram of input with bins equally-spaced bins.
cartesian_prod→ TensorReturn the Cartesian product of the given 1-D tensors.
searchsorted→ TensorFind insertion points to maintain order in a sorted sequence.
bucketize→ TensorReturn the bucket index of each element of input in boundaries.
eq→ TensorElement-wise equality predicate.
ne→ TensorElement-wise inequality predicate.
lt→ TensorElement-wise strict less-than predicate.
le→ TensorElement-wise less-than-or-equal predicate.
gt→ TensorElement-wise strict greater-than predicate.
ge→ TensorElement-wise greater-than-or-equal predicate.
asin→ TensorElement-wise inverse sine in radians.
acos→ TensorElement-wise inverse cosine in radians.
atan→ TensorElement-wise inverse tangent in radians.
bitwise_not→ TensorElement-wise bitwise NOT.
bitwise_and→ TensorElement-wise bitwise AND.
bitwise_or→ TensorElement-wise bitwise OR.
bitwise_xor→ TensorElement-wise bitwise XOR.
bitwise_left_shift→ TensorElement-wise bitwise left shift.
bitwise_right_shift→ TensorElement-wise bitwise right shift.
masked_select→ TensorReturn a 1-D tensor of elements where mask is True.
isclose→ TensorElement-wise approximate equality with absolute and relative tolerance.
view→ TensorReturn input with a different shape.
concat→ TensorAlias for cat.
real→ TensorReal part of a complex tensor.
imag→ TensorImaginary part of a complex tensor.
complex→ Tensorconj→ TensorElement-wise complex conjugate.
sum→ Tensormean→ TensorCompute the arithmetic mean along dim.
prod→ TensorCompute the product of elements along dim.
max→ Tensormin→ TensorReturn the smallest element of input, or the smallest along dim.
var→ TensorCompute the variance along dim.
std→ TensorCompute the standard deviation along dim.
argmax→ TensorReturn the indices of the maximum values along dim.
argmin→ TensorReturn the indices of the minimum values along dim.
squeeze→ TensorRemove dimensions of size 1.
repeat→ TensorTile a tensor along an existing dimension.
repeat_interleave→ TensorRepeat each element of input repeats times along dim.
split→ list of TensorSplit a tensor into pieces of explicit sizes along dim.
tensordot→ TensorGeneralized tensor contraction over arbitrary axes.
meshgrid→ list of TensorConstruct coordinate grids from 1-D coordinate vectors.
gather→ TensorGather values along dim according to index.
lerp→ TensorLinearly interpolate between input and an endpoint with a weight.
diff→ TensorCompute the n-th order finite difference along an axis.