From 209459604e1ec75a27f928de146abc7beb40616d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olav=20M=C3=B8yner?= Date: Wed, 20 Nov 2024 15:23:03 +0100 Subject: [PATCH] Always have context in MultiModel --- src/core_types/core_types.jl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core_types/core_types.jl b/src/core_types/core_types.jl index 9e5d5996..6173147b 100644 --- a/src/core_types/core_types.jl +++ b/src/core_types/core_types.jl @@ -965,7 +965,17 @@ struct MultiModel{label, T, CT, G, C, GL} <: AbstractMultiModel{label} group_lookup::GL end -function MultiModel(models, label::Union{Nothing, Symbol} = nothing; cross_terms = Vector{CrossTermPair}(), groups = nothing, context = nothing, reduction = missing, specialize = false, specialize_ad = false) +function MultiModel(models, label::Union{Nothing, Symbol} = nothing; + cross_terms = Vector{CrossTermPair}(), + groups = nothing, + context = nothing, + reduction = missing, + specialize = false, + specialize_ad = false + ) + if isnothing(context) + context = models[first(keys(models))].context + end group_lookup = Dict{Symbol, Int}() if isnothing(groups) num_groups = 1