Class InferContext::Result¶
- Defined in File request.h
Class Documentation¶
-
class
Result An inference result corresponding to an output.
Public Types
Public Functions
-
virtual
~Result() Destroy the result.
-
virtual const std::string &
ModelName() const = 0 - Return
- The name of the model that produced this result.
-
virtual int64_t
ModelVersion() const = 0 - Return
- The version of the model that produced this result.
-
virtual const std::shared_ptr<Output>
GetOutput() const = 0 - Return
- The Output object corresponding to this result.
-
virtual Error
GetRawShape(std::vector<int64_t> *shape) const = 0 Get the shape of a raw result.
The shape does not include the batch dimension.
- Return
- Error object indicating success or failure.
- Parameters
shape: Returns the shape.
-
virtual Error
GetRaw(size_t batch_idx, const std::vector<uint8_t> **buf) const = 0 Get a reference to entire raw result data for a specific batch entry.
Returns error if this result is not RAW format.
- Return
- Error object indicating success or failure.
- Parameters
batch_idx: Returns the results for this entry of the batch.buf: Returns the vector of result bytes.
-
virtual Error
GetRawAtCursor(size_t batch_idx, const uint8_t **buf, size_t adv_byte_size) = 0 Get a reference to raw result data for a specific batch entry at the current “cursor” and advance the cursor by the specified number of bytes.
More typically use GetRawAtCursor<T>() method to return the data as a specific type T. Use ResetCursor() to reset the cursor to the beginning of the result. Returns error if this result is not RAW format.
- Return
- Error object indicating success or failure.
- Parameters
batch_idx: Returns results for this entry of the batch.buf: Returns pointer to ‘adv_byte_size’ bytes of data.adv_byte_size: The number of bytes of data to get a reference to.
-
template <typename T>
ErrorGetRawAtCursor(size_t batch_idx, T *out) Read a value for a specific batch entry at the current “cursor” from the result tensor as the specified type T and advance the cursor.
Use ResetCursor() to reset the cursor to the beginning of the result. Returns error if this result is not RAW format.
- Return
- Error object indicating success or failure.
- Parameters
batch_idx: Returns results for this entry of the batch.out: Returns the value at the cursor.
-
virtual Error
GetClassCount(size_t batch_idx, size_t *cnt) const = 0 Get the number of class results for a batch.
Returns error if this result is not CLASS format.
- Return
- Error object indicating success or failure.
- Parameters
batch_idx: The index in the batch.cnt: Returns the number of ClassResult entries for the batch entry.
-
virtual Error
GetClassAtCursor(size_t batch_idx, ClassResult *result) = 0 Get the ClassResult result for a specific batch entry at the current cursor.
Use ResetCursor() to reset the cursor to the beginning of the result. Returns error if this result is not CLASS format.
- Return
- Error object indicating success or failure.
- Parameters
batch_idx: The index in the batch.result: Returns the ClassResult value for the batch at the cursor.
-
virtual Error
ResetCursors() = 0 Reset cursor to beginning of result for all batch entries.
- Return
- Error object indicating success or failure.
-
virtual Error
ResetCursor(size_t batch_idx) = 0 Reset cursor to beginning of result for specified batch entry.
- Return
- Error object indicating success or failure.
- Parameters
batch_idx: The index in the batch.
-
template <>
ErrorGetRawAtCursor(size_t batch_idx, std::string *out)
-
struct
ClassResult The result value for CLASS format results.
Public Members
-
size_t
idx The index of the class in the result vector.
-
float
value The value of the class.
-
std::string
label The label for the class, if provided by the model.
-
size_t
-
virtual