使用TensorFlow profiler测量GPU内存使用率
有没有一种方法可以使用TensorFlow profiler正确测量tf.Estimator模型的GPU使用情况?我遵循了以下文档:使用TensorFlow profiler测量GPU内存使用率,tensorflow,Tensorflow,有没有一种方法可以使用TensorFlow profiler正确测量tf.Estimator模型的GPU使用情况?我遵循了以下文档: g = tf.Graph() sess = tf.Session(graph=g) run_meta = tf.RunMetadata() time_and_memory_args = tf.profiler.ProfileOptionBuilder.time_and_memory() with g.as_default(): data_shape =
g = tf.Graph()
sess = tf.Session(graph=g)
run_meta = tf.RunMetadata()
time_and_memory_args = tf.profiler.ProfileOptionBuilder.time_and_memory()
with g.as_default():
data_shape = [BATCH_SIZE] + [3, 224, 224]
in_plh = tf.placeholder(tf.float32, data_shape)
model = some_model(in_plh, args=model_args, training=True)
images = np.random.rand(BATCH_SIZE, 3, 224, 224)
sess.run(tf.global_variables_initializer())
sess.run(model, feed_dict={in_plh: images})
time_and_memory = tf.profiler.profile(g, run_meta=run_meta, cmd='op',
options=time_and_memory_args)
if time_and_memory is not None:
print('Total requested bytes:', time_and_memory.total_requested_bytes)
但打印结果始终为0