model-optimization
model-optimization copied to clipboard
remove early out in xnnpack pruning policy model traversal
If there are multiple input layers (and therefore paths), this early out might return an empty set before all paths are checked. By simply removing it, the path that doesn't have a next layer ends, nothing is added to the found_layers and the other paths continue to be checked.
I stumbled upon this with a model that had multiple inputs, one of which was feeding directly into the last (custom) layer. As soon as the traversal found no next layer after it, I got the error message of no valid input branch:
'Could not find
Conv2D 3x3layer with stride 2x2,input filters == 3andVALIDpadding and precedingZeroPadding2Dwithpadding == 1in all input branches of the model'