Create a Graph to Execute a TensorFlow Application
The SAP Data Hub Modeler provides a dockerized execution environment for TensorFlow (TF) programs with Python 2.7 and TensorFlow 1.7.0.
Context
Procedure
- Start the SAP Data Hub Modeler.
-
In the navigation pane, choose the Repository tab.
The tool displays all graphs, operators, and Dockerfiles available in your repository and is grouped under the tabs, Graphs, Operators, Docker Files respectively.
-
Create an operator.
If you want to execute a TensorFlow application using the modeler, first create an operator that includes the TensorFlow application code.
-
Right-click the Operators section and choose Create
Folder to create a new folder in which you want to
define the operator.
- Right-click the folder in which you want to create the operator and choose the Create Operator menu option.
- In the Name text field, provide a name as the identifier name for the operator as trainOP.
-
In Display Name text field, a display name for the operator as
Train MNIST.
You can use the display name to search and add the operator when creating graphs.
-
In the Base Operator dropdown list, select
Python2Operator.
The operator that you create is derived from the base operators that SAP Data Hub provides.
-
Choose OK.
The tool opens an operator editor window. The operator editor is a form-based editor, where you can define the operator.
-
Right-click the Operators section and choose Create
Folder to create a new folder in which you want to
define the operator.
-
Define the operator.
Use the operator editor view to define your operator.
-
In the Tags section, choose the + (Add tag)
icon.
Tags describe the runtime requirements of operators and are the annotations of Dockerfiles that the tool provides.
- In the dropdown list, select the python27 tag and choose no version.
- In the Tags section, choose the + (Add tag) icon to create an additional tag.
-
In the dropdown list, select the tensorflow tag and choose the
version 1.7.0.
- Define input and output ports of the type. For example, message.python.image for incoming images and string for the output result.
- In the inline editor add the tensorflow application code.
-
In the Tags section, choose the + (Add tag)
icon.
-
Save the operator.
-
In the editor toolbar, choose (Save) to save the operator.
You can now use the TensorFlow training operator in a graph.
-
In the editor toolbar, choose (Save) to save the operator.
-
Create a graph with TensorFlow operator.
After creating a TensorFlow operator, t, you can use the operator in a graph.
- Switch to the Graphs tab.
-
In the navigation pane toolbar, choose + (Create Graph).
The tool opens an empty graph editor in the same window, where you can define your graph.
- In the navigation pane, choose the Operators tab.
-
In the list of operators, select the Train MNIST operator that you
created.
Your graph now consists of only one operator, which contains the TensorFlow application.
-
Save the graph.
- After creating a graph, in the editor toolbar, choose (Save) to save your graph.
- Choose the Save menu option.
-
Provide a name along with the fully qualified path to the graph.
For example, com.orgname.others.graphname.
- Provide a description to the graph.
- Choose OK.
-
Execute the graph.
- In the editor toolbar, choose (Run).
- Select the Run menu option to execute the graph.
Related Information