Warning while using tensorflow tensorflow/core/util/port.cc113 oneDNN custom operations are on
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The message tensorflow/core/util/port.cc:113: oneDNN custom operations are on is an informational log, not an error. It means TensorFlow is using Intel's oneDNN (formerly MKL-DNN) library to accelerate CPU operations like convolutions, matrix multiplications, and batch normalization. This is normal behavior on Intel CPUs and generally improves performance. To suppress the message, set the environment variable TF_ENABLE_ONEDNN_OPTS=0 (disables oneDNN) or adjust TensorFlow's log level with TF_CPP_MIN_LOG_LEVEL=2.
What the Message Means
This is a LOG(INFO) message — the I prefix means "information." TensorFlow is telling you that:
- oneDNN optimized kernels are active for CPU operations
- Floating-point results may differ slightly from non-oneDNN execution
- You can disable it if exact numerical reproducibility is required
Why oneDNN Is Enabled
Starting with TensorFlow 2.9+, oneDNN optimizations are enabled by default on Intel CPUs. oneDNN accelerates:
- Convolution operations (Conv2D, Conv3D)
- Matrix multiplications (MatMul, Dense layers)
- Batch normalization
- Pooling operations
- RNN/LSTM layers
- Activation functions
Suppressing the Message
Option 1: Set TF_CPP_MIN_LOG_LEVEL (Suppress Logs Only)
This hides the message without disabling oneDNN optimizations:
Log level values:
| Value | Effect |
0 | Show all messages (default) |
1 | Filter out INFO messages |
2 | Filter out INFO and WARNING |
3 | Filter out INFO, WARNING, and ERROR |
Option 2: Disable oneDNN (TF_ENABLE_ONEDNN_OPTS=0)
This disables the optimizations entirely:
Only disable oneDNN if you need exact numerical reproducibility between runs or between CPU and GPU results.
Option 3: Python Logging Level
Numerical Differences from oneDNN
oneDNN uses optimized computation orders (e.g., fused multiply-add, different reduction trees) that change floating-point rounding:
These differences are within normal floating-point precision and do not affect model quality.
Performance Impact
oneDNN typically provides 1.5x-3x speedup for CPU inference:
Threading Configuration
oneDNN threading can be tuned for better performance:
Dockerfile Example
Common Pitfalls
- Setting environment variables after importing TensorFlow:
os.environ['TF_CPP_MIN_LOG_LEVEL']andos.environ['TF_ENABLE_ONEDNN_OPTS']must be set beforeimport tensorflow. Setting them after the import has no effect because TensorFlow reads them during initialization. - Disabling oneDNN for performance-critical CPU workloads: Turning off oneDNN with
TF_ENABLE_ONEDNN_OPTS=0reduces CPU inference speed by 1.5-3x. Only disable it if numerical reproducibility is required, not just to suppress the log message. - Confusing the info message with an error: The
Iprefix means INFO. This is not a warning or error — it is purely informational. SettingTF_CPP_MIN_LOG_LEVEL=1suppresses it without any side effects. - Expecting GPU operations to be affected: oneDNN only optimizes CPU operations. GPU operations use cuDNN instead. The message appears even when a GPU is available because TensorFlow initializes CPU kernels during startup.
- Assuming numerical differences indicate a bug: The ~1e-6 differences from oneDNN are normal floating-point behavior. Model accuracy, loss values, and predictions are not meaningfully affected. Do not disable oneDNN to "fix" these differences.
Summary
- The
oneDNN custom operations are onmessage is informational, not an error - oneDNN accelerates CPU operations (convolution, matmul, batch norm) by 1.5-3x
- Suppress with
TF_CPP_MIN_LOG_LEVEL=2(hides message, keeps optimization) - Disable with
TF_ENABLE_ONEDNN_OPTS=0only if exact numerical reproducibility is needed - Set environment variables before
import tensorflowfor them to take effect

