def scale_tensor_to_0_1(tensor):
    """Scales a tensor to values between 0 and 1.

    Args:
        tensor (torch.tensor): Input tensor.

    Returns:
        Tensor: Scaled input tensor.
    """
    tensor = tensor.add(abs(tensor.min()))
    tensor = tensor.div(tensor.max())
    return tensor