mindspore.ops.csr_relu
- mindspore.ops.csr_relu(x)[源代码]
- 逐元素计算CSRTensor的ReLU(Rectified Linear Unit)激活值。 - 返回 max(x, 0) 的值,其中负值神经元将被设置为0,而正值神经元将保持不变。 \[ReLU(x) = (x)^+ = \max(0, x)\]- 参数:
- x (CSRTensor) - csr_relu的输入。 
 
- 返回:
- CSRTensor,数据类型和shape与 x 相同。 
- 异常:
- TypeError - x 的数据类型不是数值型。 
- TypeError - x 不是CSRTensor。 
 
- 支持平台:
- Ascend- GPU- CPU
 - 样例: - >>> 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_relu(x) >>> print(output.values) [0. 2.]