Hi,
I define my guide, with parameters x_loc
and x_scale
, as:
def guide(data):
x_loc = pyro.param("x_loc", torch.rand(N*3,))
x_scale = pyro.param("x_scale", 0.5*torch.ones(N*3,), constraint=constraints.positive)
x = pyro.sample("x", dist.Normal(x_loc, x_scale).to_event(1))
I want to access the parameters x_loc
and x_scale
to use them in the optimizer,
optimizer = torch.optim.Adam(PARAMETERS, {"lr": 0.001, "betas": (0.90, 0.999)})
I tried PARAMETERS = list(guide.parameters())
, but it gives me the following error AttributeError: 'function' object has no attribute 'parameters'
.
How can access the parameters in the guide?
Thanks!