I have this weird case where two tensors are element-wise and size-wise approx equal up to 3 digits but as a whole they aren’t. I’m still running Julia 1.1.0 though.
alldigits = cat([[0.375297 0.624703]; [0.39924 0.60076]], [[0.664557 0.335443]; [0.664557 0.335443]], dims=3)
2×2×2 Array{Float64,3}:
[:, :, 1] =
0.375297 0.624703
0.39924 0.60076
[:, :, 2] =
0.664557 0.335443
0.664557 0.335443
julia> threedig = map(x -> round(x,digits=3), alldigits)
2×2×2 Array{Float64,3}:
[:, :, 1] =
0.375 0.625
0.399 0.601
[:, :, 2] =
0.665 0.335
0.665 0.335
julia> isapprox.(alldigits, threedig, atol=1e-3)
2×2×2 BitArray{3}:
[:, :, 1] =
true true
true true
[:, :, 2] =
true true
true true
julia> isapprox(alldigits, threedig, atol=1e-3)
false
julia> size(alldigits) == size(threedig)
true
I made a test script for it here:
https://gist.github.com/dietercastel/4ff276ad7d70ba91321a070de72b00f3
Anyone who knows why or how this happens?