pytorch深度学习实践
深度学习实践
小Aer
站在巨人的肩膀上仰望星空
展开
-
Pytorch 深度学习实践 第12讲
import torch from torch.utils.data import Dataset from torch.utils.data import DataLoader import gzip import csv import time import math import matplotlib.pyplot as plt import numpy as np # prepare dataset class NameDataset(Dataset): def __init__(sel原创 2021-12-28 10:08:07 · 216 阅读 · 0 评论 -
Pytorch 深度学习实践 第11讲
import torch import torch.nn as nn def use_rnncell(): batch_size = 1 seq_len = 3 # 假如我们有id = 1,2,3,4,5,6,7,8,9,10一共10个sample。 # 假设我们设定seq_len是3。 # 那现在数据的形式应该为1-2-3,2-3-4,3-4-5,4-5-6,5-6-7,6-7-8,7-8-9,8-9-10,9-10-0,10-0-0(最后两个数据不完整,进行补原创 2021-12-28 10:07:34 · 215 阅读 · 0 评论 -
Pytorch 深度学习实践 第10讲
Inception Moudel import torch import torch.nn as nn from torchvision import transforms from torchvision import datasets from torch.utils.data import DataLoader import torch.nn.functional as F import torch.optim as optim batch_size = 64 transform = tra.原创 2021-12-27 17:44:46 · 165 阅读 · 2 评论 -
Pytorch 深度学习实践 第9讲
import torch from torchvision import transforms from torchvision import datasets from torch.utils.data import DataLoader import torch.nn.functional as F import torch.optim as optim batch_size = 64 transform = transforms.Compose([transforms.ToTensor(), t原创 2021-12-27 17:38:58 · 142 阅读 · 0 评论 -
Pytorch 深度学习实践 第8讲
import torch from torchvision import transforms from torchvision import datasets from torch.utils.data import DataLoader import torch.nn.functional as F import torch.optim as optim # prepare dataset batch_size = 64 transform = transforms.Compose([transf原创 2021-12-27 17:38:24 · 161 阅读 · 0 评论 -
Pytorch 深度学习实践 第7讲
import torch import numpy as np from torch.utils.data import Dataset, DataLoader class DiabetesDataset(Dataset): def __init__(self, filepath): xy = np.loadtxt(filepath, delimiter=',', dtype=np.float32) self.len = xy.shape[0] se原创 2021-12-27 17:37:55 · 322 阅读 · 0 评论 -
Pytorch 深度学习实践 第6讲
import numpy as np import torch import matplotlib.pyplot as plt # prepare dataset xy = np.loadtxt('./diabetes.csv', delimiter=',', dtype=np.float32) x_data = torch.from_numpy(xy[:, :-1]) y_data = torch.from_numpy(xy[:, [-1]]) class Model(torch.nn.Module原创 2021-12-27 17:36:24 · 557 阅读 · 2 评论 -
Pytorch 深度学习实践 第5讲
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 __init__(self): super(LogisticRessionModel, self).__init__() self.linear = torch.nn.原创 2021-12-27 17:35:24 · 463 阅读 · 0 评论 -
Pytorch 深度学习实践 第4讲
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 model using class """ our model class should be inherit from nn.Module, which is base class for all neu原创 2021-12-27 17:33:44 · 342 阅读 · 0 评论 -
Pytorch 深度学习实践 第3讲
# 小试牛刀 # import torch # a = torch.tensor([1.0]) # a.requires_grad = True # 或者 a.requires_grad_() # print(a) # tensor([1.], requires_grad=True) # print(a.data) # tensor([1.]) # print(a.type()) # torch.FloatTensor # print(a.data.type()) # torch.FloatTens原创 2021-12-27 17:28:54 · 500 阅读 · 0 评论 -
Pytorch 深度学习实践 第2讲
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, y in zip(xs, ys): y_pred = forward(x) cost += (y_pred - y) ** 2原创 2021-12-27 17:27:29 · 281 阅读 · 0 评论 -
Pytorch 深度学习实践 第1讲
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_val): y_pred = forward(x_val) return (y_pred - y_val) ** 2 w_list = [] mse_list = [] for原创 2021-12-27 17:26:01 · 656 阅读 · 0 评论 -
Pytorch 深度学习实践 第0讲
第0讲主要放一张学习深度学习流程图,其实这是在学完课程之后的一个补充。原创 2021-12-25 13:43:40 · 561 阅读 · 0 评论