Meanings of pointwise operators #
Spec.PointwiseOp.meaning gives every operator of Spec.PointwiseOp its meaning at a scalar type
with a Context. Negation is the dictionary's negation. The tanh GELU is the dictionary's entry
when it has one and Activation.Math.geluSpec otherwise, so every dictionary supports both.
FloatLib binary arithmetic has an entry that follows PyTorch's kernel step by step. The exact
GELU is x * 0.5 * (1 + erf (x * √½)), PyTorch's order of operations, and needs the dictionary's
erf. clamp_min is clampBelow, a comparison and a choice, so every dictionary supports it. The
remaining operators are the dictionary's Context.pointwise entries; a dictionary that omits one
leaves it unsupported.
References #
- PyTorch GELU kernels,
aten/src/ATen/native/cpu/Gelu.h:https://github.com/pytorch/pytorch - Dan Hendrycks and Kevin Gimpel, "Gaussian Error Linear Units (GELUs)", arXiv:1606.08415
PyTorch's clamp_min with a scalar bound: bound where x < bound, otherwise x, and the bound
where it is a NaN, which bound == bound detects. A NaN x is returned, and the sign of a zero x
is kept: eager PyTorch 2.13 returns -0.0 for clamp_min(-0.0, 0) and a NaN for a NaN bound, in
binary32, binary64, bfloat16 and binary16 and in both of its loops. Over an ordered field this is
max x bound.
Instances For
The meaning of a pointwise operator at a scalar type, or none where the type lacks one.
Instances For
Negation is supported by every dictionary.
A dictionary without a tanh GELU entry gives it the meaning Activation.Math.geluSpec.