Skip to content

Errors from PermutedDimsArray #240

Open
@mcabbott

Description

@mcabbott

Something is confused here, I'm pretty sure the rule gives the same result as the one for permutedims:

julia> test_rrule(PermutedDimsArray, rand(3, 4, 5), (3, 1, 2); atol=0.1)
test_rrule: PermutedDimsArray on Array{Float64, 3},Int64,Int64,Int64: Test Failed at /Users/me/.julia/packages/ChainRulesTestUtils/8dFTY/src/check_result.jl:24
  Expression: isapprox(actual, expected; kwargs...)
   Evaluated: isapprox([0.02 2.61 -7.71 0.42; -8.68 -8.99 -3.53 -4.96; 8.23 -2.05 7.62 -0.88;;; -6.06 0.12 3.47 4.54; -0.02 7.06 -3.1 0.65; 0.47 -5.54 2.34 0.55;;; -4.3 -4.81 -0.08 4.66; -1.29 1.05 2.44 2.48; 3.17 -3.19 1.14 -5.52;;; -6.65 -6.25 8.15 -3.25; 3.51 -4.9 5.53 -2.8; -8.0 0.13 -7.71 1.46;;; 0.42 8.74 8.1 2.85; 0.9 2.67 3.36 -8.24; 0.95 -6.47 -5.11 8.27], [0.019999999999746908 -6.6500000000002375 -0.02000000000025288 0.8999999999997429; -6.060000000000144 0.41999999999974325 -1.2900000000002418 8.229999999999814; -4.300000000000264 -8.680000000000021 3.5099999999997613 0.469999999999744;;; 3.169999999999719 2.609999999999724 -6.250000000000212 7.059999999999704; -8.00000000000028 0.11999999999974628 8.739999999999668 1.0499999999997618; 0.9499999999997412 -4.8100000000002225 -8.990000000000263 -4.900000000000136;;; 2.66999999999973 -3.1900000000002566 -7.710000000000218 8.149999999999768; -2.0500000000002374 0.12999999999974626 3.4699999999997257 8.099999999999698; -5.540000000000103 -6.470000000000212 -0.08000000000025227 -3.5300000000002676;;; -3.1000000000002617 3.3599999999997268 1.1399999999997399 0.4199999999997444; 2.439999999999729 7.619999999999814 -7.710000000000186 4.5399999999997185; 5.529999999999713 2.3399999999996295 -5.1100000000002215 4.659999999999719;;; -3.2500000000002327 0.6499999999997431 -8.240000000000203 -5.520000000000219; 2.849999999999756 2.4799999999997318 -0.8800000000002475 1.459999999999738; -4.960000000000223 -2.800000000000235 0.5499999999997423 8.269999999999694]; rtol = 1.0e-9, atol = 0.1)
Stacktrace:
  [1] test_approx(actual::Union{Number, AbstractArray{<:Number}}, expected::Union{Number, AbstractArray{<:Number}}, msg::Any; kwargs::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
    @ ChainRulesTestUtils ~/.julia/packages/ChainRulesTestUtils/8dFTY/src/check_result.jl:24
  [2] _test_cotangent(accum_cotangent::Any, ad_cotangent::Any, fd_cotangent::Any; check_inferred::Any, kwargs::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
    @ ChainRulesTestUtils ~/.julia/packages/ChainRulesTestUtils/8dFTY/src/testers.jl:301
  [3] (::ChainRulesTestUtils.var"#49#53"{Bool, NamedTuple{(:rtol, :atol), Tuple{Float64, Float64}}})(::Any, ::Vararg{Any})
    @ ChainRulesTestUtils ~/.julia/packages/ChainRulesTestUtils/8dFTY/src/testers.jl:228
  [4] #57
    @ ./tuple.jl:556 [inlined]
  [5] BottomRF
    @ ./reduce.jl:81 [inlined]
  [6] _foldl_impl
    @ ./reduce.jl:62 [inlined]
  [7] foldl_impl
    @ ./reduce.jl:48 [inlined]
  [8] mapfoldl_impl(f::typeof(identity), op::Base.var"#57#58"{ChainRulesTestUtils.var"#49#53"{Bool, NamedTuple{(:rtol, :atol), Tuple{Float64, Float64}}}}, nt::Nothing, itr::Base.Iterators.Zip{Tuple{Tuple{NoTangent, Array{Float64, 3}, NoTangent}, Tuple{NoTangent, Array{Float64, 3}, NoTangent}, Tuple{NoTangent, Array{Float64, 3}, NoTangent}}})
    @ Base ./reduce.jl:44
  [9] mapfoldl(f::Function, op::Function, itr::Base.Iterators.Zip{Tuple{Tuple{NoTangent, Array{Float64, 3}, NoTangent}, Tuple{NoTangent, Array{Float64, 3}, NoTangent}, Tuple{NoTangent, Array{Float64, 3}, NoTangent}}}; init::Nothing)
    @ Base ./reduce.jl:162
 [10] #foldl#259
    @ ./reduce.jl:185 [inlined]
 [11] foreach(::Function, ::Tuple{NoTangent, Array{Float64, 3}, NoTangent}, ::Tuple{NoTangent, Array{Float64, 3}, NoTangent}, ::Vararg{Tuple{NoTangent, Array{Float64, 3}, NoTangent}})
    @ Base ./tuple.jl:556
 [12] macro expansion
    @ ~/.julia/packages/ChainRulesTestUtils/8dFTY/src/testers.jl:227 [inlined]
 [13] macro expansion
    @ ~/.julia/dev/julia/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1356 [inlined]
 [14] test_rrule(::RuleConfig, ::Any, ::Any, ::Vararg{Any}; output_tangent::Any, check_thunked_output_tangent::Any, fdm::Any, rrule_f::Any, check_inferred::Bool, fkwargs::NamedTuple, rtol::Real, atol::Real, kwargs::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
    @ ChainRulesTestUtils ~/.julia/packages/ChainRulesTestUtils/8dFTY/src/testers.jl:198
Test Summary:                                                        | Pass  Fail  Total  Time
test_rrule: PermutedDimsArray on Array{Float64, 3},Int64,Int64,Int64 |    7     1      8  0.0s
ERROR: Some tests did not pass: 7 passed, 1 failed, 0 errored, 0 broken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions