You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2022/07/15 15:52:45 UTC

[GitHub] [incubator-mxnet] matteosal opened a new issue, #21097: Wrong output from operator _npi_repeats?

matteosal opened a new issue, #21097:
URL: https://github.com/apache/incubator-mxnet/issues/21097

   ```
   import mxnet as mx
   
   data = mx.np.array([[5, 8, 7, 3, 4]])
   
   print("**************************** repeat with spec 3")
   print(mx.np.repeat(data, repeats=3, axis=1))
   
   json = '{\"nodes\":[{\"op\":\"null\",\"name\":\"in\",\"inputs\":[]},{\"op\":\"_npi_repeats\",\"name\":\"_npi_repeats9\",\"attrs\":{\"axis\":\"1\",\"repeats\":\"(3,3,3,3,3)\"},\"inputs\":[[0,0,0]]}],\"arg_nodes\":[0],\"heads\":[[1,0,0]]}'
   sym = mx.sym.fromjson(json)
   cached_op = mx.ndarray.CachedOp(sym)
   print("**************************** repeats with spec [3, 3, 3, 3, 3]")
   print(cached_op(data))
   
   json = '{\"nodes\":[{\"op\":\"null\",\"name\":\"in\",\"inputs\":[]},{\"op\":\"_npi_repeats\",\"name\":\"_npi_repeats9\",\"attrs\":{\"axis\":\"1\",\"repeats\":\"(2,4,3,4,2)\"},\"inputs\":[[0,0,0]]}],\"arg_nodes\":[0],\"heads\":[[1,0,0]]}'
   sym = mx.sym.fromjson(json)
   cached_op = mx.ndarray.CachedOp(sym)
   print("**************************** repeats with spec, [2, 4, 3, 4, 2]")
   print(cached_op(data))
   ```
   The output of the above script is:
   ```
   [17:47:50] /home/matteo/Git/mxnet-build/Build/Linux-x86-64/MKL/mxnet/src/storage/storage.cc:202: Using Pooled (Naive) StorageManager for CPU
   **************************** repeat with spec 3
   [[5. 5. 5. 8. 8. 8. 7. 7. 7. 3. 3. 3. 4. 4. 4.]]
   [17:47:50] /home/matteo/Git/mxnet-build/Build/Linux-x86-64/MKL/mxnet/src/nnvm/legacy_json_util.cc:211: Loading symbol saved by previous version v0.8.0. Attempting to upgrade...
   [17:47:50] /home/matteo/Git/mxnet-build/Build/Linux-x86-64/MKL/mxnet/src/nnvm/legacy_json_util.cc:220: Symbol successfully upgraded!
   **************************** repeats with spec [3, 3, 3, 3, 3]
   
   [[5. 8. 7. 3. 4. 5. 8. 7. 3. 4. 5. 8. 7. 3. 4.]]
   <NDArray 1x15 @cpu(0)>
   [17:47:50] /home/matteo/Git/mxnet-build/Build/Linux-x86-64/MKL/mxnet/src/nnvm/legacy_json_util.cc:211: Loading symbol saved by previous version v0.8.0. Attempting to upgrade...
   [17:47:50] /home/matteo/Git/mxnet-build/Build/Linux-x86-64/MKL/mxnet/src/nnvm/legacy_json_util.cc:220: Symbol successfully upgraded!
   **************************** repeats with spec, [2, 4, 3, 4, 2]
   
   [[5.0000000e+00 8.0000000e+00 7.0000000e+00 3.0000000e+00 4.0000000e+00
     5.0000000e+00 8.0000000e+00 7.0000000e+00 3.0000000e+00 4.0000000e+00
     0.0000000e+00 1.9618179e-44 0.0000000e+00 7.5563101e+31 7.0366695e+22]]
   <NDArray 1x15 @cpu(0)>
   ```
   
   I would expect the output of "repeats with spec [3, 3, 3, 3, 3]" to match "repeat with spec 3", and the output of repeats with spec, [2, 4, 3, 4, 2] to be `[[5, 5, 8, 8, 8, 8, 7, 7, 7, 3, 3, 3, 3, 4, 4]]`. Is `_npi_repeats` buggy?
   
   Side question: is there a way to access `_npi_repeats` without using `mx.sym.fromjson`?


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] bgawrych commented on issue #21097: Wrong output from operator _npi_repeats?

Posted by GitBox <gi...@apache.org>.
bgawrych commented on issue #21097:
URL: https://github.com/apache/incubator-mxnet/issues/21097#issuecomment-1186862384

   Hi @matteosal, it seems like calling directly npi_repeats with specific parameters is buggy, but calling it through API "np.repeat" work as expected - https://github.com/apache/incubator-mxnet/blob/cf15e0a478ea45166b2f397ff440e30601ea2ec4/python/mxnet/ndarray/numpy/_op.py#L4253
   
   
   
   


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] bgawrych closed issue #21097: Wrong output from operator _npi_repeats?

Posted by GitBox <gi...@apache.org>.
bgawrych closed issue #21097: Wrong output from operator _npi_repeats?
URL: https://github.com/apache/incubator-mxnet/issues/21097


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] Kacper-Pietkun commented on issue #21097: Wrong output from operator _npi_repeats?

Posted by GitBox <gi...@apache.org>.
Kacper-Pietkun commented on issue #21097:
URL: https://github.com/apache/incubator-mxnet/issues/21097#issuecomment-1212877978

   Fix is here: https://github.com/apache/incubator-mxnet/pull/21112


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org