0
我正在处理像(110,80,817)这样的大型3D数组,并且希望在某些单元测试中比较两个数组。但是,numpy.assert_almost_equal
的默认输出不能帮助我很容易地找出错误。例如:查找失败的索引numpy.assert_almost_equal
> raise AssertionError(msg)
E AssertionError:
E Arrays are not almost equal to 7 decimals
E
E (mismatch 0.0314621119395%)
E x: array([[[ 0., 0., 0., ..., 0., 0., 0.],
E [ 0., 0., 0., ..., 0., 0., 0.],
E [ 0., 0., 0., ..., 0., 0., 0.],...
E y: array([[[ 0., 0., 0., ..., 0., 0., 0.],
E [ 0., 0., 0., ..., 0., 0., 0.],
E [ 0., 0., 0., ..., 0., 0., 0.],...
有没有方法可以轻松查看哪些3D索引失败此断言?
太棒了!谢谢您的帮助。 –