torch.isnan — PyTorch 1.10.1 documentation
pytorch.org › docs › stabletorch.isnan(input) → Tensor. Returns a new tensor with boolean elements representing if each element of input is NaN or not. Complex values are considered NaN when either their real and/or imaginary part is NaN. Parameters. input ( Tensor) – the input tensor. Returns. A boolean tensor that is True where input is NaN and False elsewhere.
torch.where — PyTorch 1.10.1 documentation
pytorch.org › docs › stabletorch.where. Return a tensor of elements selected from either x or y, depending on condition. The operation is defined as: The tensors condition, x, y must be broadcastable. Currently valid scalar and tensor combination are 1. Scalar of floating dtype and torch.double 2. Scalar of integral dtype and torch.long 3.