The Transformer-on-Qubit.py file shows the code for training the Transformer model with reinforcement learning. It predicts the next possible qubit twice for the qubit pair output.

This code is only applied with R40.txt success rate matrix and X40std9.txt fidelity matrix for the table 1 result in the main paper. It can be also used for other input environment.