{"action":"closed","issue":{"url":"https://api.github.com/repos/dmlc/mxnet/issues/992","repository_url":"https://api.github.com/repos/dmlc/mxnet","labels_url":"https://api.github.com/repos/dmlc/mxnet/issues/992/labels{/name}","comments_url":"https://api.github.com/repos/dmlc/mxnet/issues/992/comments","events_url":"https://api.github.com/repos/dmlc/mxnet/issues/992/events","html_url":"https://github.com/dmlc/mxnet/issues/992","id":123170309,"number":992,"title":"Why predictions with different batch size will cause error?","user":{"login":"hehaodele","id":8013541,"avatar_url":"https://avatars.githubusercontent.com/u/8013541?v=3","gravatar_id":"","url":"https://api.github.com/users/hehaodele","html_url":"https://github.com/hehaodele","followers_url":"https://api.github.com/users/hehaodele/followers","following_url":"https://api.github.com/users/hehaodele/following{/other_user}","gists_url":"https://api.github.com/users/hehaodele/gists{/gist_id}","starred_url":"https://api.github.com/users/hehaodele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hehaodele/subscriptions","organizations_url":"https://api.github.com/users/hehaodele/orgs","repos_url":"https://api.github.com/users/hehaodele/repos","events_url":"https://api.github.com/users/hehaodele/events{/privacy}","received_events_url":"https://api.github.com/users/hehaodele/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2015-12-20T16:28:16Z","updated_at":"2016-10-19T14:17:25Z","closed_at":"2016-10-19T14:17:25Z","body":"The codes are as following:\r\n```\r\nprint model.predict(np_to_mxIter(val, 500))\r\nprint model.predict(np_to_mxIter(train, 1000))\r\n```\r\nwith the definition of ```np_to_mxIter```\r\n```\r\ndef np_to_mxIter(data, bs):\r\n    dataIter = mx.io.NDArrayIter(\r\n        data = data[:, 0:470],\r\n        label = data[:, 471:472].flatten(),\r\n        batch_size = bs,\r\n        shuffle = False)\r\n    return dataIter\r\n```\r\nYet I encounter the following error:\r\n```\r\n./dmlc-core/include/dmlc/logging.h:208: [00:24:22] src/ndarray/ndarray.cc:159: Check failed: from.shape() == to->shape() operands shape mismatch\r\nTraceback (most recent call last):\r\n  File \"/home/hehaodele/workspace/hhnet/src/Hmain.py\", line 119, in <module>\r\n    go_train()\r\n  File \"/home/hehaodele/workspace/hhnet/src/Hmain.py\", line 97, in go_train\r\n    print model.predict(np_to_mxIter(train, 1000))\r\n  File \"/usr/local/lib/python2.7/dist-packages/mxnet-0.5.0-py2.7.egg/mxnet/model.py\", line 561, in predict\r\n    _load_data(batch, data_arrays)\r\n  File \"/usr/local/lib/python2.7/dist-packages/mxnet-0.5.0-py2.7.egg/mxnet/executor.py\", line 297, in _load_data\r\n    _load_general(batch.data, targets)\r\n  File \"/usr/local/lib/python2.7/dist-packages/mxnet-0.5.0-py2.7.egg/mxnet/executor.py\", line 290, in _load_general\r\n    d_src.copyto(d_targets)\r\n  File \"/usr/local/lib/python2.7/dist-packages/mxnet-0.5.0-py2.7.egg/mxnet/ndarray.py\", line 361, in copyto\r\n    return NDArray._copyto(self, out=other)\r\n  File \"/usr/local/lib/python2.7/dist-packages/mxnet-0.5.0-py2.7.egg/mxnet/ndarray.py\", line 654, in unary_ndarray_function\r\n    c_array(NDArrayHandle, (out.handle,))))\r\n  File \"/usr/local/lib/python2.7/dist-packages/mxnet-0.5.0-py2.7.egg/mxnet/base.py\", line 76, in check_call\r\n    raise MXNetError(py_str(_LIB.MXGetLastError()))\r\nmxnet.base.MXNetError: [00:24:22] src/ndarray/ndarray.cc:159: Check failed: from.shape() == to->shape() operands shape mismatch\r\n```\r\nAny ideas to solve it? Thanks."}}
{"actor":{"display_login":"pluskid"}}