albanD:

What are the types of the inputs to your function? Do you have at least one Tensor that requires gradients there?


This was the problem, i accidentially called it with self.parameters() and not *[p for p in self.self.parameters()]