class ov::preprocess::PrePostProcessor

Overview

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

#include <pre_post_process.hpp>

class PrePostProcessor
{
public:
    // construction

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

    // methods

    PrePostProcessor& operator = (PrePostProcessor&&);
    InputInfo& input();
    InputInfo& input(const std::string& tensor_name);
    InputInfo& input(size_t input_index);
    OutputInfo& output();
    OutputInfo& output(const std::string& tensor_name);
    OutputInfo& output(size_t output_index);
    std::shared_ptr<Model> build();
};

Detailed Documentation

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

Construction

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

Default constructor.

Parameters:

function

Existing function representing loaded model

PrePostProcessor(PrePostProcessor&&)

Default move constructor.

Methods

PrePostProcessor& operator = (PrePostProcessor&&)

Default move assignment operator.

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_name

Tensor 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_index

Input 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_name

Tensor 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_index

Output 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