forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.hpp
63 lines (43 loc) · 2.12 KB
/
plugin.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "cpp_interfaces/interface/ie_iplugin_internal.hpp"
#include "description_buffer.hpp"
#include "ie_icore.hpp"
namespace HeteroPlugin {
using Configs = std::map<std::string, std::string>;
template <typename T>
struct ParsedConfig {
Configs hetero_config;
T device_config;
};
class Engine : public InferenceEngine::IInferencePlugin {
public:
using DeviceMetaInformationMap = std::unordered_map<std::string, Configs>;
Engine();
InferenceEngine::IExecutableNetworkInternal::Ptr LoadExeNetworkImpl(const InferenceEngine::CNNNetwork& network,
const Configs& config) override;
void SetConfig(const Configs& config) override;
InferenceEngine::QueryNetworkResult QueryNetwork(const InferenceEngine::CNNNetwork& network,
const Configs& config) const override;
InferenceEngine::Parameter GetMetric(const std::string& name, const ov::AnyMap& options) const override;
InferenceEngine::Parameter GetConfig(const std::string& name, const ov::AnyMap& options) const override;
InferenceEngine::IExecutableNetworkInternal::Ptr ImportNetwork(std::istream& heteroModel,
const Configs& config) override;
DeviceMetaInformationMap GetDevicePlugins(const std::string& targetFallback, const Configs& localConfig) const;
std::string GetTargetFallback(const Configs& config, bool raise_exception = true) const;
std::string GetTargetFallback(const ov::AnyMap& config, bool raise_exception = true) const;
ParsedConfig<Configs> MergeConfigs(const Configs& user_config) const;
ParsedConfig<ov::AnyMap> MergeConfigs(const ov::AnyMap& user_config) const;
private:
std::string DeviceCachingProperties(const std::string& targetFallback) const;
Configs _device_config;
};
} // namespace HeteroPlugin