eric-haibin-lin commented on issue #7034: How to switch a layer to cpu mode 
while the other layers are in gpu mode.
   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 =, c) # runs on gpu
   executor = d.simple_bind(ctx=mx.gpu(), a=(10,), b=(10,), group2ctx={"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
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:

With regards,
Apache Git Services

Reply via email to