Really sorry about making a mistake in the straight through estimator, probably was half asleep  Thank you very much for the help, my layer is working now after calling the class inherited from Function in my layer inherited from nn.Module