Is there a way to suppress STDERR message from tensorflow and XLA

552 views Asked by At

When I run my python script, I had the messages below:

WARNING: All log messages before absl::InitializeLog() is called are written to STDERR

I0000 00:00:1701341037.989729 1542352 device_compiler.h:186] Compiled cluster using XLA! This line is logged at most once for the lifetime of the process.

The next is my python script:

################# Start ##############

import os, sys

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

import tensorflow as tf

@tf.function(jit_compile=True)

def operation(a, b):
    return a+b

print(operation(2, 3))

################ End ###################

But I don't want the messages above. I use tensorflow 2.15, Rocky linux 9.3, cuda 2.2/2.3, and python3.9.

0

There are 0 answers