third_party/tflite_support/src/tensorflow_lite_support/metadata/python/metadata.py
def _get_associated_files_from_process_units(self, table, field_name):
    """Gets the files that are attached the process units field of a table.

    Args:
      table: a Flatbuffers table object that contains fields of an array of
        ProcessUnit, such as TensorMetadata and SubGraphMetadata.
      field_name: the name of the field in the table that represents an array of
        ProcessUnit. If the table is TensorMetadata, field_name can be
        "ProcessUnits". If the table is SubGraphMetadata, field_name can be
        either "InputProcessUnits" or "OutputProcessUnits".

    Returns:
      the associated files list.
    """

    if table is None:
      return

    file_list = []
    length_method = getattr(table, field_name + "Length", None)
    member_method = getattr(table, field_name, None)
    if length_method is None or member_method is None:
      raise ValueError("{0} does not have the field {1}".format(
          type(table).__name__, field_name))

    for k in range(length_method()):
      process_unit = member_method(k)
      tokenizer = process_unit.Options()
      if (process_unit.OptionsType() is
          _metadata_fb.ProcessUnitOptions.BertTokenizerOptions):
        bert_tokenizer = _metadata_fb.BertTokenizerOptions()
        bert_tokenizer.Init(tokenizer.Bytes, tokenizer.Pos)
        file_list += self._get_associated_files_from_table(
            bert_tokenizer, "VocabFile")
      elif (process_unit.OptionsType() is
            _metadata_fb.ProcessUnitOptions.SentencePieceTokenizerOptions):
        sentence_piece = _metadata_fb.SentencePieceTokenizerOptions()
        sentence_piece.Init(tokenizer.Bytes, tokenizer.Pos)
        file_list += self._get_associated_files_from_table(
            sentence_piece, "SentencePieceModel")
        file_list += self._get_associated_files_from_table(
            sentence_piece, "VocabFile")
    return file_list
Gets the files that are attached the process units field of a table.

    Args:
      table: a Flatbuffers table object that contains fields of an array of
        ProcessUnit, such as TensorMetadata and SubGraphMetadata.
      field_name: the name of the field in the table that represents an array of
        ProcessUnit. If the table is TensorMetadata, field_name can be
        "ProcessUnits". If the table is SubGraphMetadata, field_name can be
        either "InputProcessUnits" or "OutputProcessUnits".

    Returns:
      the associated files list.
    
Gets the files that are attached the process units field of a table.
Gets the files that are attached the process units field of a table .
def _get_associated_files_from_process_units(self, table, field_name):
    if table is None:
      return
    file_list = []
    length_method = getattr(table, field_name + "Length", None)
    member_method = getattr(table, field_name, None)
    if length_method is None or member_method is None:
      raise ValueError("{0} does not have the field {1}".format(
          type(table).__name__, field_name))
    for k in range(length_method()):
      process_unit = member_method(k)
      tokenizer = process_unit.Options()
      if (process_unit.OptionsType() is
          _metadata_fb.ProcessUnitOptions.BertTokenizerOptions):
        bert_tokenizer = _metadata_fb.BertTokenizerOptions()
        bert_tokenizer.Init(tokenizer.Bytes, tokenizer.Pos)
        file_list += self._get_associated_files_from_table(
            bert_tokenizer, "VocabFile")
      elif (process_unit.OptionsType() is
            _metadata_fb.ProcessUnitOptions.SentencePieceTokenizerOptions):
        sentence_piece = _metadata_fb.SentencePieceTokenizerOptions()
        sentence_piece.Init(tokenizer.Bytes, tokenizer.Pos)
        file_list += self._get_associated_files_from_table(
            sentence_piece, "SentencePieceModel")
        file_list += self._get_associated_files_from_table(
            sentence_piece, "VocabFile")
    return file_list
def _get_associated_files_from_process_units ( self , table , field_name ) : if table is None : return file_list = [ ] length_method = getattr ( table , field_name + "Length" , None ) member_method = getattr ( table , field_name , None ) if length_method is None or member_method is None : raise ValueError ( "{0} does not have the field {1}" . format ( type ( table ) . __name__ , field_name ) ) for k in range ( length_method ( ) ) : process_unit = member_method ( k ) tokenizer = process_unit . Options ( ) if ( process_unit . OptionsType ( ) is _metadata_fb . ProcessUnitOptions . BertTokenizerOptions ) : bert_tokenizer = _metadata_fb . BertTokenizerOptions ( ) bert_tokenizer . Init ( tokenizer . Bytes , tokenizer . Pos ) file_list += self . _get_associated_files_from_table ( bert_tokenizer , "VocabFile" ) elif ( process_unit . OptionsType ( ) is _metadata_fb . ProcessUnitOptions . SentencePieceTokenizerOptions ) : sentence_piece = _metadata_fb . SentencePieceTokenizerOptions ( ) sentence_piece . Init ( tokenizer . Bytes , tokenizer . Pos ) file_list += self . _get_associated_files_from_table ( sentence_piece , "SentencePieceModel" ) file_list += self . _get_associated_files_from_table ( sentence_piece , "VocabFile" ) return file_list
Gets the files that are attached the process units field of a table.
Gets the files that are attached the process units field of a table .
"""Gets the files that are attached the process units field of a table.

    Args:
      table: a Flatbuffers table object that contains fields of an array of
        ProcessUnit, such as TensorMetadata and SubGraphMetadata.
      field_name: the name of the field in the table that represents an array of
        ProcessUnit. If the table is TensorMetadata, field_name can be
        "ProcessUnits". If the table is SubGraphMetadata, field_name can be
        either "InputProcessUnits" or "OutputProcessUnits".

    Returns:
      the associated files list.
    """
the associated files list.
the associated files list .
self
table
a Flatbuffers table object that contains fields of an array of
ProcessUnit, such as TensorMetadata and SubGraphMetadata.
a Flatbuffers table object that contains fields of an array of ProcessUnit such as TensorMetadata and SubGraphMetadata .
field_name
the name of the field in the table that represents an array of
ProcessUnit. If the table is TensorMetadata, field_name can be
"ProcessUnits". If the table is SubGraphMetadata, field_name can be
either "InputProcessUnits" or "OutputProcessUnits".
the name of the field in the table that represents an array of ProcessUnit . If the table is TensorMetadata field_name can be " ProcessUnits " . If the table is SubGraphMetadata field_name can be either " InputProcessUnits " or " OutputProcessUnits " .