Solved by Mazhar_Shaikh in post #2 
              
              
                For an nn.Module, the .to(device) function will send all valid members of the module to the device. 
The valid members for this operation is other nn.Modules, Parameters and Buffers. 
For your code, these changes would be required. 
class TestModule(nn.Module):
    def __init__(self, net):
        s…