module

ops

158 members
lucid.ops

Functions

fnnegTensor

Element-wise negation.

fnabsTensor
fnsignTensor

Element-wise sign function.

fnexpTensor

Element-wise natural exponential.

fnlogTensor

Element-wise natural logarithm.

fnlog2Tensor

Element-wise base-2 logarithm.

fnsqrtTensor

Element-wise square root.

fnsquareTensor

Element-wise square.

fnreciprocalTensor

Element-wise multiplicative inverse.

fnfloorTensor

Element-wise floor (round toward $-\infty$).

fnceilTensor

Element-wise ceiling (round toward $+\infty$).

fnroundTensor
fnsinTensor

Element-wise sine (input in radians).

fncosTensor

Element-wise cosine (input in radians).

fntanTensor

Element-wise tangent (input in radians).

fnarcsinTensor

Element-wise inverse sine in radians.

fnarccosTensor

Element-wise inverse cosine in radians.

fnarctanTensor

Element-wise inverse tangent in radians.

fnsinhTensor

Element-wise hyperbolic sine.

fncoshTensor

Element-wise hyperbolic cosine.

fntanhTensor

Element-wise hyperbolic tangent.

fnreluTensor

Element-wise rectified linear unit.

fnsigmoidTensor

Element-wise logistic sigmoid.

fnravelTensor
fncontiguousTensor

Return a tensor with C-contiguous (row-major) memory layout.

fnaddTensor

Element-wise addition with broadcasting and dtype promotion.

fnsubTensor

Element-wise subtraction with broadcasting and dtype promotion.

fnmulTensor

Element-wise multiplication (Hadamard product) with broadcasting.

fndivTensor

Element-wise true division with broadcasting and dtype promotion.

fnpowTensor
fnmaximumTensor

Element-wise maximum with broadcasting.

fnminimumTensor

Element-wise minimum with broadcasting.

fnmatmulTensor

Matrix product with full broadcasting semantics.

fncumsumTensor

Return the cumulative sum of elements along `dim`.

fncumprodTensor

Return the cumulative product of elements along `dim`.

fncummaxTensor
fncumminTensor
fnerfTensor
fnerfinvTensor
fntraceTensor

Return the sum of the diagonal entries of a 2-D tensor.

fnreshapeTensor

Reshape a tensor to `shape`, returning a view when possible.

fnunsqueezeTensor

Insert a new size-1 dimension at position `dim`.

fnflattenTensor

Collapse a contiguous range of dimensions into a single dim.

fnpermuteTensor

Return a view with dimensions rearranged.

fntransposeTensor

Swap the last two dimensions of `input`.

fnbroadcast_toTensor

Broadcast a tensor to a target shape as a *view*.

fnexpandTensor

Return a view with singleton dimensions broadcast to new sizes.

fntileTensor

Construct a tensor by repeating `input` `reps` times per axis.

fnflipTensor

Reverse the order of elements along the specified `dims`.

fnfliplrTensor

Flip a 2-D-or-higher tensor left-to-right (along axis 1).

fnflipudTensor

Flip a 1-D-or-higher tensor upside-down (along axis 0).

fnrollTensor

Cyclically shift the elements of `input` along `dims`.

fntrilTensor

Return the lower-triangular part of a 2-D-or-higher tensor.

fntriuTensor

Return the upper-triangular part of a 2-D-or-higher tensor.

fnpadTensor

Pad a tensor with the specified border widths.

fngatherTensor

Gather values along `dim` according to `indices`.

fnsorttuple of (Tensor, Tensor)

Sort `input` along `dim` in ascending order and return values + indices.

fnargsortTensor

Return the indices that would sort `input` along `dim`.

fnnonzeroTensor

Return the indices of all non-zero (or True) elements.

fnuniqueTensor

Return the sorted unique elements of `input`.

fntopktuple of (Tensor, Tensor)

Return the `k` largest values along `dim` and their indices.

fndiagonalTensor

Extract a (off-)diagonal from each matrix in a batched input.

fnequalTensor

Element-wise equality predicate.

fnnot_equalTensor

Element-wise inequality predicate.

fngreaterTensor

Element-wise strict greater-than predicate.

fngreater_equalTensor

Element-wise greater-than-or-equal predicate.

fnlessTensor

Element-wise strict less-than predicate.

fnless_equalTensor

Element-wise less-than-or-equal predicate.

fnwhereTensor

Elementwise selection between `x` and `y` based on `cond`.

fnmasked_fillTensor

Return `input` with positions where `mask` is True set to `value`.

fncatTensor

Concatenate tensors along an existing dimension.

fnstackTensor

Stack tensors along a new dimension.

fnhstackTensor

Stack tensors horizontally (column-wise).

fnvstackTensor

Stack tensors vertically (row-wise).

fnchunklist of Tensor

Split a tensor into `chunks` roughly equal pieces along `dim`.

fnunbindtuple of Tensor

Remove `dim` and return a tuple of views along it.

fnrsqrtTensor

Element-wise reciprocal square root.

fnanyTensor
fnallTensor
fnclipTensor

Element-wise clamping to a closed interval.

fnisinfTensor

