anirudhacharya commented on a change in pull request #15150: Fix dumps for
Constant initializer
URL: https://github.com/apache/incubator-mxnet/pull/15150#discussion_r291382724
##########
File path: python/mxnet/initializer.py
##########
@@ -464,6 +464,11 @@ def __init__(self, value):
def _init_weight(self, _, arr):
arr[:] = self.value
+ def dumps(self):
+ if not np.isscalar(self._kwargs['value']):
+ self._kwargs['value'] = self._kwargs['value'].asnumpy().tolist()
Review comment:
if the argument passed to the `constant initializer` is of type
`numpy.ndarray` then the `asnumpy` call will fail here. for instance a usage
such as this -
```python
sym_var = mx.sym.var('test', init=mx.init.Constant(np.ones((2,3))))
```
----------------------------------------------------------------
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