Tensorflow.js是Google开发的开源库,用于在浏览器或节点环境中运行机器学习模型和深度学习神经网络。
Tensorflow.js tf.registerBackend() 函数用于在导入模块文件时注册一个全局后端。注册的后端用于模块化构建。
用法:
tf.registerBackend (name, factory, priority?)
参数:
- name (string):它指定要注册的后端的名称。
- factory:它指定了后端工厂函数。此函数返回一个后端实例或一个实例的承诺。
- priority (number):它指定此后端的优先级。具有更高优先级的后端更加重要。该参数的默认值为 1。
返回值:它返回一个布尔值。
范例1:
Javascript
// Importing the tensorflow.js library
const tf = require("@tensorflow/tfjs");
// Try to register a 'webgl' backend
const status = tf.registerBackend("webgl")
// Print status
console.log(status)
输出:
true
范例2:
Javascript
// Importing the tensorflow.js library
const tf = require("@tensorflow/tfjs");
// Try to register a 'cpu' backend
const status = tf.registerBackend("cpu")
// Print status
console.log(status)
输出:
false
相关用法
- 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()用法及代码示例
- PHP cal_to_jd()用法及代码示例
- d3.js d3.bisectLeft()用法及代码示例
注:本文由纯净天空筛选整理自abhinavjain194大神的英文原创作品 Tensorflow.js tf.registerBackend() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。