def __init()__和super().__init__()
class test(nn.Module):
def __init__(self,name):
super(test,self).__init__()
self.name = name
def forward(self,x):
return str(x)+self.name
net = test("lrs")
print(net(12))
class test(nn.Module):
def __init__(self,name):
super(test,self).__init__()
self.name = name
def forward(self,x):
return str(x)+self.name
net = test("lrs")
print(net(12))