latest (dev)
Copy
Latest development documentation · Updated 2026-10-15
tensorplay.functional.heaviside
- tensorplay.functional.heaviside(input, values, *, out=None) Tensor[source]
Computes the Heaviside step function for each element in
input. The Heaviside step function is defined as:- Parameters:
- Keyword Arguments:
out (Tensor, optional) – the output tensor.
Example:
>>> input = tensorplay.tensor([-1.5, 0, 2.0]) >>> values = tensorplay.tensor([0.5]) >>> tensorplay.heaviside(input, values) tensor([0.0000, 0.5000, 1.0000]) >>> values = tensorplay.tensor([1.2, -2.0, 3.5]) >>> tensorplay.heaviside(input, values) tensor([0., -2., 1.])
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

