oneflow.nn.functional.relu

oneflow.nn.functional.relu()

Applies the rectified linear unit function element-wise. See ReLU for more details.

Parameters

inplace – If set to True, will do this operation in-place. Default: False

For examples:

>>> import oneflow as flow
>>> import numpy as np

>>> ndarr = np.asarray([1, -2, 3])
>>> input = flow.Tensor(ndarr)
>>> output = flow.relu(input)
>>> output
tensor([1., 0., 3.], dtype=oneflow.float32)