📜  Python – tensorflow.get_logger()

📅  最后修改于: 2022-05-13 01:54:39.622000             🧑  作者: Mango

Python – tensorflow.get_logger()

TensorFlow 是由 Google 设计的开源Python库,用于开发机器学习模型和深度学习神经网络。

get_logger()用于获取记录器实例。

示例 1:

Python3
# Importing the library
import tensorflow as tf
  
# Fetting logger instance 
logger = tf.get_logger()
  
# Checking if propagation is enabled
res = logger.propagate
  
# Printing the result
print('res: ',res)


Python3
# Importing the library
import tensorflow as tf
  
# Fetting logger instance 
logger = tf.get_logger()
  
# Disabling the propagation
logger.propagate = False
  
# Checking if propagation is enabled
res = logger.propagate
  
# Printing the result
print('res: ',res)


输出:

res:  True

示例 2:

Python3

# Importing the library
import tensorflow as tf
  
# Fetting logger instance 
logger = tf.get_logger()
  
# Disabling the propagation
logger.propagate = False
  
# Checking if propagation is enabled
res = logger.propagate
  
# Printing the result
print('res: ',res)

输出:

res:  False