Learning to solve Bayesian inverse problems: An amortized variational inference approach