Skip to content

Examples of libtorch, which is C++ front end of PyTorch

License

Notifications You must be signed in to change notification settings

juaduan/libtorch_examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 .

About

Examples of libtorch, which is C++ front end of PyTorch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 78.8%
  • CMake 21.2%