Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
DoubleYanLee committed Jan 5, 2021
1 parent 78574ae commit 5f1f96b
Show file tree
Hide file tree
Showing 15 changed files with 208 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added Pytorch深度学习实践/.DS_Store
Binary file not shown.
39 changes: 39 additions & 0 deletions Pytorch深度学习实践/Python深度学习实践.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## 1. Overview

* 培养看文档的能力(当自己的pytorch版本和讲解的不一样的时候)
* 推理 & 预测Prediction
* ILSVRC竞赛 (AlexNet->VGG->GoogleNet->ResNet)
* Back Propagation
* 学会构造模型的套路,然后去构造自己的模型
* Popular learning frameworks
* Theano / TensorFlow / Caffe / PyTorch

## 2. Linear Model

* 三步走:1.准备数据集 2.选择模型 3.训练模型 4.inferring 进行推理
* 模型可能过拟合,所以我们希望模型有很好的泛化功能
* y = x * w 一开始随机产生一个w,然后评估 (y_hat-y)^2来修正w
* visdom



明天先 读英语 + 把线性模型那个作业跑出来 + 完成仿生优化算法的作业 + 看论文 + 看新的视频 + 完成大数据作业+完成自己导师作业 + leetcode12道题



把线性模型那个作业跑出来 + 看论文 + 看新的视频 + 完成大数据作业 + 完成自己导师作业 + leetcode10道题



今日计划:

leetcode每日一题 + 动态规划2道题 + 读英语(单词阅读听力口语)+ 大数据作业写完 + 线性模型跑出来 + 看两个pytorch视频 + 看论文(那一篇文章要看完!!!)



读英语(单词阅读听力) + 线性模型跑出来 + 看两个pytorch视频 + 看论文(那一篇文章要看完!!!)





147 changes: 147 additions & 0 deletions Pytorch深度学习实践/Tensor的算术运算.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
## 四则运算

### 加法 减法 运算

c = torch.add(a, b) -> tensor(3)

c = a + b

a.add(b) a.add_(b)(这里会对a的值进行修改,变成a+b的和)

a .sub(b) a.sub_(b)

### 乘法 除法 运算(对应元素相乘 哈达玛积 element wise)

c = a * b c = torch.mul(a,b) 这个是点乘 也就是对应元素相乘 不是矩阵的那种乘法

a.mul(b) a.mul_(b) a.div(b) a.div__(b)

### 矩阵的乘法

#### 二维矩阵 torch.mm(a,b) torch.matmul(a,b) a @ b

a.matmul(b) a.mm(b) `注意a为 m * n 的矩阵,b就要为 n* p的矩阵`

#### 高维矩阵

![matrix_matmul](/Users/yannie/Desktop/Pytorch/1.png)

### 幂运算

torch.pow(a,2) a.pow(2) a**2 a.pow_(2)

torch.exp(a) 表示e^n a.exp_()

### 开方运算

a.sqrt() a.sqrt_()

### 对数运算

torch.log2(a) torch.log10(a) torch.log(a) -> 默认底数为e torch.log_(a)

#### PyTorch中的in-place操作

* “就地操作”,即不允许使用临时变量

* add_ sub_ mul_

#### PyTorch 中的广播机制

* 张量参数可以自动拓展为相同大小

* 广播机制要满足右对齐

`torch.rand(2,1,1) + torch.rand(3)` 这里3前面会加上两个1变成 113 是否满足对齐要看当前两个元素是否相等或者是否有一个值为1





### Tensor的取整/余运算

![method](/Users/yannie/Desktop/Pytorch/2.png)

#### Tensor的比较运算(其返回的也是一个tensor,由false和true构成 即mask张量)

![](/Users/yannie/Desktop/Pytorch/3.png)

![](/Users/yannie/Desktop/Pytorch/4.png)

![](/Users/yannie/Desktop/Pytorch/5.png)

### Tensor的三角函数和其他的数学函数

![](/Users/yannie/Desktop/Pytorch/6.png)

![](/Users/yannie/Desktop/Pytorch/7.png)

* sigmoid也叫做激活函数 由于符号函数没办法求导,所以有了sigmoid函数
* 通过sigmoid函数 我们的数据会被影射到[0,1]的区间上去

![](/Users/yannie/Desktop/Pytorch/8.png)

![](/Users/yannie/Desktop/Pytorch/9.png)

#### 该看3.15了





























































Binary file added Pytorch深度学习实践/pic/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pytorch深度学习实践/pic/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pytorch深度学习实践/pic/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pytorch深度学习实践/pic/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pytorch深度学习实践/pic/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pytorch深度学习实践/pic/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pytorch深度学习实践/pic/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pytorch深度学习实践/pic/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pytorch深度学习实践/pic/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions Pytorch深度学习实践/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@




class PageRankVertex : public Vertex<Double, Void, Double>
public void Compute(MessageIterator msgs) {
if (superstep() >= 1) {
double sum = 0;
for (Message msg : msgs) {
sum += msg.getValue();
}
this.value = 0.15 / getNumOfVertices() + 0.85 * sum;
}
if (superstep() < 30) {
int outSize = getOutEdgerIterator().getSize();
sendMessageToAllNeighbors(this.value / n);
} else {
voteToHalt();
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
希望自己2月份之前能把这个课程刷完吧

0 comments on commit 5f1f96b

Please sign in to comment.