From the docs I gathered that to create a simple 2 hidden layer classifier with 3 inputs and 12 nodes in each layer, it looks like:
model = PyroModule[nn.Sequential](
PyroModule[nn.Linear](3, 12),
PyroModule[nn.Sigmoid](),
PyroModule[nn.Linear](12, 12),
PyroModule[nn.Sigmoid](),
PyroModule[nn.Linear](12, 1),
PyroModule[nn.Sigmoid]()
)
assert isinstance(model, nn.Sequential)
assert isinstance(model, PyroModule)
# Now we can be Bayesian about weights in the first layer.
model[0].weight = PyroSample(
prior=dist.Normal(0,1).expand([3, 12]).to_event(2))
model[2].weight = PyroSample(
prior=dist.Normal(0,1).expand([12, 12]).to_event(2))
model[4].weight = PyroSample(
prior=dist.Normal(0,1).expand([12,1]).to_event(2))
I have no idea what the next step is after defining the network and can’t seem to find a single full example of such. I have made a few other Pyro models, but am new to the nn module.