libtorch is roughly the C++ part of PyTorch plus a C++ API for the bits of PyTorch implemented in Python. In particular, they share the versions. I usually just use the libtorch that comes with PyTorch to build things, but that could be me.
Do you use a recent libtorch?