![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Pytorch
WeilingDu
Github: https://github.com/WeilingDu
展开
-
基于PyTorch的CNN、RNN、LSTM使用记录
MRCNN复现笔记Conv2dhttps://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html#torch.nn.Conv2dLinnearhttps://pytorch.org/docs/stable/generated/torch.nn.Linear.html#torch.nn.LinearDropouthttps://pytorch.org/docs/stable/tensors.html?highlight=原创 2020-10-16 15:55:30 · 754 阅读 · 0 评论 -
Deep Learning与PyTorch学习过程中的零散知识点整理(二)
one-hot vs embeddingOne-hot: 高维,稀疏,难编码Embedding:低维,稠密,从数据中习得self.emb = torch.nn.Embedding(input_size, embedding_size)注意:Embedding要确定的参数是:num_embedding: the size of the dictionary of embeddingembedding_dim: the size of each embedding vector输入的数原创 2020-09-20 08:16:58 · 185 阅读 · 0 评论 -
PyTorch实现RNN(两种构造RNN的方式;序列到序列的训练)
RNN pytorch在PyTorch中有两种构造RNN的方式:一种是构造RNNCell,然后自己写循环;一种是直接构造RNN。第一种:构造RNNCell,然后自己写循环构造RNNCell需要两个参数:input_size和hidden_size。cell = torch.nn.RNNCell(input_size=input_size, hidden_size=hidden_size)使用RNNCellhidden = cell(input, hidden)调用时,将当前输入原创 2020-09-16 21:14:21 · 4341 阅读 · 0 评论 -
PyTorch实现CNN处理MNIST数据集
CNN生成随机数Tensor的方法汇总:https://blog.csdn.net/dream161110/article/details/80293715将矩阵化为Tensor:input = torch.Tensor(矩阵).view(batch, input channel, width, height)得到的input为Tensor数据类型。卷积层对于某个卷积层:kernel sizekernel number = output channelstride其输入原创 2020-09-16 14:04:27 · 611 阅读 · 0 评论 -
Deep Learning与PyTorch学习过程中的零散知识点整理(一)
零散知识点整理(一)端到端的学习end-to-end learning:传统机器学习的流程往往由多个独立的模块组成,比如在一个典型的自然语言处理(Natural Language Processing)问题中,包括分词、词性标注、句法分析、语义分析等多个独立步骤,每个步骤是一个独立的任务,其结果的好坏会影响到下一步骤,从而影响整个训练的结果,这是非端到端的。深度学习模型在训练过程中,从输入端(输入数据)到输出端会得到一个预测结果,与真实结果相比较会得到一个误差,这个误差会在模型中的每一层传递(反向传原创 2020-09-15 20:25:58 · 227 阅读 · 0 评论 -
PyTorch实现Softmax Classifier处理MNIST数据集
Softmax Classifier1. Prepare Dataset神经网络希望输入数据最好是在-1到1之间,最好是正态分布,这样训练的效果最好。所以我们需要把图像的像素值进行转换。from torchvision import transformstransform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.1307, ), (0.3081, ))])transforms.ToTensor()原创 2020-09-15 20:22:00 · 960 阅读 · 0 评论 -
PyTorch实现Logistic Regression (mini-batch,多维特征处理)
1. Logistic Regressionimport torchimport torch.nn.functional as F # functional下有很多函数包x_data = torch.Tensor([[1.0], [2.0], [3.0]]) # 3*1 Tensory_data = torch.Tensor([[0], [0], [1]]) # 3*1 Tensorclass LogisticRegressionModel(torch.nn.Module):原创 2020-09-12 17:23:14 · 1404 阅读 · 0 评论 -
PyTorch实现Linear Regression
Linear Regression1. Prepare datasetnumpy中的广播机制:https://www.cnblogs.com/jiaxin359/p/9021726.htmlimport torchx_data = torch.Tensor([[1.0], [2.0], [3.0]]) # 3*1 Tensory_data = torch.Tensor([2.0], [4.0], [6.0]) # 3*1 Tensor2. Design model using Clas原创 2020-09-11 16:29:03 · 402 阅读 · 0 评论 -
mac pytorch安装过程(anaconda+pycharm配置)
mac pytorch安装过程(anaconda+pycharm配置)装好pytorch之后,在jupter notebook和pycharm中,import torch时报错,但在终端中import就没有报错。发现是因为只在系统环境中安装了pytorch。由于想把包都集合到anaconda中,重新在官网下载。用conda安装pytorch:https://www.jianshu.com/p/377480121388并且可以看到anaconda中有pytorch包:pycharm环境的配置:要设置原创 2020-09-11 13:53:12 · 1292 阅读 · 0 评论