Class ModelMetadata

Class Documentation

class ModelMetadata

This class holds the metadata associated with a model (per the KServe spec). This allows clients to query this information from the server.

Public Functions

ModelMetadata(const std::string &name, const std::string &platform)

Constructs a new Model Metadata object.

Parameters
  • name – Name of the model

  • platform – the platform this model runs on

void addInputTensor(const std::string &name, DataType datatype, std::initializer_list<uint64_t> shape)

Adds an input tensor to this model.

Parameters
  • name – name of the tensor

  • datatype – datatype of the tensor

  • shape – shape of the tensor

void addInputTensor(const std::string &name, DataType datatype, std::vector<int> shape)

Adds an input tensor to this model.

Parameters
  • name – name of the tensor

  • datatype – datatype of the tensor

  • shape – shape of the tensor

const std::vector<ModelMetadataTensor> &getInputs() const

Gets the input tensor’ metadata for this model.

Returns

const std::vector<ModelMetadataTensor>&

void addOutputTensor(const std::string &name, DataType datatype, std::initializer_list<uint64_t> shape)

Adds an output tensor to this model.

Parameters
  • name – name of the tensor

  • datatype – datatype of the tensor

  • shape – shape of the tensor

void addOutputTensor(const std::string &name, DataType datatype, std::vector<int> shape)

Adds an output tensor to this model.

Parameters
  • name – name of the tensor

  • datatype – datatype of the tensor

  • shape – shape of the tensor

const std::vector<ModelMetadataTensor> &getOutputs() const

Gets the output tensors’ metadata for this model.

void setName(const std::string &name)

Sets the model’s name.

const std::string &getName() const

Gets the model’s name.

const std::string &getPlatform() const
void setReady(bool ready)

Marks this model as ready/not ready.

bool isReady() const

Checks if this model is ready.