Bug introduced in 11.2 and remains in 12.0.0
I just tried to import a net from mathemtica into pythons using MXNet. It works fine with the following manual.
However, as soon as I try to add a BatchNormalizationLayer to my net MXNets bind() function fails because the auxiliary states of the BatchNormlayer are not provided (MovingMean,MovingVar).
Mathematica code:
Export["~/batchnorm.json", foo = NetInitialize@BatchNormalizationLayer
["Input"-> {1, 2, 2}], "MXNet"]
Python code:
import mxnet as mx
import numpy as np
sym=mx.symbol.load('batchnorm.json')
nd=mx.nd.load('batchnorm.params')
#parse Input
inputND = mx.nd.array(np.array([[[[1,1],[2,2]]]]));
nd["Input"] = inputND
#bind NN
e = sym.bind(mx.cpu(), nd)
Above code generates the following error:
ValueError: Length of aux_states does not match the number of arguments
There appears to be no trace of the auxiliary layers in the params file and hence not in my nd variable. Am I missing something?
Best, Max
EDIT: The only workaround seems to be manual exporting of the auxiliary parameters. Which works. It would be nice if Mathematica would generate this file automatically.
State
. $\endgroup$ – partida Oct 17 '17 at 14:01ValueError: Length of aux_states does not match the number of arguments
$\endgroup$ – HyperGroups May 16 '18 at 11:17