The performance of a fiber optic gyroscope (FOG) can be significantly impacted by temperature, leading to bias. To address this issue, a temperature compensation method based on an LSTM network has been proposed. This method predicts the bias and scale factor of FOG, resulting in improved performance. A series of static and dynamic experiments were conducted, providing evidence of the effectiveness of this compensation model. Finally, the compensated gyroscope can maintain stable output under temperature shock.