Pointwise operators #
PyTorch's core ATen vocabulary contains many pointwise operators, such as neg, div, pow,
rsqrt, erf, gelu and clamp_min. They share one shape rule: every operand and the result
have the same shape. Graphs therefore represent them as one operation family whose operator is
data, and PointwiseOp lists the operators of that family together with the static attributes
PyTorch passes them, such as the rounding mode of torch.div.
What an operator computes depends on the scalar type. A scalar dictionary lists the operators it
implements in Context.pointwise, as a PointwiseTable. Each entry is a total function that
returns the result or a reason why the scalar type has none; over the reals, for example, a zero
divisor has no quotient. An operator missing from a table is unsupported for that scalar type, and
evaluators report it instead of approximating it.
References #
Rounding applied to a quotient, as the rounding_mode argument of torch.div.
- none : DivRounding
True division, PyTorch's
rounding_mode=None. - trunc : DivRounding
Round the quotient toward zero,
rounding_mode="trunc". - floor : DivRounding
Round the quotient toward negative infinity,
rounding_mode="floor".
Instances For
The formula selected by the approximate argument of torch.nn.functional.gelu.
- none : GeluApproximation
x Φ(x), with the standard normal distribution functionΦwritten througherf. - tanh : GeluApproximation
The tanh approximation
0.5 x (1 + tanh (√(2 / π) (x + 0.044715 x³))).
Instances For
Pointwise operators represented by the graph family NN.IR.OpKind.pointwise.
- neg : PointwiseOp
Negation,
torch.neg. - rsqrt : PointwiseOp
Reciprocal square root,
torch.rsqrt. - erf : PointwiseOp
Gauss error function,
torch.erf. - gelu
(approximate : GeluApproximation)
: PointwiseOp
Gaussian error linear unit,
torch.nn.functional.gelu. - div
(rounding : DivRounding)
: PointwiseOp
Division with an optional rounding of the quotient,
torch.div. - pow : PointwiseOp
Power with a tensor exponent,
torch.pow. - clampMin : PointwiseOp
Lower bound with a scalar bound,
torch.clamp_min: the bound where the operand is below it, and a NaN where either is one.
Instances For
Instances For
Every operator takes at least one operand.
Short operator name without attributes, for grouping diagnostics.
Instances For
Operator name with its attribute, for diagnostics. Artifact codecs define their own spelling.
Instances For
Every operator with every attribute value, in declaration order.
Instances For
A meaning with one operand.
Instances For
A meaning with two operands, in order.
Instances For
The pointwise operators a scalar type implements, each with its meaning.
Instances For
PyTorch's flooring division, c10::div_floor_floating, over the operations it uses.
fmod is C's truncating remainder, floor rounds toward negative infinity, and signedZero q
is zero with the sign of q. A zero divisor returns the quotient itself. Otherwise the remainder
corrects the quotient, as Python's // does, and the final comparison with half repairs a
quotient that rounded across an integer. A binary format runs this schedule with its rounded
operations; over the reals it computes ⌊a / b⌋.