0

I am using TensorFlow model in C, and I need to have a clean console with only one output for other proramms. But now, when I run the model it prints stuff like this :

Successfully opened dynamic library cublas64_100.dll, Successfully opened dynamic library cudnn64_7.dll tensorflow/stream_executor/cuda/redzone_allocator.cc:312] Internal: Invoking ptxas not supported on Windows Relying on driver to perform ptx compilation. This message will be only logged once.

Is there a way to remove the debugging information? For example in python it can be solved by using information in this thread:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 
import tensorflow as tf

But I cant seem to find any other resources for C except this:

putenv("TF_CPP_MIN_LOG_LEVEL=3");

But that for some reason doesn't work. (So my idea is to change the default value for this variable (TF_CPP_MIN_LOG_LEVEL) globally in the TF source code or wherever it is, so it's set to 3 every time I use Tensorflow, but I'm not quite sure how to do that)

Gustasvs
  • 41
  • 1
  • 6

1 Answers1

0

you can disable tensorflow logs using c api you by setting a new environment variable called TF_CPP_MIN_LOG_LEVEL.

char* new_env = "TF_CPP_MIN_LOG_LEVEL=3";

By creating this environment variable the tensorflow logs will be disable. Thank You.