添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Tensorflow/Pytorch in Houdini | Houdini中使用Tensorflow/Pytorch

Home >> Blog >> Tensorflow/Pytorch in Houdini | Houdini中使用Tensorflow/Pytorch
print (sess.run(hello)) with tf.device('/device:GPU:0'):     a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')     b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')     c = tf.matmul(a, b) sess = tf.Session(config=tf.ConfigProto(log_device_placement=True)) print(sess.run(c))
1
2
3
4
5
6
7
8
9
10
import tensorflow as tf
hello = tf . constant ( 'Hello, TensorFlow!' )
sess = tf . Session ( )
print ( sess . run ( hello ) )
with tf . device ( '/device:GPU:0' ) :
& nbsp ; & nbsp ; a = tf . constant ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ] , shape = [ 2 , 3 ] , name = 'a' )
& nbsp ; & nbsp ; b = tf . constant ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ] , shape = [ 3 , 2 ] , name = 'b' )
& nbsp ; & nbsp ; c = tf . matmul ( a , b )
sess = tf . Session ( config = tf . ConfigProto ( log_device_placement = True ) )
print ( sess . run ( c ) )