Structured amortized variational inference