Typically, these libraries are unusable for this purpose because you don't want to ship a Python interpreter with your video game.
I usually prefer to to rewrite my training step as a pure function, so the model weights are just inputs and the gradient updates are outputs.
You need to serialize your computation graph in some way, so it can be run in C++ or some other low-level language. TensorFlow is known for doing this well since it was original design goal of the project. Some of the other frameworks that originally targeted researchers make this harder. Most mature frameworks have some way of doing this now, though, and projects like https://onnx.ai/ may solve this in general.
It gets more complicated if your model has dynamic control flow, but you get the idea.