This short post shows how to replace some operations in a TensorFlow graph that has been reloaded from a .pb file. This is actually quite simple to do, but all the tutorials that I found when I needed to do this were for older versions of TensorFlow, so it took me way longer than it should have.
First of all, let’s create a toy graph and save it to a file.
This graph includes a matrix of shape (2, 4) which gets multiplied by another matrix of shape (4, 3), so that the resulting matrix has shape (2, 3). This is then added to another matrix of shape (2, 3) to give the final result.
Then, the graph is saved and one has to specify what are the input and output tensors of the graph. In this case they are
Now, we want to reload the…
View original post 121 more words