d2l

d2l之线性代数

一、降维 1、求和 对一个n维数组进行求和,如果指定沿哪一个轴来通过求和降低维度。如下是降低0维: A = torch.arange(20, dtype=torch.float32).reshape(5,4) print(A) print(A.sum(axis=0)) /* tensor([[ 0. ......
线性代数 代数 线性 d2l d2

d2l之部分数据操作

一、广播机制 两个张量进行运算(加减乘除幂等) 如果两个张量形状相同则很容易进行运算,如果两个张量不同的时候该如何进行运算呢? 1、a张量竖为1,b张量横为1 比如:a = torch.arange(3).reshape((3, 1)), b = torch.arange(2).reshape((1 ......
部分 数据 d2l d2 2l

【d2l】【常见函数】【20】 torch.bmm( )

**局部矩阵乘法** 参考:https://pytorch.org/docs/stable/generated/torch.bmm.html ![image](https://img2023.cnblogs.com/blog/3240132/202307/3240132-20230729221513 ......
函数 常见 torch d2l bmm

【d2l】【常见函数】【19】 torch.squeeze( ), torch.unsqueeze( )

## torch.squeeze() **压缩大小为1的维度** 参考:https://pytorch.org/docs/stable/generated/torch.squeeze.html ![image](https://img2023.cnblogs.com/blog/3240132/202 ......
torch 函数 unsqueeze 常见 squeeze

【d2l】【常见函数】【17】 torch.rand( (size) )

**返回一个指定size的张量,元素是0~1之间的随机数** 参考: https://pytorch.org/docs/stable/generated/torch.rand.html ![image](https://img2023.cnblogs.com/blog/3240132/202307/ ......
函数 常见 torch rand size

【d2l】【常见函数】【16】 torch.repeat_interleave( )

参考:https://pytorch.org/docs/stable/generated/torch.repeat_interleave.html ![image](https://img2023.cnblogs.com/blog/3240132/202307/3240132-20230729132 ......

【d2l】【困难代码】【2】 output, state = self.rnn(X_and_context, state)

## 问题来源 【d2l】9.7 序列到序列学习 ![image](https://img2023.cnblogs.com/blog/3240132/202307/3240132-20230728143550788-834842676.png) ![image](https://img2023.cn ......
state X_and_context context 代码 output

【d2l】【常见函数】【15】 nn.init.xavier_uniform_

**Xavier是一种很好的参数初始化方法** ## 参考1:https://pytorch.org/docs/stable/nn.init.html ![](https://img2023.cnblogs.com/blog/3240132/202307/3240132-20230728113341 ......
xavier_uniform_ 函数 常见 uniform xavier

【d2l】【困难代码】【1】 9.7 损失函数

## 问题描述 ![image](https://img2023.cnblogs.com/blog/3240132/202307/3240132-20230727222203596-1337268636.png) **神の代码秀我一脸,来搞懂一下** ## 问题解决 ### 1. torch.ten ......
函数 损失 代码 d2l 9.7

【d2l】【常见函数】【13】 nn.Linear( )

**只对输入的张量的最后一个维度做全连接** 参考:https://pytorch.org/docs/stable/generated/torch.nn.Linear.html ## 问题来源 ![image](https://img2023.cnblogs.com/blog/3240132/202 ......
函数 常见 Linear d2l d2

【d2l】【常见函数】【12】 torch.tensor.repeat( )

**Repeats this tensor along the specified dimensions.** 参考:https://pytorch.org/docs/stable/generated/torch.Tensor.repeat.html ![image](https://img2023 ......
函数 常见 tensor repeat torch

【d2l】【常见函数】【11】 nn.GRU()

**门控循环神经网络的API** ## 问题来源 【动手学深度学习】【9.7 序列到序列学习】 ![](https://img2023.cnblogs.com/blog/3240132/202307/3240132-20230727102220211-1147333498.png) 这个output ......
函数 常见 d2l GRU d2

【d2l】【常见函数】【9】 nn.Embedding()

**将输入的序列转换词向量** 转载:https://www.jianshu.com/p/63e7acc5e890 ,本帖仅用于学习,**请给原博主点赞** 参考:https://pytorch.org/docs/stable/generated/torch.nn.Embedding.html ## ......
函数 Embedding 常见 d2l d2

【d2l】【常见函数】【8】 super(self) 和 super(class, self)

**python2 必须使用super(class, self), python3 两者都可以** ## 问题来源 【动手学深度学习】https://zh-v2.d2l.ai/chapter_recurrent-modern/encoder-decoder.html 9.6 编码器-解码器架构 ![ ......
super self 函数 常见 class

【d2l】【常见函数】【6】 detach()、detach_()

**都是pytorch里的方法,作用是让当前张量停止进入计算图** ![](https://img2023.cnblogs.com/blog/3240132/202307/3240132-20230725215944489-2002283268.png) 具体的区别参考:https://cloud. ......
detach 函数 常见 d2l d2

【d2l】【常见函数】【3】 tensor.argmax( )

**从张量的特定维度上取出最大的元素值所对应的索引** ![image](https://img2023.cnblogs.com/blog/3240132/202307/3240132-20230725171324146-1686065685.png) ![image](https://img202 ......
函数 常见 argmax tensor d2l

【d2l】【常见函数】【2】 torch.tensor.to(device)

**指定读取张量的设备,如GPU,CPU** 参考:https://blog.csdn.net/shaopeng568/article/details/95205345 ![image](https://img2023.cnblogs.com/blog/3240132/202307/3240132- ......
函数 常见 tensor device torch

【d2l 问题记录】【1】 视频55 从零实现rnn

![image](https://img2023.cnblogs.com/blog/3240132/202307/3240132-20230725102137947-856015834.png) ```python H, = state ``` 这句代码我真是看懵逼了。 ## 1 元组的打包和解包 ......
问题 视频 d2l rnn d2

colab 导入d2l包

本地电脑木得GPU,自己CPU训练模型贼慢,于是打算来colab训练 我本来是这样导入 !pip install d2l 结果导入很慢,等待时间过长,就去网上搜了搜 !pip install d2l==0.14 加了版本号就变得很快了。(现在更新到0.15.1了,但不影响) ......
colab d2l 2l d2
共19篇  :1/1页 首页上一页1下一页尾页