composite
133 memberslucid.ops.compositeOps assembled from the primitives rather than from a kernel.
118 functions defined in lucid/_ops/composite/ — the aliases (absolute, arctan2, ...), the fused arithmetic helpers (addmm, addcdiv, ...), and the statistical and linear-algebra conveniences.
They carry no kernel and no backward of their own: gradients fall out of the primitives they are written in. That makes them cheap to add and correct by construction, at the cost of materialising the intermediates a fused kernel would not.
Functions
absolute→ TensorElement-wise absolute value.
acosh→ TensorInverse hyperbolic cosine.
addbmm→ TensorBatched matmul with reduction over the batch axis.
addcdiv→ TensorElement-wise fused divide-add.
addcmul→ TensorElement-wise fused multiply-add with a scalar weight.
addmm→ TensorGeneral matrix multiply with a scaled accumulator (GEMM).
addmv→ TensorMatrix-vector multiply with a scaled accumulator (BLAS-2 gemv).
addr→ TensorRank-1 update of a matrix by an outer product (BLAS-2 ger).
adjoint→ TensorConjugate (Hermitian) transpose of the trailing two dimensions.
aminmax→ tuple[Tensor, Tensor]Compute the minimum and maximum of input.
angle→ TensorPhase angle (argument) of each element.
arccosh→ TensorInverse hyperbolic cosine.
arcsinh→ TensorInverse hyperbolic sine.
arctan2→ TensorQuadrant-correct two-argument arctangent.
arctanh→ TensorInverse hyperbolic tangent.
asinh→ TensorInverse hyperbolic sine.
atanh→ TensorInverse hyperbolic tangent.
atleast_1d→ Tensor | tuple[Tensor, ...]Promote each input to at least 1 dimension.
atleast_2d→ Tensor | tuple[Tensor, ...]Promote each input to at least 2 dimensions.
atleast_3d→ Tensor | tuple[Tensor, ...]Promote each input to at least 3 dimensions.
baddbmm→ TensorBatched GEMM with a batched accumulator.
bartlett_window→ TensorBartlett (triangular) window, periodic by default.
blackman_window→ TensorBlackman window, in the periodic form stft expects by default.
block_diag→ TensorConstruct a block-diagonal matrix from a sequence of blocks.
broadcast_shapes→ tuple[int, ...]Return the common shape to which shapes broadcast.
broadcast_tensors→ tuple[Tensor, ...]Broadcast one or more tensors against each other to a common shape.
can_cast→ boolPredicate: can from_ be cast to to under the promotion rules?
column_stack→ TensorStack tensors as columns of a 2-D matrix.
conj_physical→ TensorEagerly materialised complex conjugate.
cumulative_trapezoid→ TensorCompute the running trapezoidal integral of y along dim.
divide→ TensorElement-wise division — lucid.div under its longer name.
dsplit→ list[Tensor]Split a tensor along its third (depth) axis.
dstack→ TensorStack tensors along the third (depth) axis.
expm1→ TensorElement-wise .
float_power→ TensorElement-wise power that always promotes operands to float64.
fmax→ TensorElement-wise NaN-quiet maximum.
fmin→ TensorElement-wise NaN-quiet minimum.
ger→ TensorOuter product of two 1-D tensors.
hamming_window→ TensorHamming window, or the two-term cosine window alpha/beta give.
hann_window→ TensorHann window, in the periodic form stft expects by default.
heaviside→ TensorHeaviside step function with a user-selectable value at .
hsplit→ list[Tensor]Split a tensor horizontally (along axis 1 for rank ).
is_conj→ boolPredicate: does the tensor carry a lazy "conjugated" flag?
is_neg→ boolPredicate: does the tensor carry a lazy "negated" flag?
is_nonzero→ boolPredicate: is a single-element tensor non-zero?
is_same_size→ boolPredicate: do two tensors have identical shapes?
is_storage→ boolPredicate: is the object a separate Storage container?
isin→ TensorPer-element set-membership test.
isneginf→ TensorElement-wise test for negative infinity.
isposinf→ TensorElement-wise test for positive infinity.
isreal→ TensorElement-wise test for real-valued entries.
istft→ TensorInverse short-time Fourier transform.
kaiser_window→ TensorKaiser window with shape parameter beta, periodic by default.
logcumsumexp→ TensorReturn the logarithm of the cumulative sum of exponentials of input along dim.
logit→ TensorLogit function — inverse of the logistic sigmoid.
median→ Tensor or tuple of TensorMedian of a tensor along dim (or over the whole tensor when None).
mode→ tuple of TensorReturn a (values, indices) pair of the modal value of each slice along dim.
moveaxis→ TensorMove one or more axes to new positions.
msort→ TensorSort the elements of input along its first dimension in ascending order.
multiply→ TensorElement-wise product.
mv→ TensorMatrix-vector product.
nanmean→ TensorMean of the tensor, ignoring NaN entries.
nanmedian→ Tensor or tuple of TensorMedian of a tensor, ignoring NaN entries.
nanquantile→ TensorNaN-aware quantile — same interface as quantile, but
every NaN is excluded from the sort and the per-axis quantile
is computed over the remaining values.
nansum→ TensorSum the tensor, treating NaN entries as zero.
negative→ TensorElement-wise negation.
numel→ intReturn the total number of elements in a tensor.
polar→ TensorBuild a complex tensor from polar coordinates (magnitude, phase).
positive→ TensorElement-wise identity — returns the input unchanged.
promote_types→ DTypeCompute the joint promotion of two dtypes.
quantile→ TensorCompute the q-th quantile of input.
renorm→ TensorRescale each sub-tensor along dim whose p-norm exceeds maxnorm.
resolve_conj→ TensorMaterialise any pending lazy conjugation — no-op in Lucid.
resolve_neg→ TensorMaterialise any pending lazy negation — no-op in Lucid.
result_type→ DTypeCompute the dtype that a binary operation on the inputs would produce.
rot90→ TensorRotate a tensor by 90° in a chosen plane.
row_stack→ TensorStack tensors as rows — alias of lucid.vstack.
rsub→ TensorReverse subtraction: .
select→ TensorSlice input along dim at index, removing that dimension.
signbit→ TensorElement-wise sign-bit predicate.
sinc→ TensorNormalised sinc function with the standard removable singularity at 0.
stft→ TensorShort-time Fourier transform.
subtract→ TensorElement-wise subtraction with an optional scalar multiplier.
swapaxes→ TensorReturn input with axes axis0 and axis1 exchanged.
swapdims→ TensorSwap two named dimensions of a tensor.
t→ TensorShort-form transpose for tensors of rank at most 2.
take_along_dim→ TensorGather elements from input at positions indices along dim.
tensor_split→ list[Tensor]Split a tensor along dim, permitting unequal final-piece sizes.
trapezoid→ TensorIntegrate y along dim using the composite trapezoidal rule.
true_divide→ TensorElement-wise true (floating-point) division.
vdot→ TensorVector dot product (complex-conjugating on the first argument).
view_as_complex→ TensorReinterpret a real tensor with a trailing pair axis as a complex tensor.
view_as_real→ TensorReinterpret a complex tensor as a real tensor with a trailing pair axis.
vsplit→ list[Tensor]Split a tensor along its first (vertical) axis.
xlogy→ TensorCompute with the convention .
logdet→ TensorLog-determinant of a square matrix (or batch).
copysign→ TensorElement-wise sign transplant: magnitudes from input, signs from other.
digamma→ TensorDigamma function .
erfc→ TensorComplementary error function .
frexp→ tuple[Tensor, Tensor]Decompose input into mantissa m and exponent e such that
input = m * 2**e with |m| in [0.5, 1) (or m == 0).
gcd→ TensorElement-wise greatest common divisor for integer tensors.
i0→ TensorModified Bessel function of the first kind, order 0: .
lcm→ TensorElement-wise least common multiple for integer tensors.
ldexp→ TensorElement-wise .
lgamma→ TensorNatural log of the gamma function .
argwhere→ TensorReturn the coordinates of every non-zero element in input.
index_add→ TensorReturn input with alpha * source accumulated at index positions along dim.
index_copy→ TensorReturn a copy of input with slices at index replaced by source.
index_fill→ TensorReturn a copy of input with positions index along dim set to value.
index_put→ TensorOut-of-place advanced-indexing write.
index_put_→ TensorIn-place variant of index_put: writes into input's storage.
masked_scatter→ TensorFill the positions where mask holds with source's leading elements.
put→ TensorWrite source into input at the flat positions in index.
scatter_reduce→ TensorReduce src into input along dim at positions given by index.
allclose→ boolReturn True iff every element pair is close within tolerance.
amax→ TensorReduce input to per-slice maxima along dim — values only.
amin→ TensorReduce input to per-slice minima along dim — values only.
count_nonzero→ TensorCount non-zero elements along dim (or whole tensor when None).
combinations→ TensorAll r-length combinations of the elements of a 1-D input.
diag_embed→ TensorEmbed the last dimension of input as the diagonal of a new matrix.
tril_indices→ TensorIndices of the lower-triangular part of an (row, col) matrix.
triu_indices→ TensorIndices of the upper-triangular part of an (row, col) matrix.
bincount→ TensorCount occurrences of each integer value in input.
cdist→ TensorPairwise distance matrix between rows of x1 and x2.
corrcoef→ TensorPearson correlation-coefficient matrix.
cov→ TensorCovariance matrix of input.
histogram→ tuple of TensorCompute a 1-D histogram of input values.
histogram2d→ tuple of TensorJoint 2-D histogram of paired observations (x[i], y[i]).
histogramdd→ tupleN-dimensional histogram for arbitrary sample dimension.
multinomial→ TensorDraw num_samples indices from the categorical distribution defined by input.
poisson→ TensorSample element-wise from .
std_mean→ tuple of TensorReturn (std, mean) along dim in a single call.
var_mean→ tuple of TensorReturn (var, mean) along dim in a single call.