Element-wise IEEE 754 infinity check.

fnisnanTensor

Element-wise NaN check.

fnisfiniteTensor

Element-wise IEEE 754 finiteness check.

fnnan_to_numTensor

Replace NaN, positive and negative infinity entries with finite values.

fndetachTensor

Return a tensor that shares data but is detached from the autograd graph.

fncloneTensor

Return a deep copy of `input` with its own storage.

fnclampTensor

Element-wise clamping to a closed interval.

fnscatter_addTensor

Accumulate `src` into `input` along `dim` at positions `index`.

fnlog10Tensor

Element-wise base-10 logarithm.

fnlog1pTensor

Element-wise natural logarithm of `1 + x`.

fnexp2Tensor

Element-wise base-2 exponential.

fntruncTensor

Element-wise truncation toward zero.

fnfracTensor

Element-wise fractional part.

fnatan2Tensor

Element-wise quadrant-aware inverse tangent.

fnfmodTensor

Element-wise C-style floating-point remainder.

fnremainderTensor

Element-wise Python-style modulo.

fnhypotTensor

Element-wise Euclidean norm of two operands, computed in a numerically stable way.

fnlogaddexpTensor

Element-wise log-sum-exp of two operands.

fnnextafterTensor

Element-wise IEEE 754 next representable floating-point value.

fnlogsumexpTensor

Compute the numerically stable log-sum-exp along `dim`.

fnmmTensor

Strict 2-D matrix multiplication.

fnbmmTensor

Batched matrix multiplication.

fnkronTensor

Kronecker product of two tensors.

fnlogical_andTensor

Element-wise logical AND.

fnlogical_orTensor

Element-wise logical OR.

fnlogical_xorTensor

Element-wise logical exclusive-OR.

fnlogical_notTensor

Element-wise logical NOT.

fntakeTensor

Return elements of `input` at the given flat `indices`.

fnindex_selectTensor

Select slices of `input` along `dim` given `index`.

fnnarrowTensor

Return a contiguous slice of `input` along `dim`.

fnscatterTensor

Write `src` into `base_impl` along `dim` at positions `index`.

fnkthvaluetuple of (Tensor, Tensor)

Return the `k`-th smallest value along `dim` and its index.

fnmovedimTensor

Move one or more dimensions to new positions.

fnunflattenTensor

Inverse of `flatten` — split a single dim into a tuple of dims.

fnhistcTensor

Compute a histogram of `input` with `bins` equally-spaced bins.

fncartesian_prodTensor

Return the Cartesian product of the given 1-D tensors.

fnsearchsortedTensor

Find insertion points to maintain order in a sorted sequence.

fnbucketizeTensor

Return the bucket index of each element of `values` in `boundaries`.

fneqTensor

Element-wise equality predicate.

fnneTensor

Element-wise inequality predicate.

fnltTensor

Element-wise strict less-than predicate.

fnleTensor

Element-wise less-than-or-equal predicate.

fngtTensor

Element-wise strict greater-than predicate.

fngeTensor

Element-wise greater-than-or-equal predicate.

fnasinTensor

Element-wise inverse sine in radians.

fnacosTensor

Element-wise inverse cosine in radians.

fnatanTensor

Element-wise inverse tangent in radians.

fnbitwise_notTensor

Element-wise bitwise NOT.

fnbitwise_andTensor

Element-wise bitwise AND.

fnbitwise_orTensor

Element-wise bitwise OR.

fnbitwise_xorTensor

Element-wise bitwise XOR.

fnbitwise_left_shiftTensor

Element-wise bitwise left shift.

fnbitwise_right_shiftTensor

Element-wise bitwise right shift.

fnmasked_selectTensor

Return a 1-D tensor of elements where `mask` is True.

fniscloseTensor

Element-wise approximate equality with absolute and relative tolerance.

fnviewTensor

Return a view of `input` with a different shape.

fnconcatTensor

Alias for `cat`.

fnrealTensor

Real part of a complex tensor.

fnimagTensor

Imaginary part of a complex tensor.

fncomplexTensor
fnconjTensor

Element-wise complex conjugate.

fnsumTensor
fnmeanTensor

Compute the arithmetic mean along `dim`.

fnprodTensor

Compute the product of elements along `dim`.

fnmaxTensor
fnminTensor
fnvarTensor

Compute the sample variance along `dim`.

fnstdTensor

Compute the sample standard deviation along `dim`.

fnargmaxTensor

Return the indices of the maximum values along `dim`.

fnargminTensor

Return the indices of the minimum values along `dim`.

fnsqueezeTensor

Remove dimensions of size 1.

fnrepeatTensor

Tile a tensor along an existing dimension.

fnrepeat_interleaveTensor

Repeat each element of `x` `repeats` times along `dim`.

fnsplitlist of Tensor

Split a tensor into pieces of explicit sizes along `dim`.

fntensordotTensor

Generalized tensor contraction over arbitrary axes.

fnmeshgridlist of Tensor

Construct coordinate grids from 1-D coordinate vectors.

fndiffTensor

Compute the `n`-th order finite difference along an axis.

fnlerpTensor

Linearly interpolate between `input` and an endpoint with a weight.