I made a custom binarization layer following XNOR-Net implementation 112.
I made the following BinActiveZ layer 82 as an equivalent of the one specified in their code
   class BinaryLayer(Function):

        def forward(self, input):
            return torch.sign(input)

        def backward(self, gradOutput):
            # print("Grad output is: ", gradOutput)
            gradinput = gradOutput.clamp_(-1, 1)
            # print("Grad input is:", gradinput)
            return gradinput

While running it after adding it into my model, I get the following error:
File “/usr/local/lib/python3.5/dist-packages/torch/autograd/variable.py”, line 146, in backward
self._execution_engine.run_backward((self,), (gradient,), retain_variables)
RuntimeError: could not compute gradients for some functions
How do I solve this issue?