@@ -537,36 +537,36 @@ Base.IteratorEltype(::Type{<:AbstractContext}) = Base.EltypeUnknown()
537537 end
538538 end
539539
540- @testset " PriorInit " begin
541- test_generating_new_values (PriorInit ())
542- test_replacing_values (PriorInit ())
543- test_rng_respected (PriorInit ())
544- test_link_status_respected (PriorInit ())
540+ @testset " InitFromPrior " begin
541+ test_generating_new_values (InitFromPrior ())
542+ test_replacing_values (InitFromPrior ())
543+ test_rng_respected (InitFromPrior ())
544+ test_link_status_respected (InitFromPrior ())
545545
546546 @testset " check that values are within support" begin
547547 # Not many other sensible checks we can do for priors.
548548 @model just_unif () = x ~ Uniform (0.0 , 1e-7 )
549549 for _ in 1 : 100
550- _, vi = DynamicPPL. init!! (just_unif (), VarInfo (), PriorInit ())
550+ _, vi = DynamicPPL. init!! (just_unif (), VarInfo (), InitFromPrior ())
551551 @test vi[@varname (x)] isa Real
552552 @test 0.0 <= vi[@varname (x)] <= 1e-7
553553 end
554554 end
555555 end
556556
557- @testset " UniformInit " begin
558- test_generating_new_values (UniformInit ())
559- test_replacing_values (UniformInit ())
560- test_rng_respected (UniformInit ())
561- test_link_status_respected (UniformInit ())
557+ @testset " InitFromUniform " begin
558+ test_generating_new_values (InitFromUniform ())
559+ test_replacing_values (InitFromUniform ())
560+ test_rng_respected (InitFromUniform ())
561+ test_link_status_respected (InitFromUniform ())
562562
563563 @testset " check that bounds are respected" begin
564564 @testset " unconstrained" begin
565565 umin, umax = - 1.0 , 1.0
566566 @model just_norm () = x ~ Normal ()
567567 for _ in 1 : 100
568568 _, vi = DynamicPPL. init!! (
569- just_norm (), VarInfo (), UniformInit (umin, umax)
569+ just_norm (), VarInfo (), InitFromUniform (umin, umax)
570570 )
571571 @test vi[@varname (x)] isa Real
572572 @test umin <= vi[@varname (x)] <= umax
@@ -579,7 +579,7 @@ Base.IteratorEltype(::Type{<:AbstractContext}) = Base.EltypeUnknown()
579579 tmin, tmax = inv_bijector (umin), inv_bijector (umax)
580580 for _ in 1 : 100
581581 _, vi = DynamicPPL. init!! (
582- just_beta (), VarInfo (), UniformInit (umin, umax)
582+ just_beta (), VarInfo (), InitFromUniform (umin, umax)
583583 )
584584 @test vi[@varname (x)] isa Real
585585 @test tmin <= vi[@varname (x)] <= tmax
@@ -588,9 +588,9 @@ Base.IteratorEltype(::Type{<:AbstractContext}) = Base.EltypeUnknown()
588588 end
589589 end
590590
591- @testset " ParamsInit " begin
592- test_link_status_respected (ParamsInit ((; a= 1.0 )))
593- test_link_status_respected (ParamsInit (Dict (@varname (a) => 1.0 )))
591+ @testset " InitFromParams " begin
592+ test_link_status_respected (InitFromParams ((; a= 1.0 )))
593+ test_link_status_respected (InitFromParams (Dict (@varname (a) => 1.0 )))
594594
595595 @testset " given full set of parameters" begin
596596 # test_init_model has x ~ Normal() and y ~ MvNormal(zeros(2), I)
@@ -600,13 +600,13 @@ Base.IteratorEltype(::Type{<:AbstractContext}) = Base.EltypeUnknown()
600600 model = test_init_model ()
601601 @testset " $vi_name " for (vi_name, empty_vi) in empty_varinfos
602602 _, vi = DynamicPPL. init!! (
603- model, deepcopy (empty_vi), ParamsInit (params_nt)
603+ model, deepcopy (empty_vi), InitFromParams (params_nt)
604604 )
605605 @test vi[@varname (x)] == my_x
606606 @test vi[@varname (y)] == my_y
607607 logp_nt = getlogp (vi)
608608 _, vi = DynamicPPL. init!! (
609- model, deepcopy (empty_vi), ParamsInit (params_dict)
609+ model, deepcopy (empty_vi), InitFromParams (params_dict)
610610 )
611611 @test vi[@varname (x)] == my_x
612612 @test vi[@varname (y)] == my_y
@@ -621,12 +621,12 @@ Base.IteratorEltype(::Type{<:AbstractContext}) = Base.EltypeUnknown()
621621 params_dict = Dict (@varname (x) => my_x)
622622 model = test_init_model ()
623623 @testset " $vi_name " for (vi_name, empty_vi) in empty_varinfos
624- @testset " with PriorInit fallback" begin
624+ @testset " with InitFromPrior fallback" begin
625625 _, vi = DynamicPPL. init!! (
626626 Xoshiro (468 ),
627627 model,
628628 deepcopy (empty_vi),
629- ParamsInit (params_nt, PriorInit ()),
629+ InitFromParams (params_nt, InitFromPrior ()),
630630 )
631631 @test vi[@varname (x)] == my_x
632632 nt_y = vi[@varname (y)]
@@ -636,7 +636,7 @@ Base.IteratorEltype(::Type{<:AbstractContext}) = Base.EltypeUnknown()
636636 Xoshiro (469 ),
637637 model,
638638 deepcopy (empty_vi),
639- ParamsInit (params_dict, PriorInit ()),
639+ InitFromParams (params_dict, InitFromPrior ()),
640640 )
641641 @test vi[@varname (x)] == my_x
642642 dict_y = vi[@varname (y)]
@@ -649,10 +649,10 @@ Base.IteratorEltype(::Type{<:AbstractContext}) = Base.EltypeUnknown()
649649 @testset " with no fallback" begin
650650 # These just don't have an entry for `y`.
651651 @test_throws ErrorException DynamicPPL. init!! (
652- model, deepcopy (empty_vi), ParamsInit (params_nt, nothing )
652+ model, deepcopy (empty_vi), InitFromParams (params_nt, nothing )
653653 )
654654 @test_throws ErrorException DynamicPPL. init!! (
655- model, deepcopy (empty_vi), ParamsInit (params_dict, nothing )
655+ model, deepcopy (empty_vi), InitFromParams (params_dict, nothing )
656656 )
657657 # We also explicitly test the case where `y = missing`.
658658 params_nt_missing = (; x= my_x, y= missing )
@@ -662,12 +662,12 @@ Base.IteratorEltype(::Type{<:AbstractContext}) = Base.EltypeUnknown()
662662 @test_throws ErrorException DynamicPPL. init!! (
663663 model,
664664 deepcopy (empty_vi),
665- ParamsInit (params_nt_missing, nothing ),
665+ InitFromParams (params_nt_missing, nothing ),
666666 )
667667 @test_throws ErrorException DynamicPPL. init!! (
668668 model,
669669 deepcopy (empty_vi),
670- ParamsInit (params_dict_missing, nothing ),
670+ InitFromParams (params_dict_missing, nothing ),
671671 )
672672 end
673673 end
0 commit comments