Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 600 Bytes

README.md

File metadata and controls

18 lines (15 loc) · 600 Bytes

libtorch_examples

This repository contains examples of libtorch, which is C++ front end of PyTorch.

  • hello_world.cpp: A simple example of libtorch.
  • function_approx.cpp: A feedforward network based function approximator, which trains on y = cos(x).

Compilation

  • Download libtorch with cmake automatically

    mkdir build && cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release && cmake --build .
  • Use an existing local libtorch

    mkdir build && cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch && cmake --build .