Module Batch_norm.Stats
Running statistics: the exponential moving averages of per-feature batch mean and (population) variance maintained by training-mode apply and consumed by eval-mode apply. Not parameters — never differentiate or optimize them; thread them through the training loop as auxiliary state.
The type for running statistics with float dtype layout 'b, each of shape [| features |].
type t = Nx.float32_elt statsThe type for single-precision running statistics, the common case. The exponential moving average accumulates small increments, so keep statistics at float32 even when the parameters are half precision.
map f s is s with f applied to mean and var.
val map2 :
('a 'c. ('a, 'c) Nx.t -> ('a, 'c) Nx.t -> ('a, 'c) Nx.t) ->
'b stats ->
'b stats ->
'b statsmap2 f s s' combines s and s' leafwise with f.
iter f s applies f to mean and var, in that order.
astype dt s is s with mean and var cast to dt.
val names : 'b stats -> string listnames s is ["mean"; "var"], pairing leaves in traversal order (see Checkpoint.Named).