Using `Predictive()` to make predictions based on the trained guide

Hello,
Could someone take a quick look at my code below, and see if the pred_obj.call function would return the predictions on the test set which I intend to make with myPyroModel and the trained guide?

If the code below wrongly apply the Predictive class to make predictions based on the trained guide and myPyroModel, what is the correct way to use the Predictive( ) functionality to do so?

Thank you,

optimizer_args = {'lr': 0.00015}
optimizer_3 = torch.optim.Adam
scheduler_args = {'optimizer': optimizer_3,
                          'step_size' : 1, 'gamma' : 1.5, 
                          'optim_args' : optimizer_args}
scheduler_3 = pyro.optim.StepLR(scheduler_args)

# create the stochastic variational inference (SVI) object.
my_svi = SVI(myPyroModel, guide, scheduler_3,
                              loss=TraceEnum_ELBO(max_plate_nesting=0))

#... train the parameters of the guide
train(num_epoch, my_svi, input)

# trying to make predictions...
myPyroModel.eval( )
pred_obj = Predictive(myPyroModel, guide=guide,
                                  num_samples = 100)

prediction = pred_obj.call(test_input)

Hi @h56cho, your code looks reasonable to me.