You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/08/06 18:45:30 UTC

[GitHub] eric-haibin-lin commented on issue #7034: How to switch a layer to cpu mode while the other layers are in gpu mode.

eric-haibin-lin commented on issue #7034: How to switch a layer to cpu mode while the other layers are in gpu mode.
URL: https://github.com/apache/incubator-mxnet/issues/7034#issuecomment-320524720
 
 
   You can try the `ctx2group` option during simple_bind(). For example, if you want to specify a layer on cpu among the gpu layers,
   ```
   a = mx.sym.var("a")
   b = mx.sym.var("b")
   with mx.AttrScope(ctx_group="cpu"):
       c = mx.sym.sample_negative_binomial(a,b) # runs on cpu
   d = mx.sym.dot(a, c) # runs on gpu
   
   executor = d.simple_bind(ctx=mx.gpu(), a=(10,), b=(10,), group2ctx={"cpu": mx.cpu()})
   ```
   allows `sample_negative_binomial` to be on cpu while the rest on gpu. 
   
   Caveat: there's a known bug for elemwise_add with group2ctx https://github.com/apache/incubator-mxnet/issues/7080
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services