Solved by Nikronic in post #2 
              
              
                Hi, 
PyTorch uses a semantic called autograd to handle backward operations automatically. So the only thing you need to take care of is the forward pass of your custom layer. 
First you define a class that extends torch.nn.Module: 
class Multiply(nn.Module):
  def __init__(self):
    super(Multiply,…