代码拉取完成,页面将自动刷新
import torch
class Model(torch.nn.Module):
def __init__(self):
super(Model, self).__init__()
self.linear1 = torch.nn.Linear(63,1000)
self.bn1 = torch.nn.BatchNorm1d(1000)
self.linear2 = torch.nn.Linear(1000,1000)
self.bn2 = torch.nn.BatchNorm1d(1000)
self.linear3 = torch.nn.Linear(1000,500)
self.bn3 = torch.nn.BatchNorm1d(500)
self.linear4 = torch.nn.Linear(500,200)
self.bn4 = torch.nn.BatchNorm1d(200)
self.linear5 = torch.nn.Linear(200,50)
self.output = torch.nn.Linear(50,1)
self.relu = torch.nn.ReLU()
self.sigmoid = torch.nn.Sigmoid()
def forward(self,x):
out = self.relu(self.bn1(self.linear1(x)))
out = self.relu(self.bn2(self.linear2(out)))
out = self.relu(self.bn3(self.linear3(out)))
out = self.relu(self.bn4(self.linear4(out)))
out = self.relu(self.linear5(out))
out = self.sigmoid(self.output(out))
return out
def test():
model = Model()
noise = torch.randn((20,63))
out = model.forward(noise)
print(out.shape)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。