Skip to content

Commit 24591f5

Browse files
committed
Initial commit
0 parents  commit 24591f5

File tree

10 files changed

+170
-0
lines changed

10 files changed

+170
-0
lines changed

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
34+
# PyTorch
35+
libtorch/
36+
build/
37+
38+
# Other
39+
.DS_Store
40+
.idea/

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2+
project(pytorch-cpp)
3+
4+
5+
find_package(Torch REQUIRED)
6+
7+
add_executable(pytorch-cpp main.cpp)
8+
target_link_libraries(pytorch-cpp "${TORCH_LIBRARIES}")
9+
10+
add_executable(pytorch_basics tutorials/basics/pytorch_basics/main.cpp)
11+
target_link_libraries(pytorch_basics "${TORCH_LIBRARIES}")
12+
add_executable(linear_regression tutorials/basics/linear_regression/main.cpp)
13+
target_link_libraries(linear_regression "${TORCH_LIBRARIES}")
14+
add_executable(logistic_regression tutorials/basics/logistic_regression/main.cpp)
15+
target_link_libraries(logistic_regression "${TORCH_LIBRARIES}")
16+
add_executable(feedforward_neural_network tutorials/basics/feedforward_neural_network/main.cpp)
17+
target_link_libraries(feedforward_neural_network "${TORCH_LIBRARIES}")
18+
19+
set_property(TARGET pytorch-cpp PROPERTY CXX_STANDARD 11)

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Omkar Prabhu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<p align="center"><img width="50%" src="images/pytorch_log.svg" /></p>
2+
3+
--------------------------------------------------------------------------------
4+
5+
This repository provides tutorial code in C++ for deep learning researchers to learn PyTorch.
6+
7+
## How to Build
8+
- Install
9+
```
10+
wget https://download.pytorch.org/libtorch/nightly/cpu/libtorch-shared-with-deps-latest.zip
11+
unzip libtorch-shared-with-deps-latest.zip
12+
```
13+
- Build
14+
```
15+
mkdir build
16+
cd build
17+
cmake -DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch ..
18+
make
19+
```
20+
21+
## Table of Contents
22+
23+
#### 1. Basics
24+
* [PyTorch Basics](https://github.com/prabhuomkar/pytorch-cpp/tree/master/tutorials/basics/pytorch_basics.cpp)
25+
* [Linear Regression](https://github.com/prabhuomkar/pytorch-cpp/tree/master/tutorials/basics/linear_regression.cpp)
26+
* [Logistic Regression](https://github.com/prabhuomkar/pytorch-cpp/tree/master/tutorials/basics/logistic_regression.cpp)
27+
* [Feedforward Neural Network](https://github.com/prabhuomkar/pytorch-cpp/tree/master/tutorials/basics/feedforward_neural_network.cpp)

images/pytorch_logo.svg

Lines changed: 33 additions & 0 deletions
Loading

main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <torch/torch.h>
2+
#include <iostream>
3+
4+
int main() {
5+
std::cout << "Welcome to PyTorch Tutorial in C++ for Deep Learning Researchers" << std::endl;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <torch/torch.h>
2+
#include <iostream>
3+
4+
int main() {
5+
std::cout << "FeedForward Neural Network" << std::endl;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <torch/torch.h>
2+
#include <iostream>
3+
4+
int main() {
5+
std::cout << "Linear Regression" << std::endl;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <torch/torch.h>
2+
#include <iostream>
3+
4+
int main() {
5+
std::cout << "Logistic Regression" << std::endl;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <torch/torch.h>
2+
#include <iostream>
3+
4+
int main() {
5+
std::cout << "PyTorch Basics" << std::endl;
6+
}

0 commit comments

Comments
 (0)