zackchase / mxnet-the-straight-dope

An interactive book on deep learning. Much easy, so MXNet. Wow. [Straight Dope is growing up] ---> Much of this content has been incorporated into the new Dive into Deep Learning Book available at https://d2l.ai/.
https://d2l.ai/
Apache License 2.0
2.56k stars 725 forks source link

Error on `https://gluon.mxnet.io/chapter02_supervised-learning/perceptron.html` #513

Open sildeag opened 6 years ago

sildeag commented 6 years ago

Input: X, Y = getfake(50, 2, 0.3)

tmp [[ 0.41137779 1.77428079]] <NDArray 1x2 @cpu(0)>

X[i,:] [ 0. 0.] <NDArray 2 @cpu(0)>

X <NDArray 50x2 @cpu(0)>

`Y [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.

                                  1. 0.
                          1. 0.] <NDArray 50 @cpu(0)>`

Output: ValueError: operands could not be broadcast together with remapped shapes[original->remapped]: (1L, 2L) and requested shape (50L,)

imgarylai commented 6 years ago

I think the tmp should be modified as tmp = nd.random_normal(shape=dimensions).