I have a algorithm to produce the parameters which could be feed to Tensorflow to construct DL models. The parameters are like this : hidden_layer_neurons = [100, 200, 300, 400, 500].
Because in TF, we cannot use the for-loop with python, therefore, I cannot use this manner to build the multi-layer model by reading the elements in hidden_layer_neurons.
Is there any way to solve my question? Thanks in advance.
When constructing a TF graph it is perfectly valid/possible to allow all kinds of python constructs as loops. So as long as you can structure your program in a way that modifying the graph (using loops) does not need to happen during graph evaluation (e.g. run you algorithm upfront and then construct the graph) there’s no problem at all.
If you would however need to iterate during graph evaluation (e.g. during a Session.run() ) then you’d need flow control ops.