[GitHub] piiswrong commented on a change in pull request #9790: make array.reshape compatible with numpy

2018-02-17 Thread GitBox
piiswrong commented on a change in pull request #9790: make array.reshape 
compatible with numpy
URL: https://github.com/apache/incubator-mxnet/pull/9790#discussion_r168931845
 
 

 ##
 File path: python/mxnet/ndarray/ndarray.py
 ##
 @@ -968,6 +973,17 @@ def reshape(self, shape):
 array([[-1., -1., -1.],
[-1., -1., -1.]], dtype=float32)
 """
+if len(shape) == 1 and isinstance(shape[0], (list, tuple)):
+shape = shape[0]
+elif not shape:
+for key, value in kwargs.items():
 
 Review comment:
   This is slow. Use test for len(kwargs) == 1, then kwargs.get('shape', None)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] piiswrong commented on a change in pull request #9790: make array.reshape compatible with numpy

2018-02-15 Thread GitBox
piiswrong commented on a change in pull request #9790: make array.reshape 
compatible with numpy
URL: https://github.com/apache/incubator-mxnet/pull/9790#discussion_r168566146
 
 

 ##
 File path: python/mxnet/ndarray/ndarray.py
 ##
 @@ -968,6 +973,14 @@ def reshape(self, shape):
 array([[-1., -1., -1.],
[-1., -1., -1.]], dtype=float32)
 """
+if len(shape) == 1 and isinstance(shape[0], (list, tuple)):
+shape = shape[0]
+elif not len(shape):
+for key, value in kwargs.items():
 
 Review comment:
   no need to iterate. test for len(kwargs) == 1 and kwargs.get('shape', None) 
directly


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] piiswrong commented on a change in pull request #9790: make array.reshape compatible with numpy

2018-02-15 Thread GitBox
piiswrong commented on a change in pull request #9790: make array.reshape 
compatible with numpy
URL: https://github.com/apache/incubator-mxnet/pull/9790#discussion_r168565856
 
 

 ##
 File path: python/mxnet/ndarray/ndarray.py
 ##
 @@ -968,6 +973,14 @@ def reshape(self, shape):
 array([[-1., -1., -1.],
[-1., -1., -1.]], dtype=float32)
 """
+if len(shape) == 1 and isinstance(shape[0], (list, tuple)):
+shape = shape[0]
+elif not len(shape):
 
 Review comment:
   an error should be raised


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] piiswrong commented on a change in pull request #9790: make array.reshape compatible with numpy

2018-02-14 Thread GitBox
piiswrong commented on a change in pull request #9790: make array.reshape 
compatible with numpy
URL: https://github.com/apache/incubator-mxnet/pull/9790#discussion_r168293562
 
 

 ##
 File path: python/mxnet/ndarray/ndarray.py
 ##
 @@ -968,6 +973,14 @@ def reshape(self, shape):
 array([[-1., -1., -1.],
[-1., -1., -1.]], dtype=float32)
 """
+if len(shape) == 1 and isinstance(shape[0], (list, tuple)):
+shape = shape[0]
+elif not len(shape):
 
 Review comment:
   what happens for reshape(1, 2, shape=1)?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] piiswrong commented on a change in pull request #9790: make array.reshape compatible with numpy

2018-02-14 Thread GitBox
piiswrong commented on a change in pull request #9790: make array.reshape 
compatible with numpy
URL: https://github.com/apache/incubator-mxnet/pull/9790#discussion_r168293201
 
 

 ##
 File path: python/mxnet/ndarray/ndarray.py
 ##
 @@ -926,12 +926,12 @@ def _at(self, idx):
 self.handle, mx_uint(idx), ctypes.byref(handle)))
 return NDArray(handle=handle, writable=self.writable)
 
-def reshape(self, shape):
+def reshape(self, *shape, **kwargs):
 
 Review comment:
   (self, *args, shape=None)?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services