third_party/tflite_support/src/tensorflow_lite_support/metadata/python/metadata.py
def load_metadata_buffer(self, metadata_buf):
    """Loads the metadata buffer (in bytearray) to be populated.

    Args:
      metadata_buf: metadata buffer (in bytearray) to be populated.

    Raises:
      ValueError: The metadata to be populated is empty.
      ValueError: The metadata does not have the expected flatbuffer identifer.
      ValueError: Cannot get minimum metadata parser version.
      ValueError: The number of SubgraphMetadata is not 1.
      ValueError: The number of input/output tensors does not match the number
        of input/output tensor metadata.
    """
    if not metadata_buf:
      raise ValueError("The metadata to be populated is empty.")

    self._validate_metadata(metadata_buf)

    # Gets the minimum metadata parser version of the metadata_buf.
    min_version = _pywrap_metadata_version.GetMinimumMetadataParserVersion(
        bytes(metadata_buf))

    # Inserts in the minimum metadata parser version into the metadata_buf.
    metadata = _metadata_fb.ModelMetadataT.InitFromObj(
        _metadata_fb.ModelMetadata.GetRootAsModelMetadata(metadata_buf, 0))
    metadata.minParserVersion = min_version

    b = flatbuffers.Builder(0)
    b.Finish(metadata.Pack(b), self.METADATA_FILE_IDENTIFIER)
    metadata_buf_with_version = b.Output()

    self._metadata_buf = metadata_buf_with_version
Loads the metadata buffer (in bytearray) to be populated.

    Args:
      metadata_buf: metadata buffer (in bytearray) to be populated.

    Raises:
      ValueError: The metadata to be populated is empty.
      ValueError: The metadata does not have the expected flatbuffer identifer.
      ValueError: Cannot get minimum metadata parser version.
      ValueError: The number of SubgraphMetadata is not 1.
      ValueError: The number of input/output tensors does not match the number
        of input/output tensor metadata.
    
Loads the metadata buffer (in bytearray) to be populated.
Loads the metadata buffer ( in bytearray ) to be populated .
def load_metadata_buffer(self, metadata_buf):
    if not metadata_buf:
      raise ValueError("The metadata to be populated is empty.")
    self._validate_metadata(metadata_buf)
    min_version = _pywrap_metadata_version.GetMinimumMetadataParserVersion(
        bytes(metadata_buf))
    metadata = _metadata_fb.ModelMetadataT.InitFromObj(
        _metadata_fb.ModelMetadata.GetRootAsModelMetadata(metadata_buf, 0))
    metadata.minParserVersion = min_version
    b = flatbuffers.Builder(0)
    b.Finish(metadata.Pack(b), self.METADATA_FILE_IDENTIFIER)
    metadata_buf_with_version = b.Output()
    self._metadata_buf = metadata_buf_with_version
def load_metadata_buffer ( self , metadata_buf ) : if not metadata_buf : raise ValueError ( "The metadata to be populated is empty." ) self . _validate_metadata ( metadata_buf ) min_version = _pywrap_metadata_version . GetMinimumMetadataParserVersion ( bytes ( metadata_buf ) ) metadata = _metadata_fb . ModelMetadataT . InitFromObj ( _metadata_fb . ModelMetadata . GetRootAsModelMetadata ( metadata_buf , 0 ) ) metadata . minParserVersion = min_version b = flatbuffers . Builder ( 0 ) b . Finish ( metadata . Pack ( b ) , self . METADATA_FILE_IDENTIFIER ) metadata_buf_with_version = b . Output ( ) self . _metadata_buf = metadata_buf_with_version
Loads the metadata buffer (in bytearray) to be populated.
Loads the metadata buffer ( in bytearray ) to be populated .
"""Loads the metadata buffer (in bytearray) to be populated.

    Args:
      metadata_buf: metadata buffer (in bytearray) to be populated.

    Raises:
      ValueError: The metadata to be populated is empty.
      ValueError: The metadata does not have the expected flatbuffer identifer.
      ValueError: Cannot get minimum metadata parser version.
      ValueError: The number of SubgraphMetadata is not 1.
      ValueError: The number of input/output tensors does not match the number
        of input/output tensor metadata.
    """ # Gets the minimum metadata parser version of the metadata_buf. # Inserts in the minimum metadata parser version into the metadata_buf.
The metadata to be populated is empty.
The metadata to be populated is empty .
ValueError
The metadata does not have the expected flatbuffer identifer.
The metadata does not have the expected flatbuffer identifer .
ValueError
Cannot get minimum metadata parser version.
Cannot get minimum metadata parser version .
ValueError
The number of SubgraphMetadata is not 1.
The number of SubgraphMetadata is not 1 .
ValueError
The number of input/output tensors does not match the number
of input/output tensor metadata.
The number of input / output tensors does not match the number of input / output tensor metadata .
ValueError
self
metadata_buf
metadata buffer (in bytearray) to be populated.
metadata buffer ( in bytearray ) to be populated .