ArmNN
 21.02
IRuntime Class Reference

#include <IRuntime.hpp>

Classes

struct  CreationOptions
 

Public Member Functions

Status LoadNetwork (NetworkId &networkIdOut, IOptimizedNetworkPtr network)
 Loads a complete network into the IRuntime. More...
 
Status LoadNetwork (NetworkId &networkIdOut, IOptimizedNetworkPtr network, std::string &errorMessage)
 Load a complete network into the IRuntime. More...
 
Status LoadNetwork (NetworkId &networkIdOut, IOptimizedNetworkPtr network, std::string &errorMessage, const INetworkProperties &networkProperties)
 
TensorInfo GetInputTensorInfo (NetworkId networkId, LayerBindingId layerId) const
 
TensorInfo GetOutputTensorInfo (NetworkId networkId, LayerBindingId layerId) const
 
Status EnqueueWorkload (NetworkId networkId, const InputTensors &inputTensors, const OutputTensors &outputTensors)
 Evaluates a network using input in inputTensors and outputs filled into outputTensors. More...
 
Status UnloadNetwork (NetworkId networkId)
 Unloads a network from the IRuntime. More...
 
const IDeviceSpecGetDeviceSpec () const
 
const std::shared_ptr< IProfilerGetProfiler (NetworkId networkId) const
 Gets the profiler corresponding to the given network id. More...
 
void RegisterDebugCallback (NetworkId networkId, const DebugCallbackFunction &func)
 Registers a callback function to debug layers performing custom computations on intermediate tensors. More...
 

Static Public Member Functions

static IRuntimeCreateRaw (const CreationOptions &options)
 
static IRuntimePtr Create (const CreationOptions &options)
 
static void Destroy (IRuntime *runtime)
 

Protected Member Functions

 IRuntime ()
 
 IRuntime (const IRuntime::CreationOptions &options)
 
 ~IRuntime ()
 

Protected Attributes

std::unique_ptr< RuntimeImplpRuntimeImpl
 

Detailed Description

Definition at line 40 of file IRuntime.hpp.

Constructor & Destructor Documentation

◆ IRuntime() [1/2]

IRuntime ( )
protected

Definition at line 26 of file Runtime.cpp.

Referenced by IRuntime::CreateRaw().

◆ IRuntime() [2/2]

IRuntime ( const IRuntime::CreationOptions options)
protected

Definition at line 28 of file Runtime.cpp.

References IRuntime::~IRuntime().

28 : pRuntimeImpl(new RuntimeImpl(options)) {}
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

◆ ~IRuntime()

~IRuntime ( )
protecteddefault

Referenced by IRuntime::IRuntime().

Member Function Documentation

◆ Create()

IRuntimePtr Create ( const CreationOptions options)
static

Definition at line 37 of file Runtime.cpp.

References IRuntime::CreateRaw(), and IRuntime::Destroy().

Referenced by BOOST_AUTO_TEST_CASE(), GetSoftmaxProfilerJson(), InferenceModel< IParser, TDataType >::InferenceModel(), main(), and NetworkQuantizer::Refine().

38 {
39  return IRuntimePtr(CreateRaw(options), &IRuntime::Destroy);
40 }
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:26
static void Destroy(IRuntime *runtime)
Definition: Runtime.cpp:42
static IRuntime * CreateRaw(const CreationOptions &options)
Definition: Runtime.cpp:32

◆ CreateRaw()

IRuntime * CreateRaw ( const CreationOptions options)
static

Definition at line 32 of file Runtime.cpp.

References IRuntime::IRuntime().

Referenced by IRuntime::Create().

33 {
34  return new IRuntime(options);
35 }

◆ Destroy()

void Destroy ( IRuntime runtime)
static

Definition at line 42 of file Runtime.cpp.

Referenced by IRuntime::Create().

43 {
44  delete runtime;
45 }

◆ EnqueueWorkload()

Status EnqueueWorkload ( NetworkId  networkId,
const InputTensors inputTensors,
const OutputTensors outputTensors 
)

Evaluates a network using input in inputTensors and outputs filled into outputTensors.

Definition at line 77 of file Runtime.cpp.

References IRuntime::pRuntimeImpl.

80 {
81  return pRuntimeImpl->EnqueueWorkload(networkId, inputTensors, outputTensors);
82 }
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

◆ GetDeviceSpec()

const IDeviceSpec & GetDeviceSpec ( ) const

