Tensorflow.js是由Google开发的开源库,用于在浏览器或节点环境中运行机器学习模型以及深度学习神经网络。
.enableDebugMode() 函数用于启用调试模式,该模式将注册有关每个执行的内核的数据,即内核实现的运行时间,包括结果张量的等级、大小和形状。
注意:
- 调试模式会大大降低我们软件的速度,因为它会下载 CPU 中每个动作的最终结果,而这些动作不能在生产中使用。
- Debug 模式不会影响内核性能的时序数据,因为这里的下载时间不是在内核性能时间中评估的。
用法:
tf.enableDebugMode()
Parameters: 该方法不持有任何参数。
返回值:它返回void。
范例1:
Javascript
// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
// Calling enableDebugMode() method
await tf.enableDebugMode();
// Setting prod mode of the
// environment
tf.env().set('PROD', false);
// Printing output
console.log(tf.env().flags);
输出:
{ "IS_BROWSER":true, "IS_NODE":false, "DEBUG":true, "CPU_HANDOFF_SIZE_THRESHOLD":128, "PROD":false }
范例2:
Javascript
// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
// Calling enableDebugMode() method
await tf.enableDebugMode();
// Setting debug mode of the environment
tf.env().set("DEBUG", !0)
// Setting textures of the environment
tf.env().set('WEBGL_FORCE_F16_TEXTURES', true);
// Calling ready() method
await tf.ready();
// Printing output
console.log(tf.env().features);
输出:
{ "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 }
参考:https://js.tensorflow.org/api/latest/#enableDebugMode
相关用法
- PHP imagecreatetruecolor()用法及代码示例
- p5.js year()用法及代码示例
- d3.js d3.utcTuesdays()用法及代码示例
- PHP ImagickDraw getTextAlignment()用法及代码示例
- PHP Ds\Sequence last()用法及代码示例
- PHP Imagick floodFillPaintImage()用法及代码示例
- PHP geoip_continent_code_by_name()用法及代码示例
- d3.js d3.map.set()用法及代码示例
- PHP GmagickPixel setcolor()用法及代码示例
- Tensorflow.js tf.layers.embedding()用法及代码示例
- PHP opendir()用法及代码示例
- d3.js d3.bisectLeft()用法及代码示例
注:本文由纯净天空筛选整理自nidhi1352singh大神的英文原创作品 Tensorflow.js tf.enableDebugMode() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。