Class InferResult¶
Defined in File common.h
Class Documentation¶
-
class
InferResult
¶ An interface for InferResult object to interpret the response to an inference request.
Public Functions
-
virtual
~InferResult
()¶
-
virtual Error
ModelName
(std::string *name) const = 0¶ Get the name of the model which generated this response.
- Return
Error object indicating success or failure.
- Parameters
name
: Returns the name of the model.
-
virtual Error
ModelVersion
(std::string *version) const = 0¶ Get the version of the model which generated this response.
- Return
Error object indicating success or failure.
- Parameters
version
: Returns the version of the model.
-
virtual Error
Id
(std::string *id) const = 0¶ Get the id of the request which generated this response.
- Return
Error object indicating success or failure.
- Parameters
version
: Returns the version of the model.
-
virtual Error
Shape
(const std::string &output_name, std::vector<int64_t> *shape) const = 0¶ Get the shape of output result returned in the response.
- Return
Error object indicating success or failure.
- Parameters
output_name
: The name of the ouput to get shape.shape
: Returns the shape of result for specified output name.
-
virtual Error
Datatype
(const std::string &output_name, std::string *datatype) const = 0¶ Get the datatype of output result returned in the response.
- Return
Error object indicating success or failure.
- Parameters
output_name
: The name of the ouput to get datatype.shape
: Returns the datatype of result for specified output name.
-
virtual Error
RawData
(const std::string &output_name, const uint8_t **buf, size_t *byte_size) const = 0¶ Get access to the buffer holding raw results of specified output returned by the server.
Note the buffer is owned by InferResult instance. Users can copy out the data if required to extend the lifetime.
- Return
Error object indicating success or failure of the request.
- Parameters
output_name
: The name of the output to get result data.buf
: Returns the pointer to the start of the buffer.byte_size
: Returns the size of buffer in bytes.
-
virtual Error
StringData
(const std::string &output_name, std::vector<std::string> *string_result) const = 0¶ Get the result data as a vector of strings.
The vector will receive a copy of result data. An error will be generated if the datatype of output is not ‘BYTES’.
- Return
Error object indicating success or failure of the request.
- Parameters
output_name
: The name of the output to get result data.string_result
: Returns the result data represented as a vector of strings. The strings are stored in the row-major order.
-
virtual std::string
DebugString
() const = 0¶ Returns the complete response as a user friendly string.
- Return
The string describing the complete response.
-
virtual