mindspore.ops.coo_sigmoid

View Source On Gitee
mindspore.ops.coo_sigmoid(x: COOTensor)[source]

Sigmoid activation function.

Computes Sigmoid of input element-wise. The Sigmoid function is defined as:

\[\text{coo_sigmoid}(x_i) = \frac{1}{1 + \exp(-x_i)}\]

where \(x_i\) is an element of the x.

Parameters

x (COOTensor) – Input COOTensor, the data type is float16, float32, float64, complex64 or complex128.

Returns

COOTensor, with the same type and shape as the x.

Raises
  • TypeError – If dtype of x is not float16, float32, float64, complex64 or complex128.

  • TypeError – If x is not a COOTensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import dtype as mstype
>>> from mindspore import Tensor, ops, COOTensor
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
>>> values = Tensor([-1, 2], dtype=mstype.float32)
>>> shape = (3, 4)
>>> x = COOTensor(indices, values, shape)
>>> output = ops.coo_sigmoid(x)
>>> print(output.values)
[0.26894143 0.8807971 ]