MeanVarianceNormalization#
Domain:
ai.onnxSince version: 13
A MeanVarianceNormalization Function: Perform mean variance normalization
on the input tensor X using formula: (X-EX)/sqrt(E(X-EX)^2)
Inputs
X (T): Input tensor
Outputs
Y (T): Output tensor
Attributes
axes (int[]): A list of integers, along which to reduce. The default is to calculate along axes [0,2,3] for calculating mean and variance along each channel. Two variables with the same C-coordinate are associated with the same mean and variance.
Type Constraints
T: Constrain input and output types to all numeric tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16).
Examples#
test_cc_mvn
Node:
MeanVarianceNormalization(x) -> (y)
Inputs:
x: shape=(3, 3, 3, 1, 2), dtype=float32
[[[[[-1. , 0. ]],
[[ 0.5, 1. ]],
[[ 2. , 3. ]]],
[[[ 4. , 5. ]],
[[ 6. , 7. ]],
[[ 8. , 9. ]]],
[[[10. , 11. ]],
[[12. , 13. ]],
[[14. , 15. ]]]],
[[[[16. , 17. ]],
[[18. , 19. ]],
[[20. , 21. ]]],
[[[22. , 23. ]],
[[24. , 25. ]],
[[26. , 27. ]]],
[[[28. , 29. ]],
[[30. , 31. ]],
[[32. , 33. ]]]],
[[[[34. , 35. ]],
[[36. , 37. ]],
[[38. , 39. ]]],
[[[40. , 41. ]],
[[42. , 43. ]],
[[44. , 45. ]]],
[[[46. , 47. ]],
[[48. , 49. ]],
[[50. , 51. ]]]]]
Outputs:
y: shape=(3, 3, 3, 1, 2), dtype=float32
[[[[[-1.3153384 , -1.3054299 ]],
[[-1.2123989 , -1.2371227 ]],
[[-1.1094594 , -1.1005079 ]]],
[[[-1.3525045 , -1.3525045 ]],
[[-1.217254 , -1.217254 ]],
[[-1.0820036 , -1.0820036 ]]],
[[[-1.3525045 , -1.3525045 ]],
[[-1.217254 , -1.217254 ]],
[[-1.0820036 , -1.0820036 ]]]],
[[[[-0.14869043, -0.14420448]],
[[-0.01143773, -0.00758971]],
[[ 0.12581497, 0.12902506]]],
[[[-0.13525045, -0.13525045]],
[[ 0. , 0. ]],
[[ 0.13525045, 0.13525045]]],
[[[-0.13525045, -0.13525045]],
[[ 0. , 0. ]],
[[ 0.13525045, 0.13525045]]]],
[[[[ 1.0865839 , 1.0853285 ]],
[[ 1.2238367 , 1.2219431 ]],
[[ 1.3610893 , 1.3585579 ]]],
[[[ 1.0820036 , 1.0820036 ]],
[[ 1.217254 , 1.217254 ]],
[[ 1.3525045 , 1.3525045 ]]],
[[[ 1.0820036 , 1.0820036 ]],
[[ 1.217254 , 1.217254 ]],
[[ 1.3525045 , 1.3525045 ]]]]]
test_cc_mvn_explicit_axes
Node:
MeanVarianceNormalization(x) -> (y)
Attributes:
axes = [0, 2, 3]
Inputs:
x: shape=(3, 3, 3, 1, 2), dtype=float32
[[[[[-2., -1.]],
[[ 0., 1.]],
[[ 2., 3.]]],
[[[ 4., 5.]],
[[ 6., 7.]],
[[ 8., 9.]]],
[[[10., 11.]],
[[12., 13.]],
[[14., 15.]]]],
[[[[16., 17.]],
[[18., 19.]],
[[20., 21.]]],
[[[22., 23.]],
[[24., 25.]],
[[26., 27.]]],
[[[28., 29.]],
[[30., 31.]],
[[32., 33.]]]],
[[[[34., 35.]],
[[36., 37.]],
[[38., 39.]]],
[[[40., 41.]],
[[42., 43.]],
[[44., 45.]]],
[[[46., 47.]],
[[48., 49.]],
[[50., 51.]]]]]
Outputs:
y: shape=(3, 3, 3, 1, 2), dtype=float32
[[[[[-1.3525045 , -1.3525045 ]],
[[-1.217254 , -1.217254 ]],
[[-1.0820036 , -1.0820036 ]]],
[[[-1.3525045 , -1.3525045 ]],
[[-1.217254 , -1.217254 ]],
[[-1.0820036 , -1.0820036 ]]],
[[[-1.3525045 , -1.3525045 ]],
[[-1.217254 , -1.217254 ]],
[[-1.0820036 , -1.0820036 ]]]],
[[[[-0.13525045, -0.13525045]],
[[ 0. , 0. ]],
[[ 0.13525045, 0.13525045]]],
[[[-0.13525045, -0.13525045]],
[[ 0. , 0. ]],
[[ 0.13525045, 0.13525045]]],
[[[-0.13525045, -0.13525045]],
[[ 0. , 0. ]],
[[ 0.13525045, 0.13525045]]]],
[[[[ 1.0820036 , 1.0820036 ]],
[[ 1.217254 , 1.217254 ]],
[[ 1.3525045 , 1.3525045 ]]],
[[[ 1.0820036 , 1.0820036 ]],
[[ 1.217254 , 1.217254 ]],
[[ 1.3525045 , 1.3525045 ]]],
[[[ 1.0820036 , 1.0820036 ]],
[[ 1.217254 , 1.217254 ]],
[[ 1.3525045 , 1.3525045 ]]]]]
Differences with previous version (9)#
SchemaDiff: MeanVarianceNormalization (domain 'ai.onnx')
old version: 9
new version: 13
breaking: no
Type constraints:
changed ‘T’: added types: [‘tensor(bfloat16)’]