Is there a way to supress TensorFlow logging in C-API

喜夏-厌秋 提交于 2021-01-28 12:12:27

问题


I managed to run my SavedModel generated by Python using C-API. Now I want to suppress all the verbose from TensorFlow as below:

2020-07-17 13:44:45.358903: I tensorflow/cc/saved_model/reader.cc:31] Reading SavedModel from: /home/philgun/tf-C-API/my_model
2020-07-17 13:44:45.360075: I tensorflow/cc/saved_model/reader.cc:54] Reading meta graph with tags { serve }
2020-07-17 13:44:45.361381: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-07-17 13:44:45.386362: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3000000000 Hz
2020-07-17 13:44:45.387681: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2777510 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-17 13:44:45.387747: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-07-17 13:44:45.388026: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/philgun/Solstice/Installation_Package/Solstice-0.9.0-GNU-Linux64/lib:/home/philgun/Solstice/Installation_Package/Solstice-0.9.0-GNU-Linux64/lib::/home/philgun/DAKOTA/dakota_installation/bin:/home/philgun/DAKOTA/dakota_installation/lib:/home/philgun/DAKOTA/dakota_installation/bin:/home/philgun/DAKOTA/dakota_installation/lib
2020-07-17 13:44:45.388052: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)
2020-07-17 13:44:45.388092: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (philgun): /proc/driver/nvidia/version does not exist
2020-07-17 13:44:45.401015: I tensorflow/cc/saved_model/loader.cc:202] Restoring SavedModel bundle.
2020-07-17 13:44:45.447205: I tensorflow/cc/saved_model/loader.cc:151] Running initialization op on SavedModel bundle at path: /home/philgun/tf-C-API/my_model
2020-07-17 13:44:45.453955: I tensorflow/cc/saved_model/loader.cc:311] SavedModel load for tags { serve }; Status: success. Took 95057 microseconds.

This is the part of my C-code that loads the frozen model. How and where should I set this verbose option?

//*********************Read Model
    TF_Graph* Graph = TF_NewGraph();
    TF_Status* Status = TF_NewStatus();

    TF_SessionOptions* SessionOpts = TF_NewSessionOptions();
    TF_Buffer* RunOpts = NULL;

    const char* tags = "serve"; // default model serving tag
    int ntags =1;

    TF_Session* Session = TF_LoadSessionFromSavedModel(SessionOpts, RunOpts, saved_model_dir, &tags,ntags, Graph, NULL, Status);

Thanks before!

来源:https://stackoverflow.com/questions/62947180/is-there-a-way-to-supress-tensorflow-logging-in-c-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!