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 2018/03/19 05:42:01 UTC

[GitHub] anirudhacharya opened a new issue #10154: Symbol API's Concat operator inconsistent with NDArray API's Concat operator

anirudhacharya opened a new issue #10154: Symbol API's Concat operator inconsistent with NDArray API's Concat operator
URL: https://github.com/apache/incubator-mxnet/issues/10154
 
 
   ## Description
   The output of the concat operator is inconsistent with the example given in the documentation here - https://mxnet.incubator.apache.org/api/python/symbol/symbol.html#mxnet.symbol.concat. It is also inconsistent with the NDArray's concat operator - https://mxnet.incubator.apache.org/api/python/ndarray/ndarray.html#mxnet.ndarray.concat
   
   ## Environment info (Required)
   ```
   ----------Python Info----------
   ('Version      :', '2.7.14')
   ('Compiler     :', 'GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)')
   ('Build        :', ('default', 'Dec  7 2017 11:07:58'))
   ('Arch         :', ('64bit', ''))
   ------------Pip Info-----------
   ('Version      :', '9.0.1')
   ('Directory    :', '/Users/aanirud/anaconda2/envs/onnx/lib/python2.7/site-packages/pip')
   ----------MXNet Info-----------
   objc[96880]: Class CaptureDelegate is implemented in both /usr/local/opt/opencv/lib/libopencv_videoio.3.4.dylib (0x10df0b618) and /Users/aanirud/anaconda2/envs/onnx/lib/libopencv_videoio.3.3.dylib (0x117d395c8). One of the two will be used. Which one is undefined.
   objc[96880]: Class CVWindow is implemented in both /usr/local/opt/opencv/lib/libopencv_highgui.3.4.dylib (0x10dee51e8) and /Users/aanirud/anaconda2/envs/onnx/lib/libopencv_highgui.3.3.dylib (0x117d0e1e8). One of the two will be used. Which one is undefined.
   objc[96880]: Class CVView is implemented in both /usr/local/opt/opencv/lib/libopencv_highgui.3.4.dylib (0x10dee5210) and /Users/aanirud/anaconda2/envs/onnx/lib/libopencv_highgui.3.3.dylib (0x117d0e210). One of the two will be used. Which one is undefined.
   objc[96880]: Class CVSlider is implemented in both /usr/local/opt/opencv/lib/libopencv_highgui.3.4.dylib (0x10dee5238) and /Users/aanirud/anaconda2/envs/onnx/lib/libopencv_highgui.3.3.dylib (0x117d0e238). One of the two will be used. Which one is undefined.
   ('Version      :', '1.2.0')
   ('Directory    :', '/Users/aanirud/anaconda2/envs/onnx/lib/python2.7/site-packages/mxnet-1.2.0-py2.7.egg/mxnet')
   Hashtag not found. Not installed from pre-built package.
   ----------System Info----------
   ('Platform     :', 'Darwin-16.7.0-x86_64-i386-64bit')
   ('system       :', 'Darwin')
   ('node         :', '8c85904b0bf4.ant.amazon.com')
   ('release      :', '16.7.0')
   ('version      :', 'Darwin Kernel Version 16.7.0: Thu Jan 11 22:59:40 PST 2018; root:xnu-3789.73.8~1/RELEASE_X86_64')
   ----------Hardware Info----------
   ('machine      :', 'x86_64')
   ('processor    :', 'i386')
   machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT PREFETCHW RDTSCP TSCI
   machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 HLE AVX2 BMI2 INVPCID RTM SMAP RDSEED ADX IPT SGX FPU_CSDS MPX CLFSOPT
   machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C
   machdep.cpu.brand_string: Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
   ----------Network Test----------
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0189 sec, LOAD: 0.7153 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0148 sec, LOAD: 0.5988 sec.
   Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0251 sec, LOAD: 0.3013 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0183 sec, LOAD: 0.1557 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.1968 sec, LOAD: 0.1189 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.2097 sec, LOAD: 0.2705 sec.
   ```
   
   Package used (Python/R/Scala/Julia):
   Python
   
   ## Build info (Required if built from source)
   
   Compiler (gcc/clang/mingw/visual studio):
   GCC
   
   MXNet commit hash:
   574f469e973aa8a9667f0a1baa767472c1d26018
   
   Build config:
   ```
   export CC = gcc
   export CXX = g++
   export NVCC = nvcc
   DEV = 0
   DEBUG = 0
   ADD_LDFLAGS =
   ADD_CFLAGS =
   USE_CUDA = 0
   USE_CUDA_PATH = NONE
   ENABLE_CUDA_RTC = 1
   USE_CUDNN = 0
   USE_OPENCV = 1
   USE_OPENMP = 0
   USE_BLAS = apple
   USE_LAPACK = 1
   
   ifeq ($(USE_BLAS), mkl)
   USE_LAPACK = 0
   endif
   
   USE_INTEL_PATH = NONE
   USE_DIST_KVSTORE = 0
   USE_HDFS = 0
   LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server
   USE_S3 = 0
   EXTRA_OPERATORS =
   USE_CPP_PACKAGE = 0
   ```
   
   ## Error Message:
   For the following input array
   ```
   y = [[3,3],[4,4],[5,5]]
   z = [[6,6],[7,7],[8,8]]
   ```
   The output of the concat function from the symbol API with axis=1 is
   ```
   [[[ 3.  3.]
     [ 4.  4.]
     [ 5.  5.]
     [ 6.  6.]
     [ 7.  7.]
     [ 8.  8.]]]
   ```
   But the expected output is 
   ```
   [[ 3.  3.  6.  6.]
    [ 4.  4.  7.  7.]
    [ 5.  5.  8.  8.]]
   ```
   
   ## Minimum reproducible example
   ```python
   import mxnet as mx
   from mxnet import nd
   from collections import namedtuple
   import numpy as np
   
   y = mx.sym.Variable('y')
   z = mx.sym.Variable('z')
   net = mx.sym.concat(*[y,z], dim=1)
   
   y = np.array([[3,3],[4,4],[5,5]])
   z = np.array([[6,6],[7,7],[8,8]])
   
   inputs = [y,z]
   data_names = ['y','z']
   data_shapes = []
   
   for idx, input_name in enumerate(data_names):
       batch_size = 1
       data_shapes.append((input_name, inputs[idx].shape))
   mod = mx.mod.Module(symbol=net, context=mx.cpu(), data_names=data_names, label_names=None)
   mod.bind(for_training=False, data_shapes=data_shapes, label_shapes=None)
   mod.init_params()
   batch = namedtuple('Batch', ['data'])
   
   data_forward = []
   for idx, input_name in enumerate(data_names):
       val = inputs[idx]
       data_forward.append(mx.nd.array([val]))
   print(data_forward)
       
   print("\n\n**Concat Output** from symbol API")
   mod.forward(batch(data_forward))
   result = mod.get_outputs()[0]
   print(result)# default axis
   ```
   NDArray function call
   ```python
   y = np.array([[3,3],[4,4],[5,5]])
   z = np.array([[6,6],[7,7],[8,8]])
   
   y = nd.array(y)
   z = nd.array(z)
   nd.concat(y,z,dim=1)
   ```
   
   ## Steps to reproduce
   1. Run the above code sample.
   

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