Tensorflow.js是一个开放源代码库,由Google开发,用于在浏览器或节点环境中运行机器学习模型以及深度学习神经网络。
.cosh()函数用于查找指定张量输入的双曲余弦,并且逐元素完成。
用法:
tf.cosh(x)
Parameters:
- x:它是要计算其cosh值的张量输入,可以是tf.Tensor,TypedArray或Array类型。
返回值:它返回tf.Tensor对象。
范例1:在这个例子中,我们定义一个整数类型的输入张量,然后打印它的cosh值。为了创建输入张量,我们使用.tensor1d()方法,为了打印输出,我们使用.print()方法。
Javascript
// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
// Defining tensor input elements
const y = tf.tensor1d([1, 7, 0, 3]);
// Calling cosh() method and
// printing output
y.cosh().print();
输出:
Tensor [1.5430806, 548.3170776, 1, 10.0676613]
范例2:在此示例中,浮点类型值被视为张量输入,并且参数直接传递给cosh函数。
Javascript
// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
// Defining float values
var val = [1.5, .4, .22];
// Calling tensor1d method
const y = tf.tensor1d(val);
// Calling cosh() method
var res = tf.cosh(y)
// Printing output
res.print();
输出:
Tensor [2.3524094, 1.0810723, 1.0242977]
相关用法
- PHP imagecreatetruecolor()用法及代码示例
- p5.js year()用法及代码示例
- d3.js d3.utcTuesdays()用法及代码示例
- PHP ImagickDraw getTextAlignment()用法及代码示例
- PHP Ds\Sequence last()用法及代码示例
- 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()用法及代码示例
- p5.js removeElements()用法及代码示例
注:本文由纯净天空筛选整理自nidhi1352singh大神的英文原创作品 Tensorflow.js tf.cosh() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。