1 Star 0 Fork 0

Fighting/virtual_drawing_board

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
model.py 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
gursi26 提交于 2021-03-30 14:43 +08:00 . draw and erase functions added
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)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jscc/virtual_drawing_board.git
git@gitee.com:jscc/virtual_drawing_board.git
jscc
virtual_drawing_board
virtual_drawing_board
improved-eraser

搜索帮助