Tensor allocations and Tensorflow Session support added #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR completes the entire prediction pipeline. If you have a graph you can now completely generate predictions. Tensor allocation functions have also been added which are used for holding output tensors which only obtain their values after a session is run successfully.
To exemplify the working of the entire prediction pipeline, I am going to use the simple toy graph created by the script in
examples/
calledgraphdef_create.py
. Upon running the script you should have a graph definition file calledgraphdef.pb
. You can also download this file stored in my Dropbox here.Then I would recommend going through the
graphdef_create.py
file to get an idea of what the operations are. The code basically works like a very simple matrix multiplication of some predefined weights with the input and then the addition of the biases. Ideally the weights should be ascertained through training but since this is a toy example they are predefined (look here in the code).The more important thing to notice in the
graphdef_create.py
file are the operations where the input is fed and where the output is obtained. It is important to know the names of these operations as when we perform Inference the input will be fed to that named input operation and the output will be obtained similarly. The names of the operations are required to run sessions. In our toy example, the input operation is assigned the name "input" (look here in the code) and the output operation is assigned the name "output" (look here in the code).Now in Tensorflex, the Inference would go something like this:
float32
tensor created using thefloat32_tensor
function.float32_tensor_alloc
function instead offloat32_tensor
.run_session
function takes 5 inputs: the graph definition, the input tensor, the output tensor, the name of the input operation and the output operation. This is why knowing the names of your input and output operations is important.