Tensorflow, GPU?
.
, rand
- , rand
feed_dict
. session.py
:
self._final_fetches = [x for x in self._fetches if x not in feeds]
... :
if final_fetches or final_targets or (handle and feed_dict_tensor):
results = self._do_run(handle, final_targets, final_fetches,
feed_dict_tensor, options, run_metadata)
else:
results = []
, . Tensorflow , , , .
, log_device_placement=True
:
with tf.Session(config=tf.ConfigProto(log_device_placement=True)) as sess:
random_value = np.random.randn(300,224,224,1)
print(sess.run(rand + 2, feed_dict={rand: random_value}).shape)
, : ImageSummary
op GPU. (core/kernels/summary_image_op.cc
):
REGISTER_KERNEL_BUILDER(Name("ImageSummary").Device(DEVICE_CPU),
SummaryImageOp);
, CPU , session.run()
:
with tf.device('/gpu:0'):
tf.summary.image('random_noise_visualisation', rand,max_outputs=5)
merged_summary_op = tf.summary.merge_all()
, - -.
ImageSummary
, , . GitHub , , GPU, , .
, tensorflow , , GPU , GPU CPU.
?
. InteractiveSession
. , InteractiveSession
, Session
with
.
- ?
, , , . .