File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,16 @@ function AbstractMCMC.sample(
136136 )
137137end
138138
139- loadstate (c:: MCMCChains.Chains ) = c. info. samplerstate
139+ function loadstate (chain:: MCMCChains.Chains )
140+ if ! haskey (chain. info, :samplerstate )
141+ throw (
142+ ArgumentError (
143+ " the chain object does not contain the final state of the sampler; to save the final state you must sample with `save_state=true`" ,
144+ ),
145+ )
146+ end
147+ return chain. info[:samplerstate ]
148+ end
140149
141150# TODO (penelopeysm): Remove initialstep and generalise MCMC sampling procedures
142151function initialstep end
Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ using Turing
236236 10 ;
237237 nadapts= 0 ,
238238 discard_adapt= false ,
239- initial_state= chn1. info . samplerstate ,
239+ initial_state= loadstate ( chn1) ,
240240 )
241241 # if chn2 uses initial_state, its first sample should be somewhere around 5. if
242242 # initial_state isn't used, it will be sampled from [-2, 2] so this test should fail
You can’t perform that action at this time.
0 commit comments