smpawlowski opened a new issue #16093: mx.viz.print_summary doesn't report 
parameters for a symbol
URL: https://github.com/apache/incubator-mxnet/issues/16093
 
 
   ## Description
   mx.viz.print_summary reports zero parameters for a symbol that has 
parameters.
   
   ## Environment info (Required)
   Windows 10, python, mxnet 1.5.0
   
   ## Error Message:
   See example below that trains a network with 3 parameters. The parameters 
are correctly trained, but not reported by mx.viz.print_summary
   Output of the sample script below:
   Params before training: -------------------------------
   ({'x': 
   [0.5 0.5 0.5]
   <NDArray 3 @cpu(0)>}, {})
   Params after training: --------------------------------
   ({'x': 
   [ 1.5396947e-05 -1.8216294e-08  2.7031724e-08]
   <NDArray 3 @cpu(0)>}, {})
   
   mx.viz.print_summary reports Total params:0
   
   ## Minimum reproducible example
   ```
   import mxnet as mx
   
   ctx = mx.cpu(0)
   n = 100
   num_features = 3
   num_labels = 1
   
   inputs: mx.sym.Symbol = mx.sym.var('data')
   x: mx.sym.Symbol = mx.sym.var('x', init=mx.init.Constant(value=0.5), 
shape=(num_features,))
   out: mx.sym.Symbol = mx.sym.broadcast_mul(inputs, x)
   loss = mx.sym.LinearRegressionOutput(data=mx.sym.sum(mx.sym.abs(out), 1), 
label=mx.sym.var('softmax_label'))
   
   nd_iter = mx.io.NDArrayIter(data=mx.nd.random.normal(shape=(n, 
num_features)), label=mx.nd.zeros(shape=(n,)), batch_size=10)
   mod = mx.mod.Module(loss)
   mod.bind(data_shapes=nd_iter.provide_data,
            label_shapes=nd_iter.provide_label)
   mod.init_params()
   print('Params before training: -------------------------------')
   print(mod.get_params())
   mod.fit(train_data=nd_iter, num_epoch=100, force_init=False)
   print('Params after training: --------------------------------')
   print(mod.get_params())
   mx.viz.print_summary(symbol=out)
   ```
   
   ## Steps to reproduce
   Run script above
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to