本文主要是介绍造车先做三蹦子-之二:自制数据集(5x5数据集)230102,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#Jupyter Notebook231001import torch
import torch.nn as nn
import torch.optim as optim# 定义模型
class Net(nn.Module):def __init__(self):super(Net, self).__init__()self.fc1 = nn.Linear(25, 50)self.fc2 = nn.Linear(50, 6)def forward(self, x):x = x.view(-1, 25)x = torch.relu(self.fc1(x))x = self.fc2(x)return x# 训练数据
i = [torch.tensor([[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0]], dtype=torch.float32),torch.tensor([[0,0,0,0,0],[0,0,0,0,0],[1,1,1,1,1],[0,0,0,0,0],[0,0,0,0,0]], dtype=torch.float32),torch.tensor([[0,0,1,0,0],[0,0,1,0,0],[1,1,1,1,1],[0,0,1,0,0],[
这篇关于造车先做三蹦子-之二:自制数据集(5x5数据集)230102的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!