pyrtlnet Documentation¶
pyrtlnet is a hardware implementation of quantized dense neural network inference in the PyRTL hardware description language.
Let’s unpack some of those keywords:
- Neural Network
A neural network is really just a very large math equation that happens to be good at making predictions for a particular problem. pyrtlnet uses the MNIST data set, which consists of images of hand-written digits. In our case, the problem is determining which digit is shown in each image.
- Inference
Inference means we’re only using the neural network to make predictions, as opposed to training, which figures out how to adjust the neural network’s equation so it makes better predictions.
- Quantized
pyrtlnet is fully quantized, which means it only does math with integers. No floating-point math is required. Integer operations are easier to implement in hardware, and PyRTL conveniently implements signed integer arithmetic.
- Dense
pyrtlnet is a dense neural network, which means all of its layers are fully-connected, and all the linear algebra involves dense (as opposed to sparse) matrices. Dense matrices look like your standard matrices from high school math, for example:
┌ ┐ │ 1 2 3 │ │ -8 6 7 │ └ ┘
- Hardware Description Language (HDL)
Most programming languages describe software, but a hardware description language describes hardware. Verilog is a commonly used hardware description language. pyrtlnet uses the PyRTL hardware description language, which is Python-based.
This is the detailed reference documentation for the pyrtlnet code, useful when using or modifying the code. If you’re just getting started, try the installation instructions and tutorial in README.md.
This reference documentation is split into six sections:
Training Implementation, which covers the TensorFlow training functions.
LiteRT Inference, which uses the reference LiteRT
Interpreterimplementation.NumPy Inference, a software re-implementation in NumPy and fxpmath.
PyRTL Inference, a hardware re-implementation in PyRTL.
PyRTL Matrix Library, which covers the included PyRTL linear algebra library.
PyRTL AXI Library, a basic PyRTL implementation of the AXI protocol, which can be useful for integrating pyrtlnet’s hardware with other systems.