当前位置:网站首页>np.allclose
np.allclose
2022-07-05 08:51:00 【Wanderer001】
numpy的allclose方法,比较两个array是不是每一元素都相等,默认在1e-05的误差范围内
>>> help(np.allclose)
Help on function allclose in module numpy.core.numeric:
allclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)
Returns True if two arrays are element-wise equal within a tolerance.
The tolerance values are positive, typically very small numbers. The
relative difference (`rtol` * abs(`b`)) and the absolute difference
`atol` are added together to compare against the absolute difference
between `a` and `b`.
If either array contains one or more NaNs, False is returned.
Infs are treated as equal if they are in the same place and of the same
sign in both arrays.
Parameters
----------
a, b : array_like
Input arrays to compare.
rtol : float
The relative tolerance parameter (see Notes).
atol : float
The absolute tolerance parameter (see Notes).
equal_nan : bool
Whether to compare NaN's as equal. If True, NaN's in `a` will be
considered equal to NaN's in `b` in the output array.
.. versionadded:: 1.10.0
Returns
-------
allclose : bool
Returns True if the two arrays are equal within the given
tolerance; False otherwise.
```
边栏推荐
- Multiple linear regression (sklearn method)
- Program error record 1:valueerror: invalid literal for int() with base 10: '2.3‘
- 【日常训练】1200. 最小绝对差
- 12. Dynamic link library, DLL
- Redis实现高性能的全文搜索引擎---RediSearch
- Summary and Reflection on issues related to seq2seq, attention and transformer in hands-on deep learning
- 多元线性回归(sklearn法)
- 2020 "Lenovo Cup" National College programming online Invitational Competition and the third Shanghai University of technology programming competition
- Run menu analysis
- Meta标签详解
猜你喜欢
Ros-11 common visualization tools
Classification of plastic surgery: short in long long long
[daiy4] copy of JZ35 complex linked list
Guess riddles (5)
[matlab] matlab reads and writes Excel
Run menu analysis
Guess riddles (9)
[code practice] [stereo matching series] Classic ad census: (5) scan line optimization
Attention is all you need
Introduction Guide to stereo vision (2): key matrix (essential matrix, basic matrix, homography matrix)
随机推荐
It cold knowledge (updating ing~)
[daily training -- Tencent selected 50] 557 Reverse word III in string
Multiple linear regression (sklearn method)
Golang foundation - the time data inserted by golang into MySQL is inconsistent with the local time
Ros-11 common visualization tools
location search 属性获取登录用户名
Latex improve
Summary and Reflection on issues related to seq2seq, attention and transformer in hands-on deep learning
Pytorch entry record
The location search property gets the login user name
File server migration scheme of a company
Meta标签详解
嗨 FUN 一夏,与 StarRocks 一起玩转 SQL Planner!
TF coordinate transformation of common components of ros-9 ROS
Bit operation related operations
Shift operation of complement
Guess riddles (7)
Array,Date,String 对象方法
【日常训练】1200. 最小绝对差
[code practice] [stereo matching series] Classic ad census: (5) scan line optimization