(v)
return legal
Checks that tensor is not NaN or Inf.

    Inputs:
        v (tensor): tensor to be checked
Checks that tensor is not NaN or Inf.
Checks that tensor is not NaN or Inf .
def is_legal(v):
    """
    Checks that tensor is not NaN or Inf.

    Inputs:
        v (tensor): tensor to be checked

    """
    legal = not torch.isnan(v).any() and not torch.isinf(v)

    return legal
def is_legal ( v ) : legal = not torch . isnan ( v ) . any ( ) and not torch . isinf ( v ) return legal