You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the primary reason for this issue is the length dependent tolerance heuristic: Eps = 1E4*length(linearindices(va))*max(array_eps(va), array_eps(vb))
Currently, the overload function test_approx_eq(va, vb, Eps, astr, bstr) computes the difference of two arrays va and vb using the -norm, which is defined as the maximum absolute value of va - vb. The -norm, which differs from the 1-norm or 2-norm, does not sum over the dimensions. So, this heuristic, which is dependent on the length of the arrays, is problematic when the length of the arrays are large.
By the way, I don't know if there are some justification to use the magic constant 1E4 as a factor of the heuristic tolerance.
@test_approx_eq should be deprecated in favor of isapprox, which can be called via @test expa ≈ siga for the default (√ɛ) tolerance. (This test correctly fails on your example above.)
The
@test_approx_eq
macro does not work as expected with arrays. For exampleBoth tests (indicated by the last two lines) should fail, because
exp(x)
andsigmoid(x)
are different.Currently, this macro defined as follows.
The function called by this macro is defined like this
I think the primary reason for this issue is the length dependent tolerance heuristic:
-norm, which is defined as the maximum absolute value of
-norm, which differs from the 1-norm or 2-norm, does not sum over the dimensions. So, this heuristic, which is dependent on the length of the arrays, is problematic when the length of the arrays are large.
Eps = 1E4*length(linearindices(va))*max(array_eps(va), array_eps(vb))
Currently, the overload function
test_approx_eq(va, vb, Eps, astr, bstr)
computes the difference of two arraysva
andvb
using theva - vb
. TheBy the way, I don't know if there are some justification to use the magic constant 1E4 as a factor of the heuristic tolerance.
The source code can be found at
base/test.jl
.(commit: 72725a1)
The text was updated successfully, but these errors were encountered: