mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

Predict using GPU

Open No41Name opened this issue 9 years ago • 2 comments

How can I predict on my validation dataset using GPU, after loading a model? I've trained my model on GPU and then I saved it from terminal, but when I load the model for doing predictions only CPU is used:

model_loaded = mx.model.FeedForward.load(prefix, iteration) preds=model_loaded.predict(validation_dataset)

How can I predict with GPU instead of CPU, since there are no ctx parameters in the predict function? Thanks!

No41Name avatar Dec 26 '16 10:12 No41Name

model_loaded = mx.model.FeedForward.load(prefix, iteration, ctx=mx.gpu())
preds=model_loaded.predict(validation_dataset)

u1234x1234 avatar Dec 26 '16 20:12 u1234x1234

Thanks!!

No41Name avatar Dec 26 '16 22:12 No41Name