kaivu1999 opened a new issue #15077: Shape inconsistent 
URL: https://github.com/apache/incubator-mxnet/issues/15077
 
 
   Note: Providing complete information in the most concise form is the best 
way to get help. This issue template serves as the checklist for essential 
information to most of the technical issues and bug reports. For non-technical 
issues and feature requests, feel free to present the information in what you 
believe is the best form.
   
   For Q & A and discussion, please start a discussion thread at 
https://discuss.mxnet.io 
   
   ## Description
   mxnet.base.MXNetError: Shape inconsistent, Provided = [4096,25088], inferred 
shape=(4096,2048)
   
   
   ## Environment info (Required)
   CuDNN 7.1.4
   Cuda 9.2
   Nvcc V9.2.148
   
   
   Package used (Python/R/Scala/Julia):
   Python packages
   certifi==2019.3.9
   chardet==3.0.4
   cycler==0.10.0
   gluoncv==0.4.0.post0
   graphviz==0.8.4
   idna==2.8
   kiwisolver==1.1.0
   matplotlib==3.0.3
   mxnet-cu92==1.4.1
   numpy==1.14.6
   Pillow==6.0.0
   pkg-resources==0.0.0
   pyparsing==2.4.0
   python-dateutil==2.8.0
   requests==2.22.0
   scipy==1.3.0
   six==1.12.0
   tqdm==4.32.1
   urllib3==1.25.2
   
   Code:
   ```
   
   net = models.vgg11(pretrained=True,ctx=ctx)
   
   transform_test = transforms.Compose([
       transforms.Resize((64,64)),
       transforms.ToTensor(),
       transforms.Normalize([0.4914, 0.4822, 0.4465], [0.2023, 0.1994, 0.2010])
   ])
   
   val_data = gluon.data.DataLoader(
       gluon.data.vision.CIFAR10(train=False).transform_first(transform_test),
       batch_size=batch_size, shuffle=False, num_workers=num_workers, 
last_batch='discard')
   
   def test(ctx, val_data):
       metric = mx.metric.Accuracy()
       for i, batch in enumerate(val_data):
           data = gluon.utils.split_and_load(batch[0], ctx_list=[ctx], 
batch_axis=0)
           label = gluon.utils.split_and_load(batch[1], ctx_list=[ctx], 
batch_axis=0)
           # print("data and label are ready")
           outputs = [net(X) for X in data]
           # print("Got the outputs")
           metric.update(label, outputs)
       return metric.get()
   
   name, val_acc = test(ctx, val_data)
   
   ```
   
   ## Error Message:
   ```
   >>> name, val_acc = test(ctx, val_data)
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "<stdin>", line 7, in test
     File "<stdin>", line 7, in <listcomp>
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/gluon/block.py", 
line 540, in __call__
       out = self.forward(*args)
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/gluon/block.py", 
line 917, in forward
       return self.hybrid_forward(ndarray, x, *args, **params)
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/gluon/model_zoo/vision/vgg.py",
 line 84, in hybrid_forward
       x = self.features(x)
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/gluon/block.py", 
line 540, in __call__
       out = self.forward(*args)
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/gluon/block.py", 
line 917, in forward
       return self.hybrid_forward(ndarray, x, *args, **params)
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/gluon/nn/basic_layers.py",
 line 117, in hybrid_forward
       x = block(x)
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/gluon/block.py", 
line 540, in __call__
       out = self.forward(*args)
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/gluon/block.py", 
line 917, in forward
       return self.hybrid_forward(ndarray, x, *args, **params)
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/gluon/nn/basic_layers.py",
 line 221, in hybrid_forward
       flatten=self._flatten, name='fwd')
     File "<string>", line 84, in FullyConnected
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/_ctypes/ndarray.py",
 line 92, in _imperative_invoke
       ctypes.byref(out_stypes)))
     File 
"/home/kaivalya/try/env_try1/lib/python3.5/site-packages/mxnet/base.py", line 
252, in check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: Shape inconsistent, Provided = [4096,25088], inferred 
shape=(4096,2048)
   ```
   Can someone help?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to