This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to pass IRuntimePtr to another function?

In my ARMNN network initialization routine I am creating an ARMNN runtime like this:

    armnn::IRuntimePtr runtime = armnn::IRuntime::Create(armnn::IRuntime::CreationOptions());

    armnn::IOptimizedNetworkPtr optNet = Optimize(*network, backends, runtime->GetDeviceSpec(), armnn::OptimizerOptions());

    runtime->LoadNetwork(networkId, std::move(optNet), errorMessage);

I need to run the network in another C++ function.  How can I pass the runtime pointer to that other function?  Or, is there a way for the other function to retrieve the pointer to the runtime?

Parents
  • Hi Ben,

    Thanks for your reply.

    std::move(runtime) would work if I wanted to call the network execution function directly from the network initialization routine.  But what I would like to do is to have the initialization routine *save* the pointer to the runitme, and then having the execution function use that pointer to run the network.  I can't use a static variable to save the pointer to the runtime in the initialization routine.  And I can't seem to find a way to retrieve the pointer to the already created runtime.  That is what I am struggling with...

    Any idea how to do it?

Reply
  • Hi Ben,

    Thanks for your reply.

    std::move(runtime) would work if I wanted to call the network execution function directly from the network initialization routine.  But what I would like to do is to have the initialization routine *save* the pointer to the runitme, and then having the execution function use that pointer to run the network.  I can't use a static variable to save the pointer to the runtime in the initialization routine.  And I can't seem to find a way to retrieve the pointer to the already created runtime.  That is what I am struggling with...

    Any idea how to do it?

Children