You don’t use Function in places where Module is used, i.e. in __init__ of main module. You just invoke MyReLU.apply in forward(). If you want to use Function is containers like nn.Sequential, you must wrap it in a Module.