简单的网络:y = x+1
import torch
from torch import nn
class Mymodule(nn.Module):
def __init__(self):
super(Mymodule,self).__init__()
def forward(self,x):
x = x + 1
return x
mymodule = Mymodule()
x = torch.tensor(1.0)
y = mymodule(x)
print(y)