Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error std::bad_alloc while creating IRuntime instance #48

Open
ankitgajera8368 opened this issue Nov 9, 2020 · 0 comments
Open

Error std::bad_alloc while creating IRuntime instance #48

ankitgajera8368 opened this issue Nov 9, 2020 · 0 comments

Comments

@ankitgajera8368
Copy link

I have successfully compiled the binary 'tensorflow_inference' on board but getting error while executing it. According to the logs, it seems that error is related to creating armnn's iruntime instance:

Suspicious Code:

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

Code:

for (int testImageIndex = 0; testImageIndex < nTests; testImageIndex++)
    {
        std::cout << "Reached here .. 1" << std::endl;
        auto start = std::chrono::system_clock::now();
        std::unique_ptr<MnistImage> input = loadMnistImage(dataDir, testImageIndex);
        std::cout << "Reached here .. 2" << std::endl;
        if (input == nullptr)
        {
            return EXIT_FAILURE;
        }

        /* Import the TensorFlow model */
        armnnTfParser::ITfParserPtr
            parser = armnnTfParser::ITfParser::Create();
        std::cout << "Reached here .. 3" << std::endl;
        armnn::INetworkPtr
            network = parser->CreateNetworkFromTextFile(TENSOR_MODEL,
                                                        {{"Placeholder", {1, 784, 1, 1}}}, {"Softmax"});
        std::cout << "Reached here .. 4" << std::endl;
        /* Find the binding points for the input and output nodes */
        armnnTfParser::BindingPointInfo
            inputBindingInfo = parser->GetNetworkInputBindingInfo("Placeholder");
        std::cout << "Reached here .. 5" << std::endl;
        armnnTfParser::BindingPointInfo
            outputBindingInfo = parser->GetNetworkOutputBindingInfo("Softmax");
        std::cout << "Reached here .. 6" << std::endl;
        armnn::IRuntime::CreationOptions options;
        std::cout << "Reached here .. 7" << std::endl;
        armnn::IRuntimePtr runtime = armnn::IRuntime::Create(options);
        std::cout << "Reached here .. 8" << std::endl;
        armnn::IOptimizedNetworkPtr optNet = armnn::Optimize(*network,
                                                             {armnn::Compute::CpuRef}, runtime->GetDeviceSpec());
        std::cout << "Reached here .. 9" << std::endl;
        /* Load the optimized network onto the runtime device */
        armnn::NetworkId networkIdentifier;
        runtime->LoadNetwork(networkIdentifier, std::move(optNet));
        std::cout << "Reached here .. 10" << std::endl;

Output Logs :-
Reached here .. 1
Reached here .. 2
Reached here .. 3
Reached here .. 4
Reached here .. 5
Reached here .. 6
Reached here .. 7
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted

It would be a great help if anyone can point out any mistake or I am missing something or not.
Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant