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,

    The ArmNN team are very responsive to issues on their github: https://github.com/ARM-software/armnn/issues so questions for ArmNN are usually best there as first port of call for fastest response from those who know it best.

    On the github site is also the documentation for ArmNN: https://github.com/ARM-software/armnn/wiki/Documentation where you can get more on all the classes for the different releases.  Presuming you're looking at latest, 21.05, I looked up IRuntime and IRuntimePtr is just a std::unique_ptr of IRuntime, so it'll need to be passed into functions in the same way as unique_ptrs require. Unique pointers being unique, there can only be one of them and they can't be passed by value. The "good" way to do that is with a std::move(ptr) when calling the function (as you've got for optNet there in LoadNetwork()). The "bad" way is to pass it as a reference.

    Unless you've already tried that and I'm missing something?

    Cheers,

    Ben

Reply
  • Hi,

    The ArmNN team are very responsive to issues on their github: https://github.com/ARM-software/armnn/issues so questions for ArmNN are usually best there as first port of call for fastest response from those who know it best.

    On the github site is also the documentation for ArmNN: https://github.com/ARM-software/armnn/wiki/Documentation where you can get more on all the classes for the different releases.  Presuming you're looking at latest, 21.05, I looked up IRuntime and IRuntimePtr is just a std::unique_ptr of IRuntime, so it'll need to be passed into functions in the same way as unique_ptrs require. Unique pointers being unique, there can only be one of them and they can't be passed by value. The "good" way to do that is with a std::move(ptr) when calling the function (as you've got for optNet there in LoadNetwork()). The "bad" way is to pass it as a reference.

    Unless you've already tried that and I'm missing something?

    Cheers,

    Ben

Children