class_docstr: Converts TensorFlow flatbuffer models from old to new version of schema.
  
  This can convert between any version to the latest version. It uses
  an incremental upgrade strategy to go from version to version.
  
  Usage:
    converter = Converter()
    converter.Convert("a.tflite", "a.json")
    converter.Convert("b.json", "b.tflite")
class_docstr_tok: ["Converts","TensorFlow","flatbuffer","models","from","old","to","new","version","of","schema",".","This","can","convert","between","any","version","to","the","latest","version",".","It","uses","an","incremental","upgrade","strategy","to","go","from","version","to","version",".","Usage",":","converter","=","Converter","(",")","converter.Convert","(","``","a.tflite","''",",","``","a.json","''",")","converter.Convert","(","``","b.json","''",",","``","b.tflite","''",")"]
code: def __init__(self):
      # TODO(aselle): make this work in the open source version with better
      # path.
      paths_to_try = [
          "../../../../flatbuffers/flatc",  # not bazel
          "../../../../external/flatbuffers/flatc",  # bazel
      ]
      for p in paths_to_try:
          self._flatc_path = resource_loader.get_path_to_datafile(p)
          if os.path.exists(self._flatc_path):
              break
  
      def FindSchema(base_name):
          return resource_loader.get_path_to_datafile("%s" % base_name)
  
      # Supported schemas for upgrade.
      self._schemas = [
          (0, FindSchema("schema_v0.fbs"), True, self._Upgrade0To1),
          (1, FindSchema("schema_v1.fbs"), True, self._Upgrade1To2),
          (2, FindSchema("schema_v2.fbs"), True, self._Upgrade2To3),
          (
              3,
              FindSchema("schema_v3.fbs"),
              False,
              None,
          ),  # Non-callable by design.
      ]
      # Ensure schemas are sorted, and extract latest version and upgrade
      # dispatch function table.
      self._schemas.sort()
      self._new_version, self._new_schema = self._schemas[-1][:2]
      self._upgrade_dispatch = {
          version: dispatch
          for version, unused1, unused2, dispatch in self._schemas
      }
  
imports: import argparse
  import contextlib
  import json
  import os
  import shutil
  import subprocess
  import sys
  import tempfile
  import tensorflow
  from tensorflow.python.platform import resource_loader
label_desc: Use image node_id 1 to create a new Converter object  with example: obj = Converter()