mxnet 訓練錯誤:ui
mxnet.base.MXNetError: [14:42:22] src/imperative/./imperative_utils.h:70: Check failed: inputs[i]->ctx().dev_mask() == ctx.dev_mask() (1 vs. 2) Operator stack require all inputs live on the same context. But the first argument is on gpu(0) while the 2-th argument is on cpu(0)
這種錯誤就是數據存儲不一樣致使的,前一個數據在gpu上面,後一個數據在cpu上面,致使錯誤異常。
修改方法:在某一個數據加上context限制,使用ctx=mx.gpu()或者ctx=mx.cpu()