Hi all, I am following Advanced tutorial · DifferentiationInterface.jl and to try out some of the modern AD features it provides. My test case is here FunWithSplines/workspace/MLE/core-5_4_1.jl at main · slwu89/FunWithSplines · GitHub where I need to compute a Hessian matrix which is very sparse. I am able to compute the dense Hessian no problem, but using the sparse backend results in the following error pasted below (the last few lines of the example compute the Hessian). I believe it is due to a comparison between numeric types in the underlying mathematical model. Can someone give any advice about how to still use sparse AD in this case?
For the curious, the model is from 5.4.1 of https://www.cambridge.org/us/universitypress/subjects/statistics-probability/statistical-theory-and-methods/core-statistics.
ERROR: TypeError: non-boolean (SparseConnectivityTracer.HessianTracer{SparseConnectivityTracer.DictHessianPattern{Int64, BitSet, Dict{Int64, BitSet}, SparseConnectivityTracer.NotShared}}) used in boolean context
Stacktrace:
[1] model_urchin_vol(ω::Float64, g::SparseConnectivityTracer.HessianTracer{…}, p::SparseConnectivityTracer.HessianTracer{…}, a::Float64)
@ Main ~/Desktop/git/FunWithSplines/workspace/MLE/core-5_4_1.jl:41
[2] nlyfb_urchin(b::Vector{SparseConnectivityTracer.HessianTracer{…}}, θ::Vector{Float64}, urchin::DataFrame)
@ Main ~/Desktop/git/FunWithSplines/workspace/MLE/core-5_4_1.jl:59
[3] (::DifferentiationInterface.FixTail{…})(args::Vector{…})
@ DifferentiationInterface ~/.julia/packages/DifferentiationInterface/Yk2Kt/src/utils/context.jl:169
[4] trace_function(::Type{…}, f::DifferentiationInterface.FixTail{…}, x::Vector{…})
@ SparseConnectivityTracer ~/.julia/packages/SparseConnectivityTracer/litqn/src/trace_functions.jl:48
[5] _hessian_sparsity(f::DifferentiationInterface.FixTail{…}, x::Vector{…}, ::Type{…})
@ SparseConnectivityTracer ~/.julia/packages/SparseConnectivityTracer/litqn/src/trace_functions.jl:115
[6] hessian_sparsity
@ ~/.julia/packages/SparseConnectivityTracer/litqn/src/adtypes_interface.jl:64 [inlined]
[7] hessian_sparsity_with_contexts
@ ~/.julia/packages/DifferentiationInterface/Yk2Kt/ext/DifferentiationInterfaceSparseConnectivityTracerExt/DifferentiationInterfaceSparseConnectivityTracerExt.jl:62 [inlined]
[8] prepare_hessian_nokwarg(::Val{…}, ::typeof(nlyfb_urchin), ::AutoSparse{…}, ::Vector{…}, ::Constant{…}, ::Constant{…})
@ DifferentiationInterfaceSparseMatrixColoringsExt ~/.julia/packages/DifferentiationInterface/Yk2Kt/ext/DifferentiationInterfaceSparseMatrixColoringsExt/hessian.jl:29
[9] hessian(::typeof(nlyfb_urchin), ::AutoSparse{…}, ::Vector{…}, ::Constant{…}, ::Constant{…})
@ DifferentiationInterface ~/.julia/packages/DifferentiationInterface/Yk2Kt/src/fallbacks/no_prep.jl:103
[10] top-level scope
@ ~/Desktop/git/FunWithSplines/workspace/MLE/core-5_4_1.jl:104
Some type information was truncated. Use `show(err)` to see complete types.