Tensorflow.js是Google开发的开源库,用于在浏览器或节点环境中运行机器学习模型和深度学习神经网络。
tf.sqrt()函数用于返回指定张量元素的平方根。
用法:
tf.sqrt( x )
参数:该函数接受单个参数,如下所示:
- x:指定的输入张量。
返回值:它返回指定张量元素的平方根。
范例1:
Javascript
// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
// Initializing a tensor of some elements
const x = tf.tensor1d([4, 9, 16, 25]);
// Calling the .sqrt() function over
// the above tensor as its parameter
x.sqrt().print();
输出:
Tensor [2, 3, 4, 5]
范例2:
Javascript
// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
// Using a tensor of some elements
// as the parameter for the .sqrt() function
tf.tensor1d([0, 1, 2, 1.7, 2.5]).sqrt().print();
输出:
Tensor [0, 1, 1.4142135, 1.3038405, 1.5811388]
相关用法
- PHP imagecreatetruecolor()用法及代码示例
- p5.js year()用法及代码示例
- d3.js d3.utcTuesdays()用法及代码示例
- PHP ImagickDraw getTextAlignment()用法及代码示例
- PHP Ds\Sequence last()用法及代码示例
- PHP Imagick floodFillPaintImage()用法及代码示例
- PHP array_udiff_uassoc()用法及代码示例
- PHP geoip_continent_code_by_name()用法及代码示例
- d3.js d3.map.set()用法及代码示例
- PHP GmagickPixel setcolor()用法及代码示例
- PHP opendir()用法及代码示例
- PHP cal_to_jd()用法及代码示例
- d3.js d3.bisectLeft()用法及代码示例
- PHP stream_get_transports()用法及代码示例
- PHP Ds\Deque pop()用法及代码示例
- PHP SimpleXMLElement children()用法及代码示例
注:本文由纯净天空筛选整理自Kanchan_Ray大神的英文原创作品 Tensorflow.js tf.sqrt() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。