Using NDArray with mxnet::Context::CPUPinned(0)


#1

I am trying to init a NDArray with cpupinned context in cpp.
But when I print out my NDArray,
it still indicate it’s in CPU().

[NDArray 32 @cpu(0)]

Here is my code:

{

mxnet::Context ctx = mxnet::Context::CPUPinned(0);

assert(num_cols_ == data_shape[0] * data_shape[1] * data_shape[2]);

mxnet::TShape shape = mxnet::TShape{num_rows_, data_shape[0], data_shape[1], data_shape[2]};

mxnet::TBlob blob{buffer_.get(), shape, ctx.dev_mask(), ctx.dev_id};

return mxnet::NDArray{blob, ctx.dev_id};

}