vandanavk commented on a change in pull request #12498: Code modification for  
testcases of various network models in directory example
URL: https://github.com/apache/incubator-mxnet/pull/12498#discussion_r237272634
 
 

 ##########
 File path: example/bayesian-methods/bdk_demo.py
 ##########
 @@ -156,19 +156,22 @@ def get_toy_sym(teacher=True, 
teacher_noise_precision=None):
     return net
 
 
-def dev():
-    return mx.gpu()
+def dev(xpu):
+    if xpu == None:
+        return mx.cpu()
+    else:
+        return mx.gpu(xpu)
 
 
 def run_mnist_SGD(training_num=50000):
     X, Y, X_test, Y_test = load_mnist(training_num)
     minibatch_size = 100
     net = get_mnist_sym()
     data_shape = (minibatch_size,) + X.shape[1::]
-    data_inputs = {'data': nd.zeros(data_shape, ctx=dev()),
-                   'softmax_label': nd.zeros((minibatch_size,), ctx=dev())}
+    data_inputs = {'data': nd.zeros(data_shape, ctx=dev(xpu)),
 
 Review comment:
   does it need `def run_mnist_SGD(training_num=50000, xpu=None)` here?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to