Identifying arbitrary topologies of power networks in real time is a computationally hard problem due to the number of hypotheses that grows exponentially with the network size. A 'Learning-to-Infer' variational inference method is employed for efficient inference of every line status in the network. Optimizing the variational model is transformed to and solved as a discriminative learning problem based on Monte Carlo samples generated with power flow simulations. As the labeled data used for training can be generated in an arbitrarily large amount rapidly and at very little cost, the power of offline training is fully exploited to learn very complex classifiers for effective real-time topology identification. The Learning-to-Infer method is extensively evaluated in the IEEE 30, 118 and 300 bus systems. Excellent performance and scalability of the method in identifying arbitrary power network topologies in real time are demonstrated.