Solved by pascal_notsawo in post #2 
              
              
                This is because you don’t initialize correctly the main class (nn.Module) that temp inherits. 
Change super(temp).__init__() to super(temp, self).__init__() or super().__init__(), and the problem will be solved.