Composing graphical models with neural networks for structured representations and fast inference