You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/06/16 23:35:02 UTC

[GitHub] [incubator-mxnet] szha commented on a change in pull request #15150: Fix dumps for Constant initializer

szha commented on a change in pull request #15150: Fix dumps for Constant initializer
URL: https://github.com/apache/incubator-mxnet/pull/15150#discussion_r294105563
 
 

 ##########
 File path: python/mxnet/initializer.py
 ##########
 @@ -464,6 +464,12 @@ def __init__(self, value):
     def _init_weight(self, _, arr):
         arr[:] = self.value
 
+    def dumps(self):
+        val = self._kwargs['value']
+        if not np.isscalar(val):
+            self._kwargs['value'] = val.tolist() if type(val).__module__ == 'numpy' else val.asnumpy().tolist()
 
 Review comment:
   why not use isinstance?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services