Whenever I press Enter, I want to push the "value" of the label to my stack, and clear the "display": The graph is created as part of the session, I just wanted to illustrate that I am working on the graph by have an instance refering to it. Procedure TForm1.FormDestroy(Sender: TObject) Procedure TForm1.FormCreate(Sender: TObject) Procedure FormKeyDown(Sender: TObject var Key: Word Shift: TShiftState) Īs can be seen above did I include four methods - the constructor and the destructor: Procedure FormKeyPress(Sender: TObject var Key: Char) We want to use a generic, TStack by using the, and we also include TensorFlow.DApi and TensorFlow.DApiOperations from Hartmut's wrapper in our uses clause, and create a TensorFlow session and graph variable. I wanted to make this example as simple as possible, so I do only handle keyboard input by setting the Forms.KeyPreview to true.
#CVS DELPHI CODE#
For the font of the label I used, which was close enough - even though I did plan to include some code for an extended 7 segmented control - that does behave like the HP display - but that must be another time. The form just consists of a TLabel and a TImage populated with an image of a calculator. We will in this small example use two types of nodes - a constant and a operation. The graph consists of nodes, that can be connected by zero or more "tensors" as input, and produce a "tensor" as output. TensorFlow is based on a computational graph, that first is build and the run. I am by no means an expert on TensorFlow or Machine Learning, so I will just give a bit of basic in the current context. Put these two together with the application we build or in the path.Īlso download the. While we are at it also grab python36.dll from \AppData\Local\Programs\Python\Python36\ - a bit scary that it seems we have to jump these hoops, when support for others languages is supported.
#CVS DELPHI INSTALL#
One way to get hold of the tensorflow.dll is to install it via Pythons pip install as described on the webpage here, and then just grab and rename _pywrap_tensorflow_internal.pyd to tensorflow.dll from \AppData\Local\Programs\Python\Python36\Lib\site-packages\tensorflow\python\. I will reach out to Hartmut, and see if we could get his code placed on something like GitHub - which could be beneficial since a bit of syntactical sugar could be added, by maybe adding the contributions of others. But might include a link to my git repository, where I have the files including a missing subtract function. The wrappers can also be downloaded from his site - and I have not included then here. Hartmut has a couple of German articles on his work on the wrappers that also include test units. The Delphi wrappers are done by Hartmut David ( ), and based on the structure of the C# porting of the TensorFlow C-API by Miguel Deicaza ( ). One of my best friends in school had an HP-12C while I had a TI-30 - and we had this endless battle on what notation was best - I guess you mock what you do not understand - but then again I never saw him do anything but addition and subtraction on his cool HP-12C ?
dll so you might skip the renaming hassle described below. And I did a pull request for the missing OpSub. Update: Hartmut David was so kind to now put his code on GitHub ( ) - thanks!.
And this is also a tribute to the old HP reverse polish notation calculators I never had ?.
#CVS DELPHI HOW TO#
This post is a very simple example on how to use "Google's" TensorFlow - which is an open source Machine Learning library.