Skip to content

Commit 418c894

Browse files
committed
Remove unnecessary use of NumProduceAccumulator
1 parent 9aa24d5 commit 418c894

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/extract_priors.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ extract_priors(args::Union{Model,AbstractVarInfo}...) =
116116
extract_priors(Random.default_rng(), args...)
117117
function extract_priors(rng::Random.AbstractRNG, model::Model)
118118
varinfo = VarInfo()
119-
# TODO(mhauru) This doesn't actually need the NumProduceAccumulator, it's only a
120-
# workaround for the fact that `order` is still hardcoded in VarInfo, and hence you
121-
# can't push new variables without knowing the num_produce. Remove this when possible.
122-
varinfo = setaccs!!(varinfo, (PriorDistributionAccumulator(), NumProduceAccumulator()))
119+
varinfo = setaccs!!(varinfo, (PriorDistributionAccumulator(),))
123120
varinfo = last(evaluate_and_sample!!(rng, model, varinfo))
124121
return getacc(varinfo, Val(:PriorDistributionAccumulator)).priors
125122
end
@@ -133,12 +130,7 @@ This is done by evaluating the model at the values present in `varinfo`
133130
and recording the distributions that are present at each tilde statement.
134131
"""
135132
function extract_priors(model::Model, varinfo::AbstractVarInfo)
136-
# TODO(mhauru) This doesn't actually need the NumProduceAccumulator, it's only a
137-
# workaround for the fact that `order` is still hardcoded in VarInfo, and hence you
138-
# can't push new variables without knowing the num_produce. Remove this when possible.
139-
varinfo = setaccs!!(
140-
deepcopy(varinfo), (PriorDistributionAccumulator(), NumProduceAccumulator())
141-
)
133+
varinfo = setaccs!!(deepcopy(varinfo), (PriorDistributionAccumulator(),))
142134
varinfo = last(evaluate!!(model, varinfo))
143135
return getacc(varinfo, Val(:PriorDistributionAccumulator)).priors
144136
end

0 commit comments

Comments
 (0)