Open marleneberke opened 3 years ago
@belledon
i could be wrong here, but it looks like some instance of Video_Params
is used as a argument to some random variable. For HMC to work, the arguments to the random variable have to be differentiable.
I removed the matrix v of type Matrix{Real} from the Video_Params struct so that v would be a separate argument to random variables. Now I have a new (slightly different) error:
ERROR: LoadError: MethodError: no method matching zero(::Type{ReverseDiff.TrackedArray{Real,Real,2,Array{Real,2},Array{Real,2}}}) Closest candidates are: zero(::Type{Missing}) at missing.jl:103 zero(::Type{LibGit2.GitHash}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/LibGit2/src/oid.jl:220 zero(::Type{Pkg.Resolve.VersionWeight}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/Resolve/versionweights.jl:15 ... Stacktrace: [1] zero(::Array{ReverseDiff.TrackedArray{Real,Real,2,Array{Real,2},Array{Real,2}},1}) at ./abstractarray.jl:902 [2] macro expansion at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/static_ir/backprop.jl:504 [inlined] [3] choice_gradients(::MetaGen.var"##StaticIRTrace_metacog#293", ::Gen.StaticSelection{(:v_matrix,),Tuple{Gen.DynamicSelection}}, ::Nothing) at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/static_ir/backprop.jl:504 [4] macro expansion at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/static_ir/backprop.jl:396 [inlined] [5] choice_gradients(::MetaGen.var"##StaticIRTrace_metacog#293", ::Gen.DynamicSelection, ::Nothing) at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/static_ir/backprop.jl:504 [6] hmc(::MetaGen.var"##StaticIRTrace_metacog#293", ::Gen.DynamicSelection; L::Int64, eps::Float64, check::Bool, observations::Gen.EmptyChoiceMap) at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/inference/hmc.jl:35 [7] hmc at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/inference/hmc.jl:28 [inlined] [8] perturb_v_matrix_hmc(::MetaGen.var"##StaticIRTrace_metacog#293", ::Perturb_Params) at /Users/marleneberke/Documents/03_Yale/Projects/001_Mask_RCNN/ORB_project3/October/MetaGen/src/pf_inference.jl:192 [9] ##perturb#263(::Gen.GFUntracedState, ::MetaGen.var"##StaticIRTrace_metacog#293", ::Int64, ::Perturb_Params, ::Array{Array{MetaGen.Line_Segment,1},1}) at /Users/marleneberke/Documents/03_Yale/Projects/001_Mask_RCNN/ORB_project3/October/MetaGen/src/pf_inference.jl:124 [10] (::Gen.DynamicDSLFunction{Any})(::MetaGen.var"##StaticIRTrace_metacog#293", ::Vararg{Any,N} where N) at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/dynamic/dynamic.jl:54 [11] unfold_particle_filter(::Int64, ::Array{Array{Array{Tuple{Float64,Float64,Int64},N} where N,N} where N,2}, ::Array{Camera_Params,2}, ::Int64) at /Users/marleneberke/Documents/03_Yale/Projects/001_Mask_RCNN/ORB_project3/October/MetaGen/src/pf_inference.jl:86 [12] top-level scope at /Users/marleneberke/Documents/03_Yale/Projects/001_Mask_RCNN/ORB_project3/October/MetaGen/scripts/test_cases.jl:67 [13] include(::String) at ./client.jl:439
[15] eval(::Module, ::Any) at ./boot.jl:331 [16] eval_user_input(::Any, ::REPL.REPLBackend) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86 [17] run_backend(::REPL.REPLBackend) at /Users/marleneberke/.julia/packages/Revise/VxkZO/src/packagedef.jl:1221
in expression starting at /Users/marleneberke/Documents/03_Yale/Projects/001_Mask_RCNN/ORB_project3/October/MetaGen/scripts/test_cases.jl:67
ERROR: LoadError: MethodError: no method matching zero(::Video_Params) Closest candidates are: zero(::Type{Missing}) at missing.jl:103 zero(::Type{LibGit2.GitHash}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/LibGit2/src/oid.jl:220 zero(::Type{Pkg.Resolve.VersionWeight}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/Resolve/versionweights.jl:15 ... Stacktrace: [1] macro expansion at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/static_ir/backprop.jl:504 [inlined] [2] choice_gradients(::MetaGen.var"##StaticIRTrace_metacog#291", ::Gen.StaticSelection{(:v_matrix,),Tuple{Gen.DynamicSelection}}, ::Nothing) at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/static_ir/backprop.jl:504 [3] macro expansion at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/static_ir/backprop.jl:396 [inlined] [4] choice_gradients(::MetaGen.var"##StaticIRTrace_metacog#291", ::Gen.DynamicSelection, ::Nothing) at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/static_ir/backprop.jl:504 [5] hmc(::MetaGen.var"##StaticIRTrace_metacog#291", ::Gen.DynamicSelection; L::Int64, eps::Float64, check::Bool, observations::Gen.EmptyChoiceMap) at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/inference/hmc.jl:35 [6] hmc at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/inference/hmc.jl:28 [inlined] [7] perturb_v_matrix_hmc(::MetaGen.var"##StaticIRTrace_metacog#291", ::Perturb_Params) at /Users/marleneberke/Documents/03_Yale/Projects/001_Mask_RCNN/ORB_project3/October/MetaGen/src/pf_inference.jl:192 [8] ##perturb#263(::Gen.GFUntracedState, ::MetaGen.var"##StaticIRTrace_metacog#291", ::Int64, ::Perturb_Params, ::Array{Array{MetaGen.Line_Segment,1},1}) at /Users/marleneberke/Documents/03_Yale/Projects/001_Mask_RCNN/ORB_project3/October/MetaGen/src/pf_inference.jl:124 [9] (::Gen.DynamicDSLFunction{Any})(::MetaGen.var"##StaticIRTrace_metacog#291", ::Vararg{Any,N} where N) at /Users/marleneberke/.julia/packages/Gen/Kr4ax/src/dynamic/dynamic.jl:54 [10] unfold_particle_filter(::Int64, ::Array{Array{Array{Tuple{Float64,Float64,Int64},N} where N,N} where N,2}, ::Array{Camera_Params,2}, ::Int64) at /Users/marleneberke/Documents/03_Yale/Projects/001_Mask_RCNN/ORB_project3/October/MetaGen/src/pf_inference.jl:86 [11] top-level scope at /Users/marleneberke/Documents/03_Yale/Projects/001_Mask_RCNN/ORB_project3/October/MetaGen/scripts/test_cases.jl:67 [12] include(::String) at ./client.jl:439
[14] eval(::Module, ::Any) at ./boot.jl:331 [15] eval_user_input(::Any, ::REPL.REPLBackend) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86 [16] run_backend(::REPL.REPLBackend) at /Users/marleneberke/.julia/packages/Revise/VxkZO/src/packagedef.jl:1221
in expression starting at /Users/marleneberke/Documents/03_Yale/Projects/001_Mask_RCNN/ORB_project3/October/MetaGen/scripts/test_cases.jl:67