README.rst 819 B

12345678910111213141516171819
  1. Hello World!
  2. ============
  3. This is a minimal example of getting TorchVision to work in C++ with CMake.
  4. In order to successfully compile this example, make sure you have both ``LibTorch`` and
  5. ``TorchVision`` installed.
  6. Once both dependencies are sorted, we can start the CMake fun:
  7. 1) Create a ``build`` directory inside the current one.
  8. 2) from within the ``build`` directory, run the following commands:
  9. - | ``cmake -DCMAKE_PREFIX_PATH="<PATH_TO_LIBTORCH>;<PATH_TO_TORCHVISION>" ..``
  10. | where ``<PATH_TO_LIBTORCH>`` and ``<PATH_TO_TORCHVISION>`` are the paths to the libtorch and torchvision installations.
  11. - ``cmake --build .``
  12. | That's it!
  13. | You should now have a ``hello-world`` executable in your ``build`` folder.
  14. Running it will output a (fairly long) tensor of random values to your terminal.