oneflow.isnan

oneflow.isnan(input)Tensor

This function is equivalent to PyTorch’s isnan function. The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.isnan.html?highlight=isnan#torch.isnan

Returns a new tensor with boolean elements representing if each element of input is NaN or not.

Parameters

input (Tensor) – the input tensor.

Returns

A boolean tensor that is True where input is NaN and False elsewhere.

Example:

>>> import oneflow as flow
>>> flow.isnan(flow.tensor([1, float('nan'), 2]))
tensor([False,  True, False], dtype=oneflow.bool)