Skip to content

Commit 1bd721b

Browse files
author
guozhen3
committed
1
1 parent fd60f92 commit 1bd721b

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
| 编号 | 链接 | 标签 | 版本 | 难度 |
3737
| ---- | ---------------------------------- | ---- | ---- | ---- |
38-
| 1 | [求绝对值](md/1.md) | abs | V1.0 | ⭐️ |
38+
| 1 | [实现 relu](md/1.md) | abs | V1.0 | ⭐️⭐️ |
3939
| 2 | [进制转化](md/2.md) | bin,oct,hex | V1.0 | ⭐️⭐️ |
4040
| 3 | [整数和ASCII互转](md/3.md) | chr,ord | V1.0 | ⭐️⭐️ |
4141
| 4 | [元素都为真检查](md/4.md) | all | V2.0 | ⭐️⭐️⭐️ |

md/1.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
```markdown
22
@author jackzhenguo
3-
@desc 求绝对值
3+
@desc 实现 relu
44
@date 2019/2/10
55
```
66

7-
#### 1 求绝对值
7+
#### 1 实现 relu
88

9-
绝对值或复数的模
9+
在神经网络中,`relu`作为神经元的激活函数:
1010

1111
```python
12-
In [1]: abs(-6)
13-
Out[1]: 6
12+
def relu(x):
13+
"""
14+
x: 输入参数
15+
return:输出relu值
16+
"""
17+
return max(0,x)
18+
```
19+
20+
测试:
21+
22+
```python
23+
relu(5) # 5
24+
25+
relu(-1) # 0
1426
```
1527

0 commit comments

Comments
 (0)