Definition at line 89 of file Runtime.cpp.

References IRuntime::pRuntimeImpl.

90 {
91  return pRuntimeImpl->GetDeviceSpec();
92 }
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

◆ GetInputTensorInfo()

TensorInfo GetInputTensorInfo ( NetworkId  networkId,
LayerBindingId  layerId 
) const

Definition at line 67 of file Runtime.cpp.

References IRuntime::pRuntimeImpl.

68 {
69  return pRuntimeImpl->GetInputTensorInfo(networkId, layerId);
70 }
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

◆ GetOutputTensorInfo()

TensorInfo GetOutputTensorInfo ( NetworkId  networkId,
LayerBindingId  layerId 
) const

Definition at line 72 of file Runtime.cpp.

References IRuntime::pRuntimeImpl.

73 {
74  return pRuntimeImpl->GetOutputTensorInfo(networkId, layerId);
75 }
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

◆ GetProfiler()

const std::shared_ptr< IProfiler > GetProfiler ( NetworkId  networkId) const

Gets the profiler corresponding to the given network id.

Parameters
networkIdThe id of the network for which to get the profile.
Returns
A pointer to the requested profiler, or nullptr if not found.

Definition at line 94 of file Runtime.cpp.

References IRuntime::pRuntimeImpl.

95 {
96  return pRuntimeImpl->GetProfiler(networkId);
97 }
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

◆ LoadNetwork() [1/3]

Status LoadNetwork ( NetworkId networkIdOut,
IOptimizedNetworkPtr  network 
)

Loads a complete network into the IRuntime.

Parameters
[out]networkIdOut- Unique identifier for the network is returned in this reference.
[in]network- Complete network to load into the IRuntime. The runtime takes ownership of the network once passed in.
Returns
armnn::Status

Definition at line 47 of file Runtime.cpp.

References IRuntime::pRuntimeImpl.

Referenced by RuntimeImpl::LoadNetwork().

48 {
49  return pRuntimeImpl->LoadNetwork(networkIdOut, std::move(network));
50 }
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

◆ LoadNetwork() [2/3]

Status LoadNetwork ( NetworkId networkIdOut,
IOptimizedNetworkPtr  network,
std::string &  errorMessage 
)

Load a complete network into the IRuntime.

Parameters
[out]networkIdOutUnique identifier for the network is returned in this reference.
[in]networkComplete network to load into the IRuntime.
[out]errorMessageError message if there were any errors. The runtime takes ownership of the network once passed in.
Returns
armnn::Status

Definition at line 52 of file Runtime.cpp.

References IRuntime::pRuntimeImpl.

55 {
56  return pRuntimeImpl->LoadNetwork(networkIdOut, std::move(network), errorMessage);
57 }
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

◆ LoadNetwork() [3/3]

Status LoadNetwork ( NetworkId networkIdOut,
IOptimizedNetworkPtr  network,
std::string &  errorMessage,
const INetworkProperties networkProperties 
)

Definition at line 59 of file Runtime.cpp.

References IRuntime::pRuntimeImpl.

63 {
64  return pRuntimeImpl->LoadNetwork(networkIdOut, std::move(network), errorMessage, networkProperties);
65 }
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

◆ RegisterDebugCallback()

void RegisterDebugCallback ( NetworkId  networkId,
const DebugCallbackFunction func 
)

Registers a callback function to debug layers performing custom computations on intermediate tensors.

Parameters
networkIdThe id of the network to register the callback.
funccallback function to pass to the debug layer.

Definition at line 99 of file Runtime.cpp.

References IRuntime::pRuntimeImpl.

100 {
101  return pRuntimeImpl->RegisterDebugCallback(networkId, func);
102 }
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

◆ UnloadNetwork()

Status UnloadNetwork ( NetworkId  networkId)

Unloads a network from the IRuntime.

At the moment this only removes the network from the m_Impl->m_Network. This might need more work in the future to be AndroidNN compliant.

Parameters
[in]networkId- Unique identifier for the network to be unloaded. Generated in LoadNetwork().
Returns
armnn::Status

Definition at line 84 of file Runtime.cpp.

References IRuntime::pRuntimeImpl.

85 {
86  return pRuntimeImpl->UnloadNetwork(networkId);
87 }
std::unique_ptr< RuntimeImpl > pRuntimeImpl
Definition: IRuntime.hpp:177

Member Data Documentation

◆ pRuntimeImpl


The documentation for this class was generated from the following files: