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/01/02 21:05:19 UTC

[GitHub] ylfdq1118 opened a new issue #13760: nd.slice does not return empty tensor when begin=end

ylfdq1118 opened a new issue #13760: nd.slice does not return empty tensor when begin=end
URL: https://github.com/apache/incubator-mxnet/issues/13760
 
 
   ## Description
   For `mxnet.ndarray.slice(data, begin, end)`, if `begin=end`, it does not return an empty tensor. Instead, it returns a tensor with the same shape as `data`.
   
   ## Environment info (Required)
   ----------Python Info----------
   Version      : 3.5.2
   Compiler     : GCC 5.4.0 20160609
   Build        : ('default', 'Nov 23 2017 16:37:01')
   Arch         : ('64bit', 'ELF')
   ------------Pip Info-----------
   Version      : 18.1
   Directory    : /home/lingfan/.local/pythonenv/dgl/lib/python3.5/site-packages/pip
   ----------MXNet Info-----------
   Version      : 1.5.0
   Directory    : /home/lingfan/.local/pythonenv/dgl/lib/python3.5/site-packages/mxnet
   Commit Hash   : 812b06a4f29e84a068767b56afdbfd0e1408fcaf
   ----------System Info----------
   Platform     : Linux-4.4.0-1070-aws-x86_64-with-Ubuntu-16.04-xenial
   system       : Linux
   node         : ip-172-31-86-85
   release      : 4.4.0-1070-aws
   version      : #80-Ubuntu SMP Thu Oct 4 13:56:07 UTC 2018
   ----------Hardware Info----------
   machine      : x86_64
   processor    : x86_64
   Architecture:          x86_64
   CPU op-mode(s):        32-bit, 64-bit
   Byte Order:            Little Endian
   CPU(s):                8
   On-line CPU(s) list:   0-7
   Thread(s) per core:    2
   Core(s) per socket:    4
   Socket(s):             1
   NUMA node(s):          1
   Vendor ID:             GenuineIntel
   CPU family:            6
   Model:                 79
   Model name:            Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
   Stepping:              1
   CPU MHz:               2701.332
   CPU max MHz:           3000.0000
   CPU min MHz:           1200.0000
   BogoMIPS:              4600.18
   Hypervisor vendor:     Xen
   Virtualization type:   full
   L1d cache:             32K
   L1i cache:             32K
   L2 cache:              256K
   L3 cache:              46080K
   NUMA node0 CPU(s):     0-7
   Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single kaiser fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx xsaveopt
   ----------Network Test----------
   Setting timeout: 10
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0039 sec, LOAD: 0.0274 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.2937 sec, LOAD: 0.5235 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0060 sec, LOAD: 0.0966 sec.
   Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0047 sec, LOAD: 0.1268 sec.
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0015 sec, LOAD: 0.4607 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0451 sec, LOAD: 0.3926 sec.
   
   ## Minimum reproducible example
   ```
   >>> import mxnet.ndarray as nd
   >>> a = nd.normal(shape=(4, 3))
   >>> a
   [[ 2.2122064   0.7740038   1.0434405 ]
    [ 1.1839255   1.8917114  -1.2347414 ]
    [-1.771029   -0.45138445  0.57938355]
    [-1.856082   -1.9768796  -0.20801921]]
   <NDArray 4x3 @cpu(0)>
   >>> nd.slice(a, begin=0, end=0)
   [[ 2.2122064   0.7740038   1.0434405 ]
    [ 1.1839255   1.8917114  -1.2347414 ]
    [-1.771029   -0.45138445  0.57938355]
    [-1.856082   -1.9768796  -0.20801921]]
   <NDArray 4x3 @cpu(0)>
   >>> nd.slice(a, begin=2, end=2)
   [[-1.7710290e+00 -4.5138445e-01  5.7938355e-01]
    [-1.8560820e+00 -1.9768796e+00 -2.0801921e-01]
    [ 0.0000000e+00  0.0000000e+00  1.8637270e-43]
    [ 0.0000000e+00  3.8537848e-34  4.5786026e-41]]
   <NDArray 4x3 @cpu(0)>
   ```
   
   @zheng-da @jermainewang 
   
   

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


With regards,
Apache Git Services