awslabs / keras-apache-mxnet

[DEPRECATED] Amazon Deep Learning's Keras with Apache MXNet support
https://github.com/awslabs/keras-apache-mxnet/wiki
Other
289 stars 65 forks source link

fix set MXNet context #250

Closed roywei closed 4 years ago

roywei commented 4 years ago

Summary

fix https://github.com/awslabs/keras-apache-mxnet/issues/251

This PR fix it, and added the following:

  1. set MXNet context during Model class initialization using context kwargs
  2. set MXNet context during model.compile() through context kwargs
  3. set MXNet context using model.set_mxnet_context(context)

context supports single context or list of context, for example 'cpu' or 'gpu(0)' or ['gpu(1)', 'gpu(2)']

Added tests at: tests/keras/backend/mxnet_context_test.py

Related Issues

PR Overview

roywei commented 4 years ago

@sandeep-krishnamurthy Thanks for the review, updated to keep the change minimal. linked issue and updated tests