摘要: Inception Moudel import torch import torch.nn as nn from torchvision import transforms from torchvision import datasets from torch.utils.data import D 阅读全文
posted @ 2021-12-27 17:44 小Aer 阅读(5) 评论(0) 推荐(0) 编辑
摘要: import torch from torchvision import transforms from torchvision import datasets from torch.utils.data import DataLoader import torch.nn.functional as 阅读全文
posted @ 2021-12-27 17:38 小Aer 阅读(5) 评论(0) 推荐(0) 编辑
摘要: import torch from torchvision import transforms from torchvision import datasets from torch.utils.data import DataLoader import torch.nn.functional as 阅读全文
posted @ 2021-12-27 17:38 小Aer 阅读(5) 评论(0) 推荐(0) 编辑
摘要: import torch import numpy as np from torch.utils.data import Dataset, DataLoader class DiabetesDataset(Dataset): def __init__(self, filepath): xy = np 阅读全文
posted @ 2021-12-27 17:37 小Aer 阅读(3) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import torch import matplotlib.pyplot as plt # prepare dataset xy = np.loadtxt('./diabetes.csv', delimiter=',', dtype=np.float32) x 阅读全文
posted @ 2021-12-27 17:36 小Aer 阅读(6) 评论(0) 推荐(0) 编辑
摘要: import torch x_data = torch.tensor([[1.0], [2.0], [3.0]]) y_data = torch.tensor([[0.], [0.], [1.]]) class LogisticRessionModel(torch.nn.Module): def _ 阅读全文
posted @ 2021-12-27 17:35 小Aer 阅读(4) 评论(0) 推荐(0) 编辑
摘要: import torch # x, y是矩阵,3行1列,也就是说总共有3个数据,每个数据只有1个特征 x_data = torch.tensor([[1.0], [2.0], [3.0]]) y_data = torch.tensor([[2.0], [4.0], [6.0]]) # design 阅读全文
posted @ 2021-12-27 17:33 小Aer 阅读(5) 评论(0) 推荐(0) 编辑
摘要: # 小试牛刀 # import torch # a = torch.tensor([1.0]) # a.requires_grad = True # 或者 a.requires_grad_() # print(a) # tensor([1.], requires_grad=True) # print 阅读全文
posted @ 2021-12-27 17:28 小Aer 阅读(1) 评论(0) 推荐(0) 编辑
摘要: import matplotlib.pylab as plt x_data = [1.0, 2.0, 3.0] y_data = [2.0, 4.0, 6.0] w = 1.0 def forward(x): return x * w def cost(xs, ys): cost = 0 for x 阅读全文
posted @ 2021-12-27 17:27 小Aer 阅读(3) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import matplotlib.pyplot as plt x_data = [1.0, 2.0, 4.0] y_data = [2.0, 4.0, 8.0] def forward(x): return x * w def loss(x_val, y_va 阅读全文
posted @ 2021-12-27 17:26 小Aer 阅读(4) 评论(0) 推荐(0) 编辑