Building a C++ to Python Tensor Library: Adding SGD and training an MLP
In the last post, we added basic autograd to our library, including things like nodes, thin tensor handles, graph building functions, and a bunch of helper functions. In this post, we’ll use the framework we just created, expanding functionality to work towards a trainable MLP using stochastic gradient descent (SGD). This post will focus on…
Keep readingBuilding a C++ to Python Tensor Library: Adding Autograd
We’ve gotten to the point with our tensor library that it’s probably a good time to add autograd: We have basic math functionality, we have the ability to test in Python, and we have a flexible class framework that can be expanded to handle autograd. In this post, we’ll build out the most basic version…
Keep readingBuilding a Tensor Library: Python That Compiles to Optimized C++
Now that we’ve built a Tensor class that runs on the GPU in C++, we can go ahead and build out the connection to Python. This is a good time to tackle the Python bindings, because the C++ code is built out enough that the core is unlikely to change dramatically. We want to build…
Keep readingBuilding a Tensor Class: automatic memory management, generic elementwise kernels, broadcasting
In the last post, we built a tensor calculator using CUDA and learned a lot about memory, GPU architecture, tensors, pointers, and CUDA and NVIDIA GPUs, but the calculator we built is very clunky: We have to allocate memory to it manually and call each kernel explicitly to do basic math – not ideal. So…
Keep readingBuilding a Tensor-Based Calculator with CUDA
Come along with me in this post as we create a C++ CUDA tensor calculator! This is part of a larger project to recreate a high-performance neural network tool library: Starting from the ground level of writing tensor classes that execute on GPU hardware, and building to an eventual PyTorch-style library for building simple machine…
Keep readingBuilding a Convolutional Neural Network(CNN) from scratch
After dipping my toe into machine learning(ML) in the form of building an MNIST handwritten digit classifier from scratch, without using any libraries other than the most excellent and honorable NumPy, I found myself hungry for more. While I don’t plan to continue building historical model architectures from scratch forever(because it takes positively forever), building…
Keep readingBuilding a neural net from scratch: Code Implementation
In this post, let’s get right into the code! Let’s start out by defining a basic neural network. There will be many more utility functions to write soon, but this will at least give us a basic idea of what things will look like. Our network will be comprised of layers, biases, and weights, and…
Keep readingBuilding a neural net from scratch: Motivation and Architecture
In the Machine Learning (ML) world, the equivalent of a hello world program is building a handwritten digit classifier using a neural network. I decided to take building a digit classifier on as my first project, just dipping my toe into ML and AI, to see if it was something I could compete in. There…
Keep readingWIEVLE – Autonomous underwater robot design
While working at the Naval Postgraduate School, I handled the physical design for an underwater robot which would result in further development, ongoing funding, and patents. This was one of my first professional experiences being given complete ownership over part of a project: applying the systems engineering process to a real-world design and taking a…
Keep reading