TensorFlow is a machine learning and AI library that has enabled so much and brought AI within the reach of most developers. But it’s fair to say that it’s not for the less powerful computers. For them there’s TensorFlow Lite, in which a model is created on a larger machine and exported to a microcontroller or similarly resource-constrained one. [Nick Bild] has probably taken this to its extreme though, by achieving this feat on a Commodore 64. Not just that, but he’s also done it using Commodore BASIC.
TensorFlow Lite works by the model being created as a C array which is then parsed and run by an interpreter on the microcontroller. This is a little beyond the capabilities of the mighty 64, so he has instead created a Python script that does the job of the interpreter and produces Commodore BASIC code that can run on the 64. The trusty Commodore was one of the more powerful home computers of its day, but we’re fairly certain that its designers never in their wildest dreams expected it to be capable of this!
If you’re interested to know more about TensorFlow Lite, we’ve covered it in the past.
Header: MOS6502, CC BY-SA 3.0.
Those usb inference accelerators are all int8 anyways, time for the 6502 to shine bright again!
I don’t think the 6502 would have been problem. Its design was used in the NES and Apple II, too.
Personally, I think it’s amazing that the author did successfully use C64 Basic (Basic 2). Without in-line assembly code! Plain C64 Basic alone is horrid.
With Simons’ Basic or C128 Basic (Basic v7), things would have been more practical.
C64 6510 barely managed 1Mhz. Its strengths as a 8 bit micro largely came from its support chips, VIC II & SID. I don’t imagine those playing any role here. The BASIC interpreter was literally as basic as an it could be and it was very poorly coded. Combined with the sluggish 6502 variant makes this project even more impressive!
It’s such a small piece of code. I think if it was compiled to assembly, then the C64 could do much more and much faster. What I’d really like to know is what the limit that the C64 could do…