import mxnet as mx from mxnet import nd from mxnet.gluon import nn a = nd.array([1, 2, 3], ctx=mx.gpu()) printa(a)
# 验证 tensorflow gpu
import tensorflow as tf
with tf.device('/cpu:0'): a = tf.constant([1.0,2.0,3.0],shape=[3],name='a') b = tf.constant([1.0,2.0,3.0],shape=[3],name='b') with tf.device('/gpu:1'): c = a+b