This is a class I wrote than subclass nn.Module and let modules implement __call__ instead of forward. I did this to get better type checking and type inference in python.
This module uses __init_subclass__ set the __call__ method of it’s subclasses to forward so that it doesn’t mess up with nn.Module hooks and stuff. I’ve been using this for a while and hasn’t encountered problems.