@wkcn 你好,请问你是怎么解决 Check failed: to->type_flag_ == from.type_flag_ (0 vs. 3)
Source and target must have the same data type when copying across
devices的,我一开始也是报了这个issue的错误,然后按照代码改了之后又会出现上面这个错误,我报错的信息是
Traceback (most recent call last):
File "train_softmax_fast.py", line 892, in <module>
main()
File "train_softmax_fast.py", line 889, in main
train_net(args)
File "train_softmax_fast.py", line 883, in train_net
epoch_end_callback = epoch_cb )
File
"/usr/local/lib/python2.7/dist-packages/mxnet/module/multitaskmodulev3.py",
line 269, in fit
self.update_metric(gender_eval_metric, data_batch.label)
File "/usr/local/lib/python2.7/dist-packages/mxnet/module/module.py", line
768, in update_metric
self._exec_group.update_metric(eval_metric, labels)
File "/usr/local/lib/python2.7/dist-packages/mxnet/module/executor_group.py",
line 621, in update_metric
eval_metric.update_dict(labels_, preds)
File "/usr/local/lib/python2.7/dist-packages/mxnet/metric.py", line 304, in
update_dict
metric.update_dict(labels, preds)
File "/usr/local/lib/python2.7/dist-packages/mxnet/metric.py", line 132, in
update_dict
self.update(label, pred)
File "train_softmax_fast.py", line 203, in update
print("pred_label before if is {}\n".format(mx.ndarray.array(pred_label)))
File "/usr/local/lib/python2.7/dist-packages/mxnet/ndarray/ndarray.py", line
189, in __repr__
return '\n%s\n<%s %s @%s>' % (str(self.asnumpy()),
File "/usr/local/lib/python2.7/dist-packages/mxnet/ndarray/ndarray.py", line
1876, in asnumpy
ctypes.c_size_t(data.size)))
File "/usr/local/lib/python2.7/dist-packages/mxnet/base.py", line 149, in
check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [14:31:06] src/ndarray/ndarray_function.cu:43: Check
failed: to->type_flag_ == from.type_flag_ (0 vs. 3) Source and target must have
the same data type when copying across devices.
Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x30756a)
[0x7f8c83ab656a]
[bt] (1) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x307b91)
[0x7f8c83ab6b91]
[bt] (2) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x401cd87)
[0x7f8c877cbd87]
[bt] (3) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x2628a16)
[0x7f8c85dd7a16]
[bt] (4) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x263c41a)
[0x7f8c85deb41a]
[bt] (5) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x263c54b)
[0x7f8c85deb54b]
[bt] (6) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x2472944)
[0x7f8c85c21944]
[bt] (7) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x2478e13)
[0x7f8c85c27e13]
[bt] (8) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x2479066)
[0x7f8c85c28066]
[bt] (9) /usr/local/lib/python2.7/dist-packages/mxnet/libmxnet.so(+0x2473054)
[0x7f8c85c22054]
请问你是如何解决的,我一共有三个自定义的AccMetric,前两个AccMetric用的方法都是mx.nd.array(pred_label,
ctx=mx.current_context())来解决,奇怪的是前面两个加的地方不一样才可以,这第三个就完全解决不了了
[ Full content available at:
https://github.com/apache/incubator-mxnet/issues/9920 ]
This message was relayed via gitbox.apache.org for [email protected]