class ov::IPlugin

Overview

OpenVINO Plugin Interface 2.0. More…

#include <iplugin.hpp>

class IPlugin: public std::enable_shared_from_this< IPlugin >
{
public:
    // methods

    void set_version(const Version& version);
    const Version& get_version() const;

    virtual std::shared_ptr<ov::ICompiledModel> compile_model(
        const std::shared_ptr<const ov::Model>& model,
        const ov::AnyMap& properties
        ) const = 0;

    virtual std::shared_ptr<ov::ICompiledModel> compile_model(
        const std::string& model_path,
        const ov::AnyMap& properties
        ) const;

    virtual std::shared_ptr<ov::ICompiledModel> compile_model(
        const std::shared_ptr<const ov::Model>& model,
        const ov::AnyMap& properties,
        const ov::RemoteContext& context
        ) const = 0;

    virtual void set_property(const ov::AnyMap& properties) = 0;

    virtual ov::Any get_property(
        const std::string& name,
        const ov::AnyMap& arguments
        ) const = 0;

    virtual std::shared_ptr<ov::IRemoteContext> create_context(const ov::AnyMap& remote_properties) const = 0;
    virtual std::shared_ptr<ov::IRemoteContext> get_default_context(const ov::AnyMap& remote_properties) const = 0;

    virtual std::shared_ptr<ov::ICompiledModel> import_model(
        std::istream& model,
        const ov::AnyMap& properties
        ) const = 0;

    virtual std::shared_ptr<ov::ICompiledModel> import_model(
        std::istream& model,
        const ov::RemoteContext& context,
        const ov::AnyMap& properties
        ) const = 0;

    virtual ov::SupportedOpsMap query_model(
        const std::shared_ptr<const ov::Model>& model,
        const ov::AnyMap& properties
        ) const = 0;

    virtual void add_extension(const std::shared_ptr<InferenceEngine::IExtension>& extension);
    void set_core(const std::weak_ptr<ov::ICore>& core);
    std::shared_ptr<ov::ICore> get_core() const;
    bool is_new_api() const;
    const std::shared_ptr<ov::threading::ExecutorManager>& get_executor_manager() const;
};

Detailed Documentation

OpenVINO Plugin Interface 2.0.

Methods

void set_version(const Version& version)

Sets a plugin version.

Parameters:

version

A version to set

const Version& get_version() const

Returns a plugin version.

Returns:

A constant ov::Version object

virtual std::shared_ptr<ov::ICompiledModel> compile_model(
    const std::shared_ptr<const ov::Model>& model,
    const ov::AnyMap& properties
    ) const = 0

Compiles model from ov::Model object.

Parameters:

model

A model object acquired from ov::Core::read_model or source construction

properties

A ov::AnyMap of properties relevant only for this load operation

Returns:

Created Compiled Model object

virtual std::shared_ptr<ov::ICompiledModel> compile_model(
    const std::string& model_path,
    const ov::AnyMap& properties
    ) const

Compiles model from ov::Model object.

Parameters:

model_path

A path to model (path can be converted from unicode representation)

properties

A ov::AnyMap of properties relevant only for this load operation

Returns:

Created Compiled Model object

virtual std::shared_ptr<ov::ICompiledModel> compile_model(
    const std::shared_ptr<const ov::Model>& model,
    const ov::AnyMap& properties,
    const ov::RemoteContext& context
    ) const = 0

Compiles model from ov::Model object, on specified remote context.

Parameters:

model

A model object acquired from ov::Core::read_model or source construction

properties

A ov::AnyMap of properties relevant only for this load operation

context

A pointer to plugin context derived from RemoteContext class used to execute the model

Returns:

Created Compiled Model object

virtual void set_property(const ov::AnyMap& properties) = 0

Sets properties for plugin, acceptable keys can be found in openvino/runtime/properties.hpp.

Parameters:

properties

ov::AnyMap of properties

virtual ov::Any get_property(
    const std::string& name,
    const ov::AnyMap& arguments
    ) const = 0

Gets properties related to plugin behaviour.

Parameters:

name

Property name.

arguments

Additional arguments to get a property.

Returns:

Value of a property corresponding to the property name.

virtual std::shared_ptr<ov::IRemoteContext> create_context(const ov::AnyMap& remote_properties) const = 0

Creates a remote context instance based on a map of properties.

Parameters:

remote_properties

Map of device-specific shared context remote properties.

Returns:

A remote context object

virtual std::shared_ptr<ov::IRemoteContext> get_default_context(const ov::AnyMap& remote_properties) const = 0

Provides a default remote context instance if supported by a plugin.

Parameters:

remote_properties

Map of device-specific shared context remote properties.

Returns:

The default context.

virtual std::shared_ptr<ov::ICompiledModel> import_model(
    std::istream& model,
    const ov::AnyMap& properties
    ) const = 0

Creates an compiled model from an previously exported model using plugin implementation and removes OpenVINO Runtime magic and plugin name.

Parameters:

model

Reference to model output stream

properties

A ov::AnyMap of properties

Returns:

An Compiled model

virtual std::shared_ptr<ov::ICompiledModel> import_model(
    std::istream& model,
    const ov::RemoteContext& context,
    const ov::AnyMap& properties
    ) const = 0

Creates an compiled model from an previously exported model using plugin implementation and removes OpenVINO Runtime magic and plugin name.

Parameters:

model

Reference to model output stream

context

A pointer to plugin context derived from RemoteContext class used to execute the network

properties

A ov::AnyMap of properties

Returns:

An Compiled model

virtual ov::SupportedOpsMap query_model(
    const std::shared_ptr<const ov::Model>& model,
    const ov::AnyMap& properties
    ) const = 0

Queries a plugin about supported layers in model.

Parameters:

model

Model object to query.

properties

Optional map of pairs: (property name, property value).

Returns:

An object containing a map of pairs an operation name -> a device name supporting this operation.

virtual void add_extension(const std::shared_ptr<InferenceEngine::IExtension>& extension)

Registers legacy extension within plugin.

Deprecated This method allows to load legacy Inference Engine Extensions and will be removed in 2024.0 release

Parameters:

extension

  • pointer to already loaded legacy extension

void set_core(const std::weak_ptr<ov::ICore>& core)

Sets pointer to ICore interface.

Parameters:

core

Pointer to Core interface

std::shared_ptr<ov::ICore> get_core() const

Gets reference to ICore interface.

Returns:

Reference to ICore interface

bool is_new_api() const

Provides an information about used API.

Returns:

true if new API is used

const std::shared_ptr<ov::threading::ExecutorManager>& get_executor_manager() const

Gets reference to tasks execution manager.

Returns:

Reference to ExecutorManager interface