Problem about collect_params().save()


#1

When I use “net.collect_params(‘sequential2_conv6_weight|sequential2_conv6_bias|sequential2_batchnorm6_gamma|’
‘sequential2_batchnorm6_beta|sequential2_batchnorm6_running_mean|’
‘sequential2_batchnorm6_running_var|sequential2_dense0_weight|sequential2_dense0_bias|’
‘sequential2_dense1_weight|sequential2_dense1_bias’).save(filename,strip_prefix=net.prefix)”

to save parameters, I can’t load them. Because it says that ndarray.load(filename) is a list rather than a dict.

I wonder what’s wrong.


#2

Could you post the exact code that you are trying to write?
what you can do is

from mxnet import nd
net.collect_params().save('myparams.params', strip_prefix=net.prefix)
params = nd.load('myparams.params')

params is a dictionary where each key is a parameter name and each value is an ndarray containing the value of the parameters. Hope that helps