TFLite subgraphs do not necessarily have names, though MLIR functions must have them, so we generate a name for subgraphs that are missing one here. Note: in TFLite, the first subgraph is the entry point, and in MLIR that represents TFLite, this entry point must be called "main" TODO(b/131175224,b/132239787) Support multiple entry points
| 953 | // represents TFLite, this entry point must be called "main" |
| 954 | // TODO(b/131175224,b/132239787) Support multiple entry points |
| 955 | std::string SubgraphName(unsigned index, const tflite::SubGraphT& subgraph) { |
| 956 | if (index == 0) { |
| 957 | return "main"; |
| 958 | } |
| 959 | if (subgraph.name.empty()) { |
| 960 | return llvm::formatv("fn_{0}", index).str(); |
| 961 | } |
| 962 | return subgraph.name; |
| 963 | } |
| 964 | } // namespace |
| 965 | |
| 966 | OwningModuleRef tflite::FlatBufferToMlir( |