【发布时间】:2021-06-23 07:50:36
【问题描述】:
我正在使用以下代码查看是否能够阻止 TF/KERAS 生成日志。
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
tf.debugging.set_log_device_placement(True)
# Create some tensors
a = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
b = tf.constant([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])
c = tf.matmul(a, b)
print(c)
您可能会看到我在代码中使用了os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 来禁用日志。
可用的 GPU 数量:1 在设备中执行 op MatMul /job:localhost/replica:0/task:0/device:GPU:0 tf.Tensor([[22. 28.] [49. 64.]], shape=(2, 2), dtype=float32)
有什么方法可以禁用 TF/KERAS 打印Executing op MatMul in device /job:localhost/replica:0/task:0/device:GPU:0 ?
【问题讨论】:
标签: tensorflow keras