mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

how to initialize the weights

Open sofiawu opened this issue 10 years ago • 6 comments

I want to init the fc layer weights alone , how to do ?

sofiawu avatar Dec 11 '15 08:12 sofiawu

You can pass pre-initialized weight into Feedforward as in

https://github.com/dmlc/mxnet/blob/master/python/mxnet/model.py#L479

The Feedforward is a thin wrapper of NDArray and initialization happens here https://github.com/dmlc/mxnet/blob/master/python/mxnet/model.py#L540 You can do arbitrary operations you like to initialize the ndarrays like in this function. Either by reusing initializer class, or do your own initialization

tqchen avatar Dec 11 '15 15:12 tqchen

this issue help a lot

qiaohaijun avatar Dec 12 '15 14:12 qiaohaijun

Hi @qiaohaijun, I am extremely new to mxnet, could you please shed some more light regarding the solution. May I know what exact changes do I need to make, to change weight initialization method of one particular layers, along with changing its mean and std, like we do in Caffe weight_filler { type: "gaussian" mean: 0.0 std: 0.01 }

Thanks, Gaurav

gaush123 avatar Apr 05 '16 10:04 gaush123

Hi @gaush123 , I wondered if your problem has solved. Could you please shall your solution with me?

FishYuLi avatar May 11 '16 02:05 FishYuLi

No, I didn't exactly solve this issue.

gaush123 avatar May 11 '16 05:05 gaush123

@gaush123 @MissFishLi Check out the initializers: http://mxnet.readthedocs.io/en/latest/packages/python/model.html#module-mxnet.initializer. Probably the Load or Mixed will suit your needs.

II-Matto avatar May 12 '16 07:05 II-Matto