maxframe.tensor.sinh#

maxframe.tensor.sinh(x, out=None, where=None, **kwargs)[源代码]#

双曲正弦,逐元素计算。

等价于 1/2 * (mt.exp(x) - mt.exp(-x))-1j * mt.sin(1j*x)

参数:
  • x (array_like) -- 输入张量。

  • out (Tensor, None, or tuple of Tensor and None, optional) -- 用于存储结果的位置。如果提供了该参数,则其形状必须可以广播到输入形状。如果未提供或为 None,则返回一个新分配的张量。元组(仅能作为关键字参数)的长度必须等于输出的数量。

  • where (array_like, optional) -- 值为 True 表示在该位置计算 ufunc,值为 False 表示保留输出中的原值。

  • **kwargs

返回:

y -- 对应的双曲正弦值。

返回类型:

Tensor

备注

如果提供了 out,函数会将结果写入其中,并返回对 out 的引用。(参见示例)

引用

M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. New York, NY: Dover, 1972, pg. 83.

示例

>>> import maxframe.tensor as mt
>>> mt.sinh(0).execute()
0.0
>>> mt.sinh(mt.pi*1j/2).execute()
1j
>>> mt.sinh(mt.pi*1j).execute() # (exact value is 0)
1.2246063538223773e-016j
>>> # Discrepancy due to vagaries of floating point arithmetic.
>>> # Example of providing the optional output parameter
>>> out1 = mt.zeros(1)
>>> out2 = mt.sinh([0.1], out1)
>>> out2 is out1
True
>>> # Example of ValueError due to provision of shape mis-matched `out`
>>> mt.sinh(mt.zeros((3,3)),mt.zeros((2,2))).execute()
Traceback (most recent call last):
...
ValueError:  operators could not be broadcast together with shapes (3,3) (2,2)