当前位置:网站首页>Numpy np.max和np.maximum实现relu函数
Numpy np.max和np.maximum实现relu函数
2022-07-03 10:22:00 【郭庆汝】
Numpy np.max和np.maximum实现relu函数
1. np.max 计算一个数组中的最值
(1)基础用法
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:维持形状
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:指定最小值
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:指定参与比较的元素,不参与的置initial值
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 比较两个数组的最值
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)
边栏推荐
- Function details of CorelDRAW graphics suite 2022
- 进程与线程
- 【obs】obs的ini格式的ConfigFile
- ASP. Net hotel management system
- 解决undefined reference to `__aeabi_uidivmod‘和undefined reference to `__aeabi_uidiv‘错误
- Activity and fragment lifecycle
- 11. Provider service registration of Nacos service registration source code analysis
- Empire CMS no thumbnail smart tag (e:loop) two ways to judge whether there is a titlepic
- Multi dimensional monitoring: the data base of intelligent monitoring
- Solve undefined reference to`__ aeabi_ Uidivmod 'and undefined reference to`__ aeabi_ Uidiv 'error
猜你喜欢

高精度室内定位技术,在智慧工厂安全管理的应用

11. Provider service registration of Nacos service registration source code analysis

Abandon the Internet after 00: don't want to enter a big factory after graduation, but go to the most fashionable Web3

Probability theory: application of convolution in calculating moving average

Cuiyusong, CTO of youzan: the core goal of Jarvis is to make products smarter and more reliable
![[OBS] configFile in ini format of OBS](/img/b2/0b130cee6ea884557a30e4b408f49e.png)
[OBS] configFile in ini format of OBS

反正切熵(Arctangent entropy):2022.7月最新SCI论文

解决undefined reference to `__aeabi_uidivmod‘和undefined reference to `__aeabi_uidiv‘错误

Tencent micro app to get wechat user information

Leetcode 46: full arrangement
随机推荐
基于I2C协议的驱动开发
英特尔13代酷睿旗舰曝光,单核5.5GHz
Expandablelistview that can expand and shrink (imitating the list page of professional selection of Zhilian recruitment)
Crawl with requests
AMS Series 1 - AMS startup process
项目管理精华读书笔记(六)
面試題總結(2) IO模型,集合,NIO 原理,緩存穿透,擊穿雪崩
The five-year itch of software testing engineers tells the experience of breaking through bottlenecks for two years
Definition and properties of summation symbols
使用onvif协议操作设备
动态规划(区间dp)
Key switch: press FN when pressing F1-F12
IIS修改配置信息后不生效
C语言日志库zlog基本使用
[VTK] vtkPolydataToImageStencil 源码解读
Analysis of JMM memory model
EPS电动转向系统分析
Application of high-precision indoor positioning technology in safety management of smart factory
How to become a senior digital IC Design Engineer (1-4) Verilog coding syntax: expression
My understanding of testing (summarized by senior testers)