mindspore.ops.csr_sigmoid

mindspore.ops.csr_sigmoid(x: CSRTensor)[source]

Sigmoid activation function.

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

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

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

Parameters

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

Returns

CSRTensor, 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 CSRTensor.

Supported Platforms:

Ascend GPU CPU

Examples

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