[Tensorflow] Tensorflow 2.x Warning Off 방법

es.Seong·2024년 5월 21일
0

개발 환경
OS : Linux
Tensorflow Ver. : 2.5.0
CUDA : 11.4

보통 Warning 메시지를 무시하는 코드는 warnings 라이브러리를 사용한다.

import warnings 
warnings.filterwarnings(action='ignore')

하지만 Tensorflow는 warnings 라이브러리로 없애지 못하기 때문에 silence_tensorflow 라이브러리를 통해 경고 메시지를 끌 수 있다.

아래와 같이 코드를 작성 후 실행하면 Tensorflow 코드에서 경고 메시지가 출력되지 않는다.

from silence_tensorflow import silence_tensorflow
silence_tensorflow()
profile
Graduate student at Pusan National University, majoring in Artificial Intelligence

0개의 댓글