
pytorch
qq_40441895
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
机器翻译
机器翻译和数据集机器翻译(MT):将一段文本从一种语言自动翻译为另一种语言,用神经网络解决这个问题通常称为神经机器翻译(NMT)。 主要特征:输出是单词序列而不是单个单词。 输出序列的长度可能与源序列的长度不同。import osos.listdir('/home/kesci/input/')import syssys.path.append('/home/kesci/input/d2...原创 2020-02-17 10:53:26 · 248 阅读 · 0 评论 -
ModernRNN
载入数据集import osos.listdir('/home/kesci/input')import numpy as npimport torchfrom torch import nn, optimimport torch.nn.functional as Fimport syssys.path.append("../input/")import d2l_jay94...原创 2020-02-17 19:17:44 · 132 阅读 · 0 评论 -
循环神经网络
import torchimport torch.nn as nnimport timeimport mathimport syssys.path.append("/home/kesci/input")import d2l_jay9460 as d2l(corpus_indices, char_to_idx, idx_to_char, vocab_size) = d2l.load...原创 2020-02-17 19:21:39 · 228 阅读 · 0 评论 -
文本预处理
import collectionsimport redef read_time_machine(): with open('/home/kesci/input/timemachine7163/timemachine.txt', 'r') as f: lines = [re.sub('[^a-z]+', ' ', line.strip().lower()) for ...原创 2020-02-17 10:54:55 · 170 阅读 · 0 评论 -
进阶网络神经
#目前GPU算力资源预计17日上线,在此之前本代码只能使用CPU运行。#考虑到本代码中的模型过大,CPU训练较慢,#我们还将代码上传了一份到 https://www.kaggle.com/boyuai/boyu-d2l-modernconvolutionalnetwork#如希望提前使用gpu运行请至kaggle。import timeimport torchfrom torc...原创 2020-02-17 10:54:33 · 186 阅读 · 0 评论 -
lenet
#importimport syssys.path.append("/home/kesci/input")import d2lzh1981 as d2limport torchimport torch.nn as nnimport torch.optim as optimimport time#netclass Flatten(torch.nn.Module): #展平操...原创 2020-02-17 19:22:52 · 212 阅读 · 0 评论 -
卷积神经网络基础
import torch import torch.nn as nndef corr2d(X, K): H, W = X.shape h, w = K.shape Y = torch.zeros(H - h + 1, W - w + 1) for i in range(Y.shape[0]): for j in range(Y.shape[...原创 2020-02-17 19:22:15 · 170 阅读 · 0 评论 -
梯度消失,梯度爆炸
%matplotlib inlineimport torchimport torch.nn as nnimport numpy as npimport pandas as pdimport syssys.path.append("/home/kesci/input")import d2lzh1981 as d2lprint(torch.__version__)to...原创 2020-02-17 08:09:08 · 153 阅读 · 0 评论 -
过拟合欠拟合及其解决方案
%matplotlib inlineimport torchimport numpy as npimport syssys.path.append("/home/kesci/input")import d2lzh1981 as d2lprint(torch.__version__)初始化模型参数n_train, n_test, true_w, true_b = 100, ...原创 2020-02-17 08:08:28 · 274 阅读 · 0 评论 -
多层感知机
可以看出,ReLU函数只保留正数元素,并将负数元素清零。为了直观地观察这一非线性变换,我们先定义一个绘图函数xyplot。%matplotlib inlineimport torchimport numpy as npimport matplotlib.pyplot as pltimport syssys.path.append("/home/kesci/input")impo...原创 2020-02-14 19:56:01 · 128 阅读 · 0 评论 -
线性回归
import torchimport time# init variable a, b as 1000 dimension vectorn = 1000a = torch.ones(n)b = torch.ones(n)# define a timer class to record timeclass Timer(object): """Record multi...原创 2020-02-13 17:47:44 · 199 阅读 · 1 评论