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-unsubscr...@mxnet.apache.org.apache.org

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


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

Reply via email to