forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ie_metric_helpers.hpp
57 lines (46 loc) · 1.47 KB
/
ie_metric_helpers.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
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief Defines set of macro to safely set plugin and executable network metric values
* @file ie_metric_helpers.hpp
*/
#pragma once
#include <type_traits>
#include <utility>
/**
* @cond
*/
namespace InferenceEngine {
namespace Metrics {
template <typename T>
struct MetricType;
#define DECLARE_METRIC_KEY_IMPL(name, ...) \
struct name {}; \
template <> \
struct MetricType<name> { \
using type = __VA_ARGS__; \
}
} // namespace Metrics
} // namespace InferenceEngine
/**
* @endcond
*/
/**
* @def IE_SET_METRIC_RETURN(name, ...)
* @ingroup ie_dev_api
* @brief Return metric value with specified @p name and arguments `...`. Example:
* @code
* IE_SET_METRIC_RETURN(SUPPORTED_CONFIG_KEYS, configKeys);
* @endcode
*
* @param name The metric name
* @param ... A metric value
*
* @return A metric value wrapped with Parameter and returned to a calling function
*/
#define IE_SET_METRIC_RETURN(name, ...) \
typename ::InferenceEngine::Metrics::MetricType<::InferenceEngine::Metrics::name>::type _##name##_value = \
__VA_ARGS__; \
return _##name##_value
#include "ie_plugin_config.hpp"