aws_lambda/pytorch/source/torch/functional.py
def isfinite(tensor):
    r"""Returns a new tensor with boolean elements representing if each element is `Finite` or not.

    Arguments:
        tensor (Tensor): A tensor to check

    Returns:
        Tensor: A ``torch.ByteTensor`` containing a 1 at each location of finite elements and 0 otherwise

    Example::

        >>> torch.isfinite(torch.tensor([1, float('inf'), 2, float('-inf'), float('nan')]))
        tensor([ 1,  0,  1,  0,  0], dtype=torch.uint8)
    """
    if not isinstance(tensor, torch.Tensor):
        raise ValueError("The argument is not a tensor", str(tensor))

    # Support int input, nan and inf are concepts in floating point numbers.
    # Numpy uses type 'Object' when the int overflows long, but we don't
    # have a similar concept. It's safe to assume any created LongTensor doesn't
    # overflow and it's finite.
    if not tensor.is_floating_point():
        return torch.ones_like(tensor, dtype=torch.uint8)
    return (tensor == tensor) & (tensor.abs() != inf)
r"""Returns a new tensor with boolean elements representing if each element is `Finite` or not.

    Arguments:
        tensor (Tensor): A tensor to check

    Returns:
        Tensor: A ``torch.ByteTensor`` containing a 1 at each location of finite elements and 0 otherwise

    Example::

        >>> torch.isfinite(torch.tensor([1, float('inf'), 2, float('-inf'), float('nan')]))
        tensor([ 1,  0,  1,  0,  0], dtype=torch.uint8)
    
r"""Returns a new tensor with boolean elements representing if each element is `Finite` or not.
r " " " Returns a new tensor with boolean elements representing if each element is ` Finite ` or not .
def isfinite(tensor):
    if not isinstance(tensor, torch.Tensor):
        raise ValueError("The argument is not a tensor", str(tensor))
    if not tensor.is_floating_point():
        return torch.ones_like(tensor, dtype=torch.uint8)
    return (tensor == tensor) & (tensor.abs() != inf)
def isfinite ( tensor ) : if not isinstance ( tensor , torch . Tensor ) : raise ValueError ( "The argument is not a tensor" , str ( tensor ) ) if not tensor . is_floating_point ( ) : return torch . ones_like ( tensor , dtype = torch . uint8 ) return ( tensor == tensor ) & ( tensor . abs ( ) != inf )
r"""Returns a new tensor with boolean elements representing if each element is `Finite` or not.
r " " " Returns a new tensor with boolean elements representing if each element is ` Finite ` or not .
r"""Returns a new tensor with boolean elements representing if each element is `Finite` or not.

    Arguments:
        tensor (Tensor): A tensor to check

    Returns:
        Tensor: A ``torch.ByteTensor`` containing a 1 at each location of finite elements and 0 otherwise

    Example::

        >>> torch.isfinite(torch.tensor([1, float('inf'), 2, float('-inf'), float('nan')]))
        tensor([ 1,  0,  1,  0,  0], dtype=torch.uint8)
    """ # Support int input, nan and inf are concepts in floating point numbers. # Numpy uses type 'Object' when the int overflows long, but we don't # have a similar concept. It's safe to assume any created LongTensor doesn't # overflow and it's finite.
A ``torch.ByteTensor`` containing a 1 at each location of finite elements and 0 otherwise
A ` ` torch . ByteTensor ` ` containing a 1 at each location of finite elements and 0 otherwise
Tensor
tensor
A tensor to check
A tensor to check