pytorch

PyTorch_ConvLSTM代码(参数)解读笔记

二次信任 提交于 2020-11-04 17:26:56
原代码链接: ConvLSTM_pytorch 参考资料: LSTM的参数解释 Pytorch-LSTM输入输出参数 ConvLSTM参数详解(Keras) 1.导入pytorch import torch import torch . nn as nn 2.构建ConvLSTMCell class ConvLSTMCell ( nn . Module ) : #这里面全都是数,衡量后面输入数据的维度/通道尺寸 def __init__ ( self , input_dim , hidden_dim , kernel_size , bias ) : super ( ConvLSTMCell , self ) . __init__ ( ) self . input_dim = input_dim self . hidden_dim = hidden_dim #卷积核为一个数组 self . kernel_size = kernel_size #填充为高和宽分别填充的尺寸 self . padding_size = kernel_size [ 0 ] // 2 , kernel_size [ 1 ] // 2 self . bias = bias self . conv = nn . Conv2d ( self . input_dim + self . hidden_dim , 4 *

Pytorch报错记录

£可爱£侵袭症+ 提交于 2020-10-31 08:51:49
1.BrokenPipeError 执行以下命令时: a,b = iter(train_loader).next() 报错:BrokenPipeError: [Errno 32] Broken pipe 错误原因 :子进程原因 On Windows the subprocesses will import (i.e. execute) the main module at start. You need to insert an if __name__ == '__main__': guard in the main module to avoid creating subprocesses recursively. 解决方法: Please see my edited response where I did exactly that. The requirement for wrapping the code inside of if __name__ == '__main__' code isn't immediately obvoius, as it is only required for Windows machines.就是说在windows下必须将上面的代码打包在if __name__ == '__main__'语句下面。这时不会报错了。 还有人说:I also

Cs231n-assignment 2作业笔记

岁酱吖の 提交于 2020-10-31 03:18:05
assignment 2 assignment2讲解参见: https://blog.csdn.net/BigDataDigest/article/details/79286510 http://www.cnblogs.com/daihengchen/p/5765142.html 最后一个作业Q5基于Tensorflow和Pytorch,将会需要在GPU上运行。 1. softmax_loss: log_probs[range(N), y]:从log_probs中取出纵值为yi,即正确标签,横值图像数,即从log_probs中取出y所指向的正确类的概率值,得到是一个[N,]数组,加和后除以N,即为softmax_loss。 2.关于batch normalization: 参见:https://www.cnblogs.com/guoyaohua/p/8724433.html 参见:https://www.cnblogs.com/skyfsm/p/8453498.html 反向传播参见:https://zhuanlan.zhihu.com/p/26138673 https://blog.csdn.net/kevin_hee/article/details/80783698 基本流程:减去均值(mini-batch mean)、除以方差(normalize)、scale and