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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
