NF Shape Operators #
NF (rounded) backend: approximation lemmas for shape-only tensor operators.
These operators do not perform arithmetic on scalars (they only permute/replicate entries), so
they preserve existing approxTensor error bounds.
Shape-only operations should not introduce extra rounding error. Their proofs are mostly transport/indexing arguments rather than numerical analysis.
PyTorch correspondence / citations #
These are the proof analogues of “view-like”/index-rearrangement ops in PyTorch which do not change floating-point values, only their arrangement: https://pytorch.org/docs/stable/generated/torch.reshape.html https://pytorch.org/docs/stable/generated/torch.Tensor.view.html https://pytorch.org/docs/stable/generated/torch.permute.html
Filling a tensor preserves a scalar approximation budget at every shape.
Although this fact is used heavily when constructing reverse-mode zero contexts, it is a shape fact rather than a backward-mode fact. Keeping it here also makes rounded constants available to normalization, attention, and quantization without importing the reverse-mode implementation.
A tensor filled with runtime one differs from exact one by at most one construction rounding.
Zero is exactly representable in every valid neural floating-point format.
Filling a tensor with one approximate scalar gives an approximation with the same tolerance.
Broadcasting a constant copies a value rather than computing with it, so no new rounding occurs and
the error stays put. That is why eps appears unchanged on both sides.
Broadcasting preserves the approximation tolerance, for the same reason replicate does: every
output entry is a copy of some input entry, so it inherits that entry's error and nothing more.
Applying the same Boolean mask to exact and rounded tensors preserves the error budget.
Masking is a selection operation, not arithmetic: allowed entries are unchanged and blocked entries are exactly zero in both semantics. In particular, this theorem does not model a finite negative sentinel and introduces no extra ULP term.