1. 程式人生 > >tensorboard檢視tensor佔用記憶體及執行時間

tensorboard檢視tensor佔用記憶體及執行時間

設定sess.run中option為FULL_TRACE,然後將輸出的metadata寫到writer裡即可,樣例程式碼如下:

run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
summary, _ = sess.run([merged,train_step],
                      feed_dict=feed_dict(True),
                      options=run_options,
                      run_metadata=
run_metadata) train_writer.add_run_metadata(run_metadata, 'step%d' % i) train_writer.add_summary(summary, i)