ztcl::tensor tanh
Gives the hyperbolic tangent of each element.
ztcl::tensor tanh TENSOR
Description
Gives a tensor of the shape and the dtype of TENSOR with the hyperbolic tangent of each element. It needs a float dtype. A NaN result is the plain NaN. In a build that links libc, exp, log, sin, and cos are the functions of the libm of the host, as in expr.
Returns
A tensor.
Examples
Each example of this page runs after package require ztcl::tensor.
% ztcl::tensor tanh [ztcl::tensor of {-1 0 2} -dtype f64]
tensor f64 3 {-0.7615941559557649 0.0 0.9640275800758169}
Errors
% ztcl::tensor tanh [ztcl::tensor ones 2 i32]
tensor tanh: the operation needs a float dtype
-errorcode ZTCL TENSOR
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.4
- Compute cost
- A cost for each element operation by its kind (a copy, an add, a division, a math function, a multiply-add of a matmul), set so that one compute unit takes about the time of one unit of plain Tcl. docs/modules/tensor.md has the table.