Tensorflow.js tf.enableDebugMode() Function
Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment.
The .enableDebugMode() function is used to enable the debug mode that would register data regarding every single executed kernels i.e. the runout time of the kernel implementation, including the rank, size, as well as shape of the resultant tensor.
Note:
- The Debug mode would substantially reduce the speed of our software because it would download the end result of every single action within the CPU which must not be utilized in the production.
- The Debug mode would not impact the timing data of the kernel performance as the download time here is not assessed in the kernel performance time.
Syntax:
tf.enableDebugMode()
Parameters: This method does not hold any parameter.
Return Value: It returns void.
Example 1:
Javascript
import * as tf from "@tensorflow/tfjs"
await tf.enableDebugMode();
tf.env().set( 'PROD' , false );
console.log(tf.env().flags);
|
Output:
{
"IS_BROWSER": true,
"IS_NODE": false,
"DEBUG": true,
"CPU_HANDOFF_SIZE_THRESHOLD": 128,
"PROD": false
}
Example 2:
Javascript
import * as tf from "@tensorflow/tfjs"
await tf.enableDebugMode();
tf.env().set( "DEBUG" , !0)
tf.env().set( 'WEBGL_FORCE_F16_TEXTURES' , true );
await tf.ready();
console.log(tf.env().features);
|
Output:
{
"IS_BROWSER": true,
"IS_NODE": false,
"DEBUG": true,
"CPU_HANDOFF_SIZE_THRESHOLD": 128,
"PROD": true,
"WEBGL_FORCE_F16_TEXTURES": true,
"WEBGL_VERSION": 2,
"HAS_WEBGL": true
}
Reference: https://js.tensorflow.org/api/latest/#enableDebugMode
Last Updated :
18 Aug, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...