37 class INFERENCE_ENGINE_API_CLASS(Parameter) {
50 std::swap(ptr, parameter.ptr);
59 Parameter(
const std::shared_ptr<ngraph::Variant>& var);
67 Parameter(std::shared_ptr<ngraph::Variant>& var);
110 if (
this == ¶meter) {
114 if (!parameter.
empty()) ptr = parameter.ptr->copy();
131 return nullptr == ptr;
141 return empty() ?
false : ptr->is(
typeid(T));
149 template <
typename T>
151 return std::move(dyn_cast<T>(ptr));
161 return dyn_cast<T>(ptr);
169 const T&
as() const& {
170 return dyn_cast<T>(ptr);
199 operator const T&()
const& {
208 std::shared_ptr<ngraph::Variant> asVariant()
const;
215 operator std::shared_ptr<ngraph::Variant>()
const {
225 operator T&()
const& {
236 return *ptr == *(rhs.ptr);
245 return !(*
this == rhs);
249 template <
class T,
class EqualTo>
250 struct CheckOperatorEqual {
251 template <
class U,
class V>
252 static auto test(U*) -> decltype(std::declval<U>() == std::declval<V>()) {
256 template <
typename,
typename>
257 static auto test(...) -> std::false_type {
261 using type =
typename std::is_same<bool, decltype(test<T, EqualTo>(
nullptr))>
::type;
264 template <
class T,
class EqualTo = T>
265 struct HasOperatorEqual : CheckOperatorEqual<T, EqualTo>
::type {};
271 virtual ~Any() =
default;
273 virtual bool is(
const std::type_info&)
const = 0;
274 virtual Any* copy()
const = 0;
275 virtual bool operator==(
const Any& rhs)
const = 0;
279 struct RealData : Any, std::tuple<T> {
280 using std::tuple<T>::tuple;
282 bool is(
const std::type_info&
id)
const override {
283 return id ==
typeid(T);
285 Any* copy()
const override {
286 return new RealData {
get()};
290 return std::get<0>(*
static_cast<std::tuple<T>*
>(
this));
293 const T&
get()
const& {
294 return std::get<0>(*
static_cast<const std::tuple<T>*
>(
this));
298 typename std::enable_if<!HasOperatorEqual<U>::value,
bool>
::type equal(
const Any& left,
const Any& rhs)
const {
303 typename std::enable_if<HasOperatorEqual<U>::value,
bool>
::type equal(
const Any& left,
const Any& rhs)
const {
304 return dyn_cast<U>(&left) == dyn_cast<U>(&rhs);
307 bool operator==(
const Any& rhs)
const override {
308 return rhs.is(
typeid(T)) && equal<T>(*
this, rhs);
312 template <
typename T>
313 static T& dyn_cast(Any* obj) {
315 return dynamic_cast<RealData<T>&
>(*obj).get();
318 template <
typename T>
319 static const T& dyn_cast(
const Any* obj) {
321 return dynamic_cast<const RealData<T>&
>(*obj).get();
328 extern template struct INFERENCE_ENGINE_API_CLASS(InferenceEngine::Parameter::RealData<int>);
329 extern template struct INFERENCE_ENGINE_API_CLASS(InferenceEngine::Parameter::RealData<bool>);
330 extern template struct INFERENCE_ENGINE_API_CLASS(InferenceEngine::Parameter::RealData<float>);
331 extern template struct INFERENCE_ENGINE_API_CLASS(InferenceEngine::Parameter::RealData<uint32_t>);
332 extern template struct INFERENCE_ENGINE_API_CLASS(InferenceEngine::Parameter::RealData<std::string>);
333 extern template struct INFERENCE_ENGINE_API_CLASS(InferenceEngine::Parameter::RealData<unsigned long>);
334 extern template struct INFERENCE_ENGINE_API_CLASS(InferenceEngine::Parameter::RealData<std::vector<int>>);
335 extern template struct INFERENCE_ENGINE_API_CLASS(InferenceEngine::Parameter::RealData<std::vector<std::string>>);
336 extern template struct INFERENCE_ENGINE_API_CLASS(InferenceEngine::Parameter::RealData<std::vector<unsigned long>>);
337 extern template struct INFERENCE_ENGINE_API_CLASS(
338 InferenceEngine::Parameter::RealData<std::tuple<unsigned int, unsigned int>>);
339 extern template struct INFERENCE_ENGINE_API_CLASS(
340 InferenceEngine::Parameter::RealData<std::tuple<unsigned int, unsigned int, unsigned int>>);
#define THROW_IE_EXCEPTION
A macro used to throw the exception with a notable description.
Definition: ie_exception.hpp:25
Parameter(T &¶meter)
Constructor creates parameter with object.
Definition: ie_parameter.hpp:87
bool is() const
Definition: ie_parameter.hpp:140
Inference Engine API.
Definition: ie_argmax_layer.hpp:15
Parameter(Parameter &¶meter) noexcept
Move constructor.
Definition: ie_parameter.hpp:49
T & as() &
Definition: ie_parameter.hpp:160
Parameter(const Parameter ¶meter)
Copy constructor.
Definition: ie_parameter.hpp:74
bool operator==(const Parameter &rhs) const
The comparison operator for the Parameter.
Definition: ie_parameter.hpp:235
void clear()
Definition: ie_parameter.hpp:121
bool empty() const noexcept
Definition: ie_parameter.hpp:130
Definition: ie_cnn_network.h:27
Parameter & operator=(const Parameter ¶meter)
Definition: ie_parameter.hpp:109
const T & as() const &
Definition: ie_parameter.hpp:169
Parameter(const char *str)
Constructor creates string parameter from char *.
Definition: ie_parameter.hpp:97
T && as() &&
Definition: ie_parameter.hpp:150
The macro defines a symbol import/export mechanism essential for Microsoft Windows(R) OS...
bool operator!=(const Parameter &rhs) const
The comparison operator for the Parameter.
Definition: ie_parameter.hpp:244
This class represents an object to work with different parameters.
Definition: ie_parameter.hpp:37
std::string type
Layer type.
Definition: ie_layers.h:47
A header file for the main Inference Engine exception.