", line 1, in 赞 踩 代码: 报错: Traceback (most recent call last): 原因: 被比较的两个ndarray shape不一致时,返回值只有一个True或者False。所以单一的True或者False是bool变量,没有all属性。报错。 只有当两个ndarray的shape一致时,aa==bb 才能返回矩阵所有位置比较的结果对应True或者False。如下: PS: (aa==bb).all 只要有一个位置的对应比较结果为False则输出都为False,全部位置为True才输出True (aa==bb).any只要有一个位置为True则输出都为True,全部位置为False才输出False Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。
AttributeError: ‘bool‘ object has no attribute ‘all‘_attributeerror: 'bool' object has no attribute 'al
File "<stdin>", line 1, in <module>
AttributeError: 'bool' object has no attribute 'all'