当前位置:网站首页>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.
```
边栏推荐
- 资源变现小程序添加折扣充值和折扣影票插件
- 交通运输部、教育部:广泛开展水上交通安全宣传和防溺水安全提醒
- [code practice] [stereo matching series] Classic ad census: (6) multi step parallax optimization
- C [essential skills] use of configurationmanager class (use of file app.config)
- Codeforces Round #648 (Div. 2) D. Solve The Maze
- Infix expression evaluation
- Meta tag details
- Halcon wood texture recognition
- ROS learning 4 custom message
- RT-Thread内核快速入门,内核实现与应用开发学习随笔记
猜你喜欢
RT thread kernel quick start, kernel implementation and application development learning with notes
Count of C # LINQ source code analysis
Numpy 小坑:维度 (n, 1) 和 维度 (n, ) 数组相加运算后维度变为 (n, n)
Pytorch entry record
[matlab] matlab reads and writes Excel
C# LINQ源码分析之Count
牛顿迭代法(解非线性方程)
优先级队列(堆)
Programming implementation of ROS learning 5-client node
Install the CPU version of tensorflow+cuda+cudnn (ultra detailed)
随机推荐
Summary and Reflection on issues related to seq2seq, attention and transformer in hands-on deep learning
696. Count binary substring
RT thread kernel quick start, kernel implementation and application development learning with notes
Reasons for the insecurity of C language standard function scanf
C#【必备技能篇】ConfigurationManager 类的使用(文件App.config的使用)
Array, date, string object method
Guess riddles (11)
Meta tag details
Guess riddles (5)
Programming implementation of subscriber node of ROS learning 3 subscriber
容易混淆的基本概念 成员变量 局部变量 全局变量
js异步错误处理
520 diamond Championship 7-4 7-7 solution
ORACLE进阶(三)数据字典详解
【日常訓練--騰訊精選50】557. 反轉字符串中的單詞 III
Install the CPU version of tensorflow+cuda+cudnn (ultra detailed)
golang 基础 —— golang 向 mysql 插入的时间数据和本地时间不一致
Halcon affine transformations to regions
Codeforces Round #648 (Div. 2) E.Maximum Subsequence Value
Redis实现高性能的全文搜索引擎---RediSearch