当前位置:网站首页>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.
```
边栏推荐
猜你喜欢
Typescript hands-on tutorial, easy to understand
Numpy 小坑:维度 (n, 1) 和 维度 (n, ) 数组相加运算后维度变为 (n, n)
Halcon affine transformations to regions
Pytorch entry record
[code practice] [stereo matching series] Classic ad census: (5) scan line optimization
资源变现小程序添加折扣充值和折扣影票插件
It cold knowledge (updating ing~)
AUTOSAR从入门到精通100讲(103)-dbc文件的格式以及创建详解
[牛客网刷题 Day4] JZ55 二叉树的深度
Run menu analysis
随机推荐
容易混淆的基本概念 成员变量 局部变量 全局变量
OpenFeign
Wheel 1:qcustomplot initialization template
Warning: retrying occurs during PIP installation
Redis实现高性能的全文搜索引擎---RediSearch
RT thread kernel quick start, kernel implementation and application development learning with notes
Search data in geo database
Halcon affine transformations to regions
Hello everyone, welcome to my CSDN blog!
Guess riddles (2)
Numpy pit: after the addition of dimension (n, 1) and dimension (n,) array, the dimension becomes (n, n)
Use and programming method of ros-8 parameters
Oracle advanced (III) detailed explanation of data dictionary
Reasons for the insecurity of C language standard function scanf
C [essential skills] use of configurationmanager class (use of file app.config)
[daily training -- Tencent selected 50] 557 Reverse word III in string
Halcon clolor_ pieces. Hedv: classifier_ Color recognition
[牛客网刷题 Day4] JZ32 从上往下打印二叉树
How to manage the performance of R & D team?
ECMAScript6介绍及环境搭建