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/10/31 22:17:09 UTC

[GitHub] [incubator-mxnet] leezu commented on a change in pull request #16680: Implement Initializer.__eq__

leezu commented on a change in pull request #16680: Implement Initializer.__eq__
URL: https://github.com/apache/incubator-mxnet/pull/16680#discussion_r341388610
 
 

 ##########
 File path: python/mxnet/initializer.py
 ##########
 @@ -268,6 +268,10 @@ def _init_default(self, name, _):
             '"weight", "bias", "gamma" (1.0), and "beta" (0.0).' \
             'Please use mx.sym.Variable(init=mx.init.*) to set initialization pattern' % name)
 
+    def __eq__(self, other):
+        if not isinstance(other, Initializer):
+            return NotImplemented
+        return type(self) == type(other) and self._kwargs == other._kwargs
 
 Review comment:
   We can say it behaves correctly, if we expect `Constant(10.0) != Constant(np.array([10.0])`.

----------------------------------------------------------------
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