This code is heavily based on: https://realpython.com/numpy-tensorflow-performance/ I wound up feeling like this was a poor starting point after all; it uses terse variable names and isn't modularized terribly well.