Search code examples
deep-learningmxnet

MXNet initialization error on label variable


When I call module.fit() I'm getting an error ValueError: Unknown initialization pattern for labelidx. The symbol "labelidx" is the name I'm using for my label data -- I didn't want to use softmax_label because I'm not using softmax output, but that seems to be the default for a lot of thigns. It seems to be trying to initialize labelidx as a parameter, which is a mistake. How can I tell it this is an input not a learned parameter?


Solution

  • I figured this out.

    When constructing the Module object, you need to tell it the names of the data (data_names) and labels (label_names). Each of these should be a list of string names. By default data_names=('data',), label_names=('softmax_label',), Otherwise it assumes everything else is learned parameters and will try to initialize them, leading to this error. Docs: http://mxnet.io/api/python/module.html#mxnet.module.module.Module

    So in my case it needs Module(label_names=('labelidx',), ...)