Class ov::preprocess::PrePostProcessor

class PrePostProcessor

Main class for adding pre- and post- processing steps to existing ov::Model.

This is a helper class for writing easy pre- and post- processing operations on ov::Model object assuming that any preprocess operation takes one input and produces one output.

For advanced preprocessing scenarios, like combining several functions with multiple inputs/outputs into one, client’s code can use transformation passes over ov::Model

Public Functions

explicit PrePostProcessor(const std::shared_ptr<Model> &function)

Default constructor.

Parameters

function – Existing function representing loaded model

PrePostProcessor(PrePostProcessor&&) noexcept

Default move constructor.

PrePostProcessor &operator=(PrePostProcessor&&) noexcept

Default move assignment operator.

~PrePostProcessor()

Default destructor.

InputInfo &input()

Gets input pre-processing data structure. Should be used only if model/function has only one input Using returned structure application’s code is able to set user’s tensor data (e.g layout), preprocess steps, target model’s data.

Returns

Reference to model’s input information structure

InputInfo &input(const std::string &tensor_name)

Gets input pre-processing data structure for input identified by it’s tensor name.

Parameters

tensor_nameTensor name of specific input. Throws if tensor name is not associated with any input in a model

Returns

Reference to model’s input information structure

InputInfo &input(size_t input_index)

Gets input pre-processing data structure for input identified by it’s order in a model.

Parameters

input_indexInput index of specific input. Throws if input index is out of range for associated function

Returns

Reference to model’s input information structure

OutputInfo &output()

Gets output post-processing data structure. Should be used only if model/function has only one output Using returned structure application’s code is able to set model’s output data, post-process steps, user’s tensor data (e.g layout)

Returns

Reference to model’s output information structure

OutputInfo &output(const std::string &tensor_name)

Gets output post-processing data structure for output identified by it’s tensor name.

Parameters

tensor_nameTensor name of specific output. Throws if tensor name is not associated with any input in a model

Returns

Reference to model’s output information structure

OutputInfo &output(size_t output_index)

Gets output post-processing data structure for output identified by it’s order in a model.

Parameters

output_indexOutput index of specific output. Throws if output index is out of range for associated function

Returns

Reference to model’s output information structure

std::shared_ptr<Model> build()

Adds pre/post-processing operations to function passed in constructor.

Returns

Function with added pre/post-processing operations