import torch


def sign(input, *args, **kwargs):
    """
    Returns a tree of new tensors with the signs of the elements of input.

    Examples::

        >>> import torch
        >>> import treetensor.torch as ttorch
        >>> ttorch.sign(ttorch.tensor([12, 0, -3]))
        tensor([ 1,  0, -1])

        >>> ttorch.sign(ttorch.tensor({
        ...     'a': [12, 0, -3],
        ...     'b': {'x': [[-3, 1], [0, -2]]},
        ... }))
        <Tensor 0x7f1c81d02d30>
        ├── a --> tensor([ 1,  0, -1])
        └── b --> <Tensor 0x7f1c81d02a60>
            └── x --> tensor([[-1,  1],
                              [ 0, -1]])
    """
    return torch.sign(input, *args, **kwargs)