Sorry, I just realized it seems I misunderstood your question. When you say “create function in a nn.Module”, do you mean to implement my function directly in this module (e.g. Linear subclass), and call it in forward function?