You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[tmva][sofie] Add InstanceNormalization operator for ONNX inference
Add ROperator_InstanceNormalization, implementing the ONNX
InstanceNormalization operator: for every sample and channel of an input
of shape (N, C, D1, ..., Dn), the elements over the spatial dimensions
are normalized to zero mean and unit variance, then scaled and shifted
with the per-channel scale and B tensors.
The operator is registered in RModelParser_ONNX through a new
ParseInstanceNormalization.cxx, following the one-file-per-operator
convention of the other operators. Only static shapes and float inputs
are supported; other input types are rejected with an error, as in
ParseLayerNormalization.
Three models are added to generate_input_models.py, with their expected
outputs computed by onnx's ReferenceEvaluator:
* InstanceNormalization, of shape (2, 3, 4, 5) with asymmetric scale and
bias, so that a wrong per-instance offset or a scale indexed on the
wrong axis does not cancel out,
* InstanceNormalization3d, of rank 3, where the spatial size is not a
product of several dimensions,
* InstanceNormalizationEpsilon, with a non-default epsilon of 0.01 and a
small-variance input, so that the attribute dominates the result.
Two mutations of the operator were checked to be caught by these tests:
ignoring the epsilon attribute fails InstanceNormalizationEpsilon, and
indexing the scale by the wrong axis fails the other two.
🤖 Done with the help of AI.
0 commit comments