class InferenceEngine::RemoteContext¶
Overview¶
This class represents an Inference Engine abstraction for remote (non-CPU) accelerator device-specific execution context. Such context represents a scope on the device within which executable networks and remote memory blobs can exist, function and exchange data. More…
#include <ie_remote_context.hpp>
class RemoteContext: public std::enable_shared_from_this< RemoteContext >
{
public:
// typedefs
typedef std::shared_ptr<RemoteContext> Ptr;
typedef std::shared_ptr<const RemoteContext> CPtr;
// methods
template <
typename T,
typename std::enable_if<!std::is_pointer<T>::value&&!std::is_reference<T>::value, int>::type = 0,
typename std::enable_if<std::is_base_of<RemoteContext, T>::value, int>::type = 0
>
bool is();
template <
typename T,
typename std::enable_if<!std::is_pointer<T>::value&&!std::is_reference<T>::value, int>::type = 0,
typename std::enable_if<std::is_base_of<RemoteContext, T>::value, int>::type = 0
>
bool is() const;
template <
typename T,
typename std::enable_if<!std::is_pointer<T>::value&&!std::is_reference<T>::value, int>::type = 0,
typename std::enable_if<std::is_base_of<RemoteContext, T>::value, int>::type = 0
>
T \* as();
template <
typename T,
typename std::enable_if<!std::is_pointer<T>::value&&!std::is_reference<T>::value, int>::type = 0,
typename std::enable_if<std::is_base_of<RemoteContext, T>::value, int>::type = 0
>
const T \* as() const;
virtual std::string getDeviceName() const = 0;
virtual RemoteBlob::Ptr CreateBlob(
const TensorDesc& tensorDesc,
const ParamMap& params = {}
) = 0;
virtual MemoryBlob::Ptr CreateHostBlob(const TensorDesc& tensorDesc);
virtual ParamMap getParams() const = 0;
};
// direct descendants
class ClContext;
Detailed Documentation¶
This class represents an Inference Engine abstraction for remote (non-CPU) accelerator device-specific execution context. Such context represents a scope on the device within which executable networks and remote memory blobs can exist, function and exchange data.
Typedefs¶
typedef std::shared_ptr<RemoteContext> Ptr
A smart pointer to the RemoteContext object.
typedef std::shared_ptr<const RemoteContext> CPtr
A smart pointer to the const RemoteContext object.
Methods¶
template <
typename T,
typename std::enable_if<!std::is_pointer<T>::value&&!std::is_reference<T>::value, int>::type = 0,
typename std::enable_if<std::is_base_of<RemoteContext, T>::value, int>::type = 0
>
bool is()
Checks if the RemoteContext object can be cast to the type T*.
Parameters:
T |
Type to be checked. Must represent a class derived from the RemoteContext |
Returns:
true if this object can be dynamically cast to the type T*. Otherwise, false
template <
typename T,
typename std::enable_if<!std::is_pointer<T>::value&&!std::is_reference<T>::value, int>::type = 0,
typename std::enable_if<std::is_base_of<RemoteContext, T>::value, int>::type = 0
>
bool is() const
Checks if the RemoteContext object can be cast to the type const T*.
Parameters:
T |
Type to be checked. Must represent a class derived from the RemoteContext |
Returns:
true if this object can be dynamically cast to the type const T*. Otherwise, false
template <
typename T,
typename std::enable_if<!std::is_pointer<T>::value&&!std::is_reference<T>::value, int>::type = 0,
typename std::enable_if<std::is_base_of<RemoteContext, T>::value, int>::type = 0
>
T \* as()
Casts this RemoteContext object to the type T*.
Parameters:
T |
Type to cast to. Must represent a class derived from the RemoteContext |
Returns:
Raw pointer to the object of the type T or nullptr on error
template <
typename T,
typename std::enable_if<!std::is_pointer<T>::value&&!std::is_reference<T>::value, int>::type = 0,
typename std::enable_if<std::is_base_of<RemoteContext, T>::value, int>::type = 0
>
const T \* as() const
Casts this RemoteContext object to the type const T*.
Parameters:
T |
Type to cast to. Must represent a class derived from the RemoteContext |
Returns:
Raw pointer to the object of the type const T or nullptr on error
virtual std::string getDeviceName() const = 0
Returns name of the device on which underlying object is allocated. Abstract method.
Returns:
A device name string in the same format as that in plugin metric.
virtual RemoteBlob::Ptr CreateBlob(
const TensorDesc& tensorDesc,
const ParamMap& params = {}
) = 0
Allocates memory blob in device memory or wraps user-supplied memory handle using the specified tensor description and low-level device-specific parameters. Returns a pointer to the object which implements RemoteBlob interface.
Parameters:
tensorDesc |
Defines the layout and dims of the blob |
params |
Map of the low-level blob object parameters. Abstract method. |
Returns:
A pointer to plugin object that implements RemoteBlob interface.
virtual MemoryBlob::Ptr CreateHostBlob(const TensorDesc& tensorDesc)
Allocates host accessible memory blob friendly for the device in current context Returns a pointer to the object which implements MemoryBlob interface.
Parameters:
tensorDesc |
Defines the layout and dims of the blob |
Returns:
A pointer to host accessible MemoryBlob object
virtual ParamMap getParams() const = 0
Returns a map of device-specific parameters required for low-level operations with underlying object. Parameters include device/context handles, access flags, etc. Contents of the map returned depend on remote execution context that is currently set on the device (working scenario). Abstract method.
Returns:
A map of name/parameter elements.