mindspore/docs/api/api_python/ops/mindspore.ops.Log.rst

39 lines
860 B
ReStructuredText
Raw Normal View History

2021-12-04 13:55:42 +08:00
mindspore.ops.Log
=================
.. py:class:: mindspore.ops.Log(*args, **kwargs)
按元素返回Tensor的自然对数。
.. math::
y_i = log_e(x_i)
.. warning::
如果算子Log的输入值在(00.01]或[0.951.05]范围内,则输出精度可能会发生变化。
**输入:**
2021-12-04 20:36:47 +08:00
- **x** (Tensor) - 输入Tensor。该值必须大于0。shape为 :math:`(N,*)`,其中 :math:`*` 表示任意的附加维度数它的秩应小于8。
2021-12-04 13:55:42 +08:00
**输出:**
Tensor具有与 `x` 相同的shape。
**异常:**
- **TypeError** - `x` 不是Tensor。
**支持平台:**
``Ascend`` ``GPU`` ``CPU``
**样例:**
>>> x = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32)
>>> log = ops.Log()
>>> output = log(x)
>>> print(output)
[0. 0.6931472 1.3862944]