Forum > Third party

Pascal for TensorFlow

(1/5) > >>

New article on some first steps toward a Pascal for TensorFlow:

If you have any interest in machine learning, neural networks, matrix arithmetic, this article and downloadable code is for you.

Source is included for several Pascal example programs, from simple to complex. All have been tested against TensorFlow 1.8 on these platforms:

    macOS 10.11 El Capitan
    macOS 10.13 High Sierra
    Ubuntu 14.04

If you want to learn a bit about the things behind machine learning, you might take a look at Google's "crash course". The videos are quite short and easy digestible. Really. I was able to cruise through a half dozen before my brain fogged over.

Related article, possibly inspirational:

Machine learning projects often fall into one of several areas: image classification (as in the beer app and the Pascal example MNIST program), natural language text classification, and more general stuff related to numerical categorization and estimation.

I was curious about how well TensorFlow scales, so I timed some runs of the MNIST.pas image classification demo program. This program is not memory limited on systems with at least 4GB RAM and does not do any disk I/O within the training loop, so it should be a good example of a compute-bound program.

Note that MNIST.pas works with a 60000 x 784 input matrix (188 MB of memory).

On my old Late 2008 MacBook, MNIST took exactly 60 seconds to complete.

Next I tested MNIST on a 2017 MacBook. This is still a dual-core CPU, but a Core i7 which is clocked faster. It took 25 seconds, meaning a nice 2x bump as expected for a newer chip.

Finally I tested MNIST on an 8-core AWS instance running Ubuntu. In tests of other compute-bound models, this system has similar performance to the 2017 MacBook when utilizing only a single core. This system ran MNIST in only 12 seconds, suggesting that it was able to utilize more cores to do the arithmetic faster, without requiring any changes to the Pascal code.

Note that the TensorFlow library has a permissive Apache license. The Pascal for TensorFlow units are released under the same modified LGPL license as FPC RTL, meaning there shouldn't be many restrictions on your use of TensorFlow in any app you might write.

Thanks I'm interested. I need to find the time to try.

I once was on a live stream of Microsoft Latinoamérica but it was only - as I see it - a way to sell his own service of machine learning. It was too short and I get nothing with it.

Hope this is something I can afford and use.

Edit: oh this is free  :)


--- Quote from: lainz on July 16, 2018, 02:23:00 am ---Edit: oh this is free  :)

--- End quote ---

Yes, free and open source. I have only tested on macOS and Linux, but TensorFlow library is also available for Windows and Raspian. I've also tested on earlier versions of macOS and Ubuntu than what they give here:

The easiest way to obtain the TensorFlow library binaries on macOS and Linux is just to use the simple curl script given here:

Or just download the .gz directly. For example, for Linux or macOS with no GPU support:

And with all platforms, there are instructions for obtaining TensorFlow via Python's pip command, the assumption probably being that you'll use Python with TensorFlow (although we don't need Python at all with the Pascal interface).

One other way to get a copy of the TensorFlow binaries on macOS and Ubuntu is to install Swift for TensorFlow. I've tested that as well:

There's also TensorFlow Lite for mobile and embedded, although again I have not tested it:


[0] Message Index

[#] Next page

Go to full version