You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The change_batch_size rewrite (see #4) works by putting the new batch size in place at the input nodes, then propagating the batch size through the rest of the graph by shape inference. If the user does not specify all the input nodes, then the remaining nodes will produce a conflicting batch sizes. This can result in an error (if a node ends up with two mutually inconsistent input batch sizes) or in the rewrite having no apparent effect on output batch sizes (if the user changes the batch size to None). As I noted in #13, the script batch_size_example.py has the latter problem. The batch size changes to None, but implicit inputs inside the batch normalization layers change the output batch size to 64.
The proper fix for this problem is as follows:
Add error checking code to the change_batch_size rewrite. If the batch size of a node doesn't change, or if type inference fails; then the rewrite should output a detailed error message. The message should contain the name of the node, the node's input shapes, and the names of the nodes that produced those shapes).
Use the error checking code to track down all the hidden inputs in the batch_size_example.py script and add them to the inputs set. Note that it may be necessary to run the input graph through the freeze graph script to remove variables. You can invoke the freeze graph script from python by adding from tensorflow.python.tools import freeze_graph to the beginning of your script and calling freeze_graph. freeze_graph_with_def_protos() directly.
The text was updated successfully, but these errors were encountered:
The
change_batch_size
rewrite (see #4) works by putting the new batch size in place at the input nodes, then propagating the batch size through the rest of the graph by shape inference. If the user does not specify all the input nodes, then the remaining nodes will produce a conflicting batch sizes. This can result in an error (if a node ends up with two mutually inconsistent input batch sizes) or in the rewrite having no apparent effect on output batch sizes (if the user changes the batch size toNone
). As I noted in #13, the scriptbatch_size_example.py
has the latter problem. The batch size changes toNone
, but implicit inputs inside the batch normalization layers change the output batch size to 64.The proper fix for this problem is as follows:
change_batch_size
rewrite. If the batch size of a node doesn't change, or if type inference fails; then the rewrite should output a detailed error message. The message should contain the name of the node, the node's input shapes, and the names of the nodes that produced those shapes).batch_size_example.py
script and add them to the inputs set. Note that it may be necessary to run the input graph through the freeze graph script to remove variables. You can invoke the freeze graph script from python by addingfrom tensorflow.python.tools import freeze_graph
to the beginning of your script and callingfreeze_graph. freeze_graph_with_def_protos()
directly.The text was updated successfully, but these errors were encountered: