当前位置:网站首页>Numpy np. Max and np Maximum implements the relu function
Numpy np. Max and np Maximum implements the relu function
2022-07-03 11:27:00 【Guoqingru】
Numpy np.max and np.maximum Realization relu function
1. np.max Calculate the maximum value in an array
(1) Basic usage
a = np.array([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
])
print(np.max(a))
print(np.max(a, axis=0))
print(np.max(a, axis=1))
[Out]:
9
[7 8 9]
[3 6 9]
(2)keepdims: Maintain shape
print(np.max(a, keepdims=True))
print(np.max(a, axis=0, keepdims=True))
print(np.max(a, axis=1, keepdims=True))
[Out]:
[[9]]
[[7 8 9]]
[[3]
[6]
[9]]
(3)initial: Specify the minimum
print(np.max(a, initial=8))
print(np.max(a, axis=0, initial=8))
print(np.max(a, axis=1, initial=8))
[Out]:
9
[8 8 9]
[8 8 9]
(4)where: Specify the elements that participate in the comparison , Non participating settings initial value
print(np.max(a, initial=8, where=[1, 1, 0]))
print(np.max(a, axis=0, initial=8, where=[True, True, False]))
print(np.max(a, axis=1, initial=8, where=[True, True, False]))
[Out]:
8
[8 8 8]
[8 8 8]
2. np.maximum Compare the maximum values of two arrays
a = np.array([
[1, 2, 3],
[4, 5, 6]
])
b = np.array([
[7, 8, 9],
[0, 1, 2]
])
print(np.maximum(a, b))
print(np.maximum(a, 3.5))
[Out]:
[[7 8 9]
[4 5 6]]
[[3.5 3.5 3.5]
[4. 5. 6. ]]

def relu(inX):
return np.maximum(0,inX)
边栏推荐
- Intel 13th generation core flagship exposure, single core 5.5ghz
- asyncio 警告 DeprecationWarning: There is no current event loop
- FL Studio 20 unlimited trial fruit arranger Download
- Android log system
- Numpy np.max和np.maximum实现relu函数
- Résumé des questions d'entrevue (2) Modèle io, ensemble, principe NiO, pénétration du cache, avalanche de rupture
- .\vmware-vdiskmanager.exe -k “c:\\xxxxx.vmdk”
- Redis things
- Programmers' entrepreneurial trap: taking private jobs
- 程序员的创业陷阱:接私活
猜你喜欢

Event preview | the live broadcast industry "rolled in" to drive new data growth points with product power

Google Earth Engine(GEE)——GHSL 全球人口网格数据集250米分辨率

2022 东北四省赛 VP记录/补题

ASP.NET-酒店管理系統

面试题总结(2) IO模型,集合,NIO 原理,缓存穿透,击穿雪崩

LeetCode 46:全排列

Encapsulate a koa distributed locking middleware to solve the problem of idempotent or repeated requests

FL Studio 20 unlimited trial fruit arranger Download

Redis things

数据库增量备份 - DB INCR DB FULL
随机推荐
Summary of the history of Mathematics
如何成为一名高级数字 IC 设计工程师(1-5)Verilog 编码语法篇:操作数
大厂技术专家:工程师如何提升沟通能力?
Reading notes: heart like Bodhi, Cao Dewang
phpcms 提示信息页面跳转showmessage
FL Studio 20无限试用版水果编曲下载
按键切换:按F1-F12都需要按Fn
Event preview | the live broadcast industry "rolled in" to drive new data growth points with product power
CSRF
1. Hal driven development
程序员的创业陷阱:接私活
今晚要修稿子準備發佈。但是,仍卡在這裡,也許你需要的是一個段子。
Cadence background color setting
Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡
LeetCode 46:全排列
How to become a senior digital IC Design Engineer (1-5) Verilog coding syntax: operand
ASP.NET-酒店管理系统
C语言 AES加解密
进程与线程
Driver development based on I2C protocol