  Quantum compiling, a process that decomposes the quantum algorithm into a
series of hardware-compatible commands or elementary gates, is of fundamental
importance for quantum computing. We introduce an efficient algorithm based on
deep reinforcement learning that compiles an arbitrary single-qubit gate into a
sequence of elementary gates from a finite universal set. It generates
near-optimal gate sequences with given accuracy and is generally applicable to
various scenarios, independent of the hardware-feasible universal set and free
from using ancillary qubits. For concreteness, we apply this algorithm to the
case of topological compiling of Fibonacci anyons and obtain near-optimal
braiding sequences for arbitrary single-qubit unitaries. Our algorithm may
carry over to other challenging quantum discrete problems, thus opening up a
new avenue for intriguing applications of deep learning in quantum physics.
