I have a model saved in r2.0 as checkpoint format. When later I load it and try to convert it to tflite I have a crash because toco doesn't know how to handle "if op" and tries to import it as an unsupported operation
=> strange because there is an if kernel registered in tflite
The crash is inside "tensorflow/lite/toco/import_tensorflow.cc:114". It tries to import a list by first checking for the word "_output_types" and because it doesn't find it the next check is for the word "Tout". When it finds this tries to load the type but one of the checks inside "GetDataTypeAttr" is for AttrValue::kType but finds AttrValue::kList, so "CHECK_EQ(attr.value_case(), AttrValue::kType);" fails
I've re-written the code to handle both cases, so now I have my .tflite file
Next problem is that at runtime I get an error that custom op If doesn't exists
=> strange because there is an if kernel registered in tflite
Again fixed this by re-registering the code of "If" as a custom op
Now there are several problems with "init", "prepare" and "eval" functions.
=> The way the "init" tries to read the params is wrong and returns incorrect results
This is solvable, instead of using reinterpret_cast<const TfLiteIfParams*>(buffer); one can read the buffer as flextbffer into a flexbuffers::Map and query the values
=> The "prepare" and "eval" functions expect the .tflite file to have subgraphs, but only one exists in the file. This to me is unsolvable.
I have no clue how either to write a new "if op" or have toco create a .tflite with multiple subgraphs (different subgraph per "if op" per branch (true/false))
Any help?
thnx