Skip to content

A simple feed forward neural network implementation for macroexpand-2025 using jank's seamless C++ interop.

License

Notifications You must be signed in to change notification settings

shantanu-sardesai/macroexpand-2025

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jank @ macroexpand 2025

This repo is a reproduction of Jianling's implementation of a neural net in pytorch using jank's seamless C++ interop.

Prerequisites

Clone the project and fetch all the git submodules.

git submodule update --recursive --init

PyTorch

Currently the build setup only works for MacOS.

To get libtorch on other OS's you can get it directly from the PyTorch website by selecting the following options:

  1. PyTorch Build: Stable.
  2. Your OS.
  3. Package: LibTorch.
  4. Language: C++.
  5. Compute platform: Default (Auto-selected).

And then running the command displayed on their site.

NOTE: If you get libtorch from their site instead of building it locally the Makefile variables will need to be updated to point to the new installation.

Setup pytorch by running the following commands:

cd third-party/pytorch
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
python3 -m pip install -r requirements-build.txt

# The python venv needs to be active and the root of the project needs to be the current working directory.
cd ../..
./bin/install_libtorch.sh

Download the sample data for training from here and place it in the data folder.

Test the setup

make test-setup

C++ Interop

Run with interop

make run

Debug interop

make repl

Quick links

About

A simple feed forward neural network implementation for macroexpand-2025 using jank's seamless C++ interop.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published