- 博客(10)
- 收藏
- 关注
原创 Advanced RNN - Pytorch
笔记来自课程《Pytorch深度学习实践》Lecture 13部分内容来自博主Biranda的博客RNN Classifier实现一个根据名字判断所属国家的分类器,数据如下:在传统RNN网络结果中,o1...on是作为seq to seq的的序列输出,如下图:在本题中,由于无法得到序列性质的准确输出结果,而我们的问题范围也仅限于对序列的总体情况进行分类。因此可以将网络简化为如下图所示的情况:即序列依次经过嵌入层和RNN Cell后得到最终的隐藏状态hn,利用最终的隐.
2021-08-06 12:03:42 139
原创 Python 面向对象的相关语法
__init__()首先,两个下划线开头的函数是声明该属性为私有,不能在类的外部被使用或访问。__init__()支持带参数类的初始化,也可为声明该类的属性(类中的变量)。__init__函数(方法)的第一个参数必须为self,后续参数为自己定义。__init__()又被称为构造器(constructor)。例如:class studetn: # 定义一个类名为studetn def __init__(self,idx): # 定义初始化构造,这里使用init,
2021-08-05 13:00:32 87
原创 RNN - Pytorch
笔记来自课程《Pytorch深度学习实践》Lecture 12RNN结构RNN Cellcell = torch.nn.RNNCell(input_size=input_size, hidden_size=hidden_size) hidden = cell(input, hidden)cell()中的input - input of shape (batch, input_size)cell()中的hidden - hidden of shape (batch, hidd
2021-08-04 15:38:08 204
原创 Advanced CNN - Inception Module from GoogleNet - Pytorch
笔记来自课程《Pytorch深度学习实践》Lecture 11GoogleNet示意图可以看到其中有许多重复的部分,叫做Inception moduleInception Module1X1的卷积可以起到信息融合的作用,还可以降低计算量Inception Module 的实现拼接是按照通道的维度进行,最终的输出通道数为24+16+24+24=88整合之后的代码:class InceptionA(nn.Module): def __i...
2021-08-04 12:20:49 150
原创 Basic CNN - Pytorch
笔记来自课程《Pytorch深度学习实践》Lecture 10import torchin_channels, out_channels= 5, 10 width, height = 100, 100 kernel_size = 3batch_size = 1input = torch.randn(batch_size, in_channels, width, he
2021-08-04 11:29:49 156
原创 多分类;Softmax Classifier;MINST - Pytorch
笔记来自课程《Pytorch深度学习实践》Lecture 9交叉熵import torchy = torch.LongTensor([0])z = torch.Tensor([[0.2, 0.1, -0.1]]) criterion = torch.nn.CrossEntropyLoss()loss = criterion(z, y) print(loss)torch.Tensor默认是torch.FloatTensor是32位浮点类型数据,torch.LongTensor是64
2021-08-04 10:33:43 146
原创 Dataset和DataLoader - Pytorch
笔记来自课程《Pytorch深度学习实践》Lecture 8术语:Epoch,Batch Size,IterationsEpoch:One forward pass and one backward pass of all the training examples.Batch size:The number of training examples in one forward backward pass.Iterations:Number of passes, each pass .
2021-08-03 16:52:36 452
原创 Logistic Regression - Pytorch
笔记来自课程《Pytorch深度学习实践》Lecture 6Linear Regression v.s. Logistic RegressionLinear Regression 代码:class LinearModel(torch.nn.Module): def __init__(self): super(LinearModel, self).__init__() self.linear = torch.nn.Linear(1, 1)
2021-08-03 16:00:30 358
原创 线性回归 Pytorch
笔记来自课程《PyTorch深度学习实践》Lecture5利用pytorch进行深度学习的基本思路/步骤:1. 准备数据集2. 定义模型(使用class,继承自nn.Module)3. 构建loss和optimizer(使用pytorch API)4. Training cycle(forward,backward,update)1. 准备数据集import torchx_data = torch.Tensor([[1.0], [2.0], [3.0]])y_dat
2021-08-03 15:45:05 317
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人