Thanks for your reply. However, using self.tanh(input.clone()) gives me the same error.
Nonetheless, we did manage to find a similar temporal workaround
class _DefineBinarization(Function):
    '''As this binarization process does not change expectation,
    we pass the gradient unchanged.
    '''
    @staticmethod
    def forward(ctx, input):
        p = torch.bernoulli((1+input)/2).to(torch.bool)
        np = torch.bitwise_not(p)
        new_input = input.clone()
        new_input[p] = 1
        new_input[np] = -1
        return new_input

    @staticmethod
    def backward(ctx, grad):
        # input = ctx.saved_tensors
        return grad

Still confused why the error was thrown and why this temporary fix worked.