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","''",")"]
docstr: Upgrade data from Version 2 to Version 3.
  
  Changed actual read-only tensor data to be in a buffers table instead
  of inline with the tensor.
  
  Args:
    data: Dictionary representing the TensorFlow lite data to be upgraded.
      This will be modified in-place to be an upgraded version.
docstr_tok: ["Upgrade","data","from","Version","2","to","Version","3",".","Changed","actual","read-only","tensor","data","to","be","in","a","buffers","table","instead","of","inline","with","the","tensor",".","Args",":","data",":","Dictionary","representing","the","TensorFlow","lite","data","to","be","upgraded",".","This","will","be","modified","in-place","to","be","an","upgraded","version","."]
code: def _Upgrade2To3(self, data):
      """Upgrade data from Version 2 to Version 3.
  
      Changed actual read-only tensor data to be in a buffers table instead
      of inline with the tensor.
  
      Args:
        data: Dictionary representing the TensorFlow lite data to be upgraded.
          This will be modified in-place to be an upgraded version.
      """
      buffers = [{"data": []}]  # Start with 1 empty buffer
      for subgraph in data["subgraphs"]:
          if "tensors" not in subgraph:
              continue
          for tensor in subgraph["tensors"]:
              if "data_buffer" not in tensor:
                  tensor["buffer"] = 0
              else:
                  if tensor["data_buffer"]:
                      tensor["buffer"] = len(buffers)
                      buffers.append({"data": tensor["data_buffer"]})
                  else:
                      tensor["buffer"] = 0
                  del tensor["data_buffer"]
      data["buffers"] = buffers
  
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 6 for calling the Converter obj's underlying member method code with example usage: obj._Upgrade2To3(data) without return types