Bi-directional Inference Networks