• Ted Themistokleous's avatar
    Simplify parse_if to remove literal and broadcasting for empty branches · 62c746eb
    Ted Themistokleous authored
    Just grab the last output from the non empty branch and use the identity
    operator to get the proper shape for the output branch. In the case of
    an empty branch (empty tensor, of some type) this tends to mean "Do nothing"
    so we're folding the output of the other flow branch here, and thus if somehow,
    we do reach this at eval, should throw an error signalling either one of two things
    
    1. Onnx model is invalid
    2. The model has run into an error condition with its control flow.
    
    Since IF is an odd operator that can adjust axes, and other operators in a data driven
    fashion, this would serve as a check at compile and or/runtime.
    62c746eb
parse_if.cpp 7.37 KB