0
Ich habe die Probe tensorflow Code untenPython-Tensorflow statt CPU auf GPU läuft
import tensorflow as tf
with tf.device('/cpu: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)
print(sess.run(c))
explizit habe ich gegeben tf.device ('/ cpu: 0'), aber es wird die folgende Fehlermeldung geben:
InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'MatMul_5': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/cpu:0 ]. Make sure the device specification refers to a valid device.
[[Node: MatMul_5 = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/device:GPU:0"](a_5, b_5)]]
Tensorflow Version: 1.3.0, python-Version: 3.6.1 mit Anaconda Verteilung
Versuchen Sie, 'allow_soft_placement = True' zu 'ConfigProto''s Argumentliste hinzuzufügen – CoryKramer