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 2017/10/20 03:50:31 UTC
[GitHub] shadowleaves opened a new issue #4045: inferred shape error with FullyConnected layer
shadowleaves opened a new issue #4045: inferred shape error with FullyConnected layer
URL: https://github.com/apache/incubator-mxnet/issues/4045
very simple program that starts with two input nodes (batch_size=100, n_inputs=2) and then maps it to a layer of 3 hidden nodes via a 2x3 weight matrix. got the following error. any idea what's going on? how could the inferred shape be (3,2)?
```
mxnet.base.MXNetError: InferShape Error in fullyconnected0's weight argument
Shape inconsistent, Provided=(2,3), inferred shape=(3,2)Corresponding keyword of symbol: wx
Shape inconsistent, Provided=(2,3), inferred shape=(3,2)
```
```
#!/usr/bin/env python
import mxnet as mx
import numpy as np
if __name__ == '__main__':
# Create dataset
nb_train = 2000 # Number of training samples
batch_size = 100
X_train = np.random.sample((nb_train, 2))
T_train = np.random.sample((nb_train, ))
train_dataiter = mx.io.NDArrayIter(data=X_train,
label=T_train,
batch_size=batch_size,
label_name='softmax_label',
shuffle=True)
net = mx.symbol.Variable('data')
wx = mx.sym.Variable('wx', shape=(2, 3))
net = mx.symbol.FullyConnected(data=net, num_hidden=3,
weight=wx,
no_bias=True)
net = mx.symbol.SoftmaxOutput(data=net, name='softmax')
mod = mx.mod.Module(net)
mod.bind(data_shapes=train_dataiter.provide_data,
label_shapes=train_dataiter.provide_label)
```
----------------------------------------------------------------
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