December 2017
Intermediate to advanced
536 pages
14h 23m
English
TensorFlow represents devices as strings. Here, we will show you how one can manually assign a device for matrix multiplication in TensorFlow. To verify that TensorFlow is indeed using the device (CPU or GPU) specified, we create the session with the log_device_placement flag set to True, namely, config=tf.ConfigProto(log_device_placement=True):
config=tf.ConfigProto(allow_soft_placement=True, log_device_placement=True)
with tf.device('/cpu:0'): rand_t = tf.random_uniform([50,50], 0, 10, dtype=tf.float32, seed=0) a = tf.Variable(rand_t) ...Read now
Unlock full access