Numpy array to ndarray


#1

how to convert numpy array to mxnet ndarray ?


#2

You can just call mx.nd.array on the numpy array:

import mxnet as mx
import numpy as np
mx.nd.array(np.arange(10))

works

If you’re using gpus make sure to manage the context -

mx.nd.array(np.arange(10)).as_in_context(mx.gpu(0))