Computes the Heaviside step function for each element in input
. The Heaviside step function is defined as:
heaviside ( i n p u t , v a l u e s ) = { 0 , if input < 0 v a l u e s , if input == 0 1 , if input > 0 \text{{heaviside}}(input, values) = \begin{cases} 0, & \text{if input < 0}\\ values, & \text{if input == 0}\\ 1, & \text{if input > 0} \end{cases} heaviside(input,values)=⎩ ⎨ ⎧0,values,1,if input < 0if input == 0if input > 0
out (Tensor, optional) – the output tensor.
Example:
>>> input = torch.tensor([-1.5, 0, 2.0]) >>> values = torch.tensor([0.5]) >>> torch.heaviside(input, values) tensor([0.0000, 0.5000, 1.0000]) >>> values = torch.tensor([1.2, -2.0, 3.5]) >>> torch.heaviside(input, values) tensor([0., -2., 1.])
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4