import torch


def Binarize(tensor):
    """ 
        Binarize function: binarize input tensors
        Input:
            tensor: the input tensor. 
        Output:
            binarized: the binarized tensor.
    """
    binarized = torch.where(tensor>0, torch.ones_like(tensor,dtype=torch.float32, device='cuda'), torch.full((tensor.shape),-1, dtype=torch.float32, device='cuda'))
    return binarized