Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Introduction

While Python is a coding language that is very easy to write, it comes with some of its own drawbacks, mainly when it comes to efficiency in the code. One way to improve upon this is to implement functions written in more efficient languages such as C or C++. This is best for functions that are called often and need to be faster. One common example is game engines. It also allows you to use C or C++ libraries in your code.

# Background information

One of the main ways to import a C/C++ extension is to create a setup.py script that uses setuptools, which is a Python extension. This script will work to compile the C/C++ code. The setup.py can be found in extension-ffi/package. Then as seen in the extension-ffi/package/script/src folder there are C++ files. These files are parts of the code that can be more efficiently written in other languages and Python can import. From here we can do a forward pass, and pass it into C/C++. This is just a calculation process of the output layers based on the input parameters. Then a backward function gets these output gradients and computes the input using scalar values. Laslly, you bind the new code to Python in order to be able to use it for your project.

# PyTorch C FFI examples

In this repository you can find examples showing how to extend PyTorch with
Expand Down