TensorPlay
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-15

tensorplay.functional.logical_not

tensorplay.functional.logical_not(input, *, out=None) → Tensor[source]

Computes the element-wise logical NOT of the given input tensor. If not specified, the output tensor will have the bool dtype. If the input tensor is not a bool tensor, zeros are treated as False and non-zeros are treated as True.

Parameters:

input (Tensor) – the input tensor.

Keyword Arguments:

out (Tensor, optional) – the output tensor.

Example:

>>> tensorplay.logical_not(tensorplay.tensor([True, False]))
tensor([False,  True])
>>> tensorplay.logical_not(tensorplay.tensor([0, 1, -10], dtype=tensorplay.int8))
tensor([ True, False, False])
>>> tensorplay.logical_not(tensorplay.tensor([0., 1.5, -10.], dtype=tensorplay.double))
tensor([ True, False, False])
>>> tensorplay.logical_not(tensorplay.tensor([0., 1., -10.], dtype=tensorplay.double), out=tensorplay.empty(3, dtype=tensorplay.int16))
tensor([1, 0, 0], dtype=tensorplay.int16)

On this page

Ask DeepWiki