NF Shape Operators #
Approximation lemmas for filling, replication, broadcasting, and Boolean masking in the rounded-real NF model. Copied entries retain their error budgets; masked entries are exactly zero. None of these operations introduces arithmetic rounding.
PyTorch correspondence / citations #
Related PyTorch shape operations: 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.
(1 : R) is NF.ofReal 1, so the scalar bound is the generic approx_ofReal_nf.
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: each output entry copies an input.
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.