I find it difficult for me to understand how graphs work in a tensor flow and how to access them. My intuition is that the lines under "with the graph:" form the graph as a whole. Therefore, I decided to create a class that would build the graph when creating the instance and have a function that would run the graph, as shown below;
class Graph(object):
The next steps are to create a main file that will collect the parameters for the transition to the class, build a graph and then run it;
#Main file ... parameters_dict = { 'n_input': 28, 'learnRate': 0.001, ... }
This is very elegant for me, but it doesnβt quite work (obviously). Indeed, it seems that launchG functions do not have access to the nodes defined on the graph that give me an error, for example;
---> 26 sess.run(optimizer, feed_dict) NameError: name 'optimizer' is not defined
Perhaps my understanding of python (and tensorflow) is too limited, but I had a strange impression that when creating a graph (G), starting a session with this graph as an argument should give access to the nodes in it, without requiring explicit access.
Any enlightenment?
source share