third_party/tflite_support/src/tensorflow_lite_support/metadata/python/metadata.py
def _get_metadata_buffer(model_buf):
    """Returns the metadata in the model file as a buffer.

    Args:
      model_buf: valid buffer of the model file.

    Returns:
      Metadata buffer.

    Raises:
      ValueError: The model does not have metadata.
    """
    tflite_model = _schema_fb.Model.GetRootAsModel(model_buf, 0)

    # Gets metadata from the model file.
    for i in range(tflite_model.MetadataLength()):
      meta = tflite_model.Metadata(i)
      if meta.Name().decode("utf-8") == MetadataPopulator.METADATA_FIELD_NAME:
        buffer_index = meta.Buffer()
        metadata = tflite_model.Buffers(buffer_index)
        metadata_buf = metadata.DataAsNumpy().tobytes()
        return metadata_buf

    raise ValueError("The model does not have metadata.")
Returns the metadata in the model file as a buffer.

    Args:
      model_buf: valid buffer of the model file.

    Returns:
      Metadata buffer.

    Raises:
      ValueError: The model does not have metadata.
    
Returns the metadata in the model file as a buffer.
Returns the metadata in the model file as a buffer .
def _get_metadata_buffer(model_buf):
    tflite_model = _schema_fb.Model.GetRootAsModel(model_buf, 0)
    for i in range(tflite_model.MetadataLength()):
      meta = tflite_model.Metadata(i)
      if meta.Name().decode("utf-8") == MetadataPopulator.METADATA_FIELD_NAME:
        buffer_index = meta.Buffer()
        metadata = tflite_model.Buffers(buffer_index)
        metadata_buf = metadata.DataAsNumpy().tobytes()
        return metadata_buf
    raise ValueError("The model does not have metadata.")
def _get_metadata_buffer ( model_buf ) : tflite_model = _schema_fb . Model . GetRootAsModel ( model_buf , 0 ) for i in range ( tflite_model . MetadataLength ( ) ) : meta = tflite_model . Metadata ( i ) if meta . Name ( ) . decode ( "utf-8" ) == MetadataPopulator . METADATA_FIELD_NAME : buffer_index = meta . Buffer ( ) metadata = tflite_model . Buffers ( buffer_index ) metadata_buf = metadata . DataAsNumpy ( ) . tobytes ( ) return metadata_buf raise ValueError ( "The model does not have metadata." )
Returns the metadata in the model file as a buffer.
Returns the metadata in the model file as a buffer .
"""Returns the metadata in the model file as a buffer.

    Args:
      model_buf: valid buffer of the model file.

    Returns:
      Metadata buffer.

    Raises:
      ValueError: The model does not have metadata.
    """ # Gets metadata from the model file.
None
The model does not have metadata.
The model does not have metadata .
ValueError
model_buf
valid buffer of the model file.
valid buffer of the model file .