Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Model with MatMul IR operator leads to std::terminate() on K210

See original GitHub issue

I’m experimenting with getting the ONNX model (trained to classify MNIST digits) to work on K210 with all the nice recent updates in nncase and found that all the ops imported seems to work fine during the inference the resulting kmodel on K210 device, except when it contains Gemm ONNX operator, which is imported to MatMul operator of nncase IR language and some more operators after all the transformations. Maybe, I miss something, so decided to report this, maybe you would notice the problem.

To Reproduce

  1. …/install/bin/ncc compile mnist_cnn.onnx mnist_cnn_k210.kmodel -i onnx --dataset …/…/mnist-sample/ -t k210 --dump-ir --dump-dir testdump
  2. Add the resulting kmodel to the demo program.

Expected behavior Debugging timing output on the UART console.

Origin model and code The models are uploaded to the demo program, named mnist_cnn_k210.kmodel and mnist_cnn.onnx for Kmodel and ONNX formats, respectively.

Environment (please complete the following information):

  • OS: Gentoo, x86_64
  • nncase version 1.0.0-91413fc-dirty
  • DL Framework Pytorch-1.8.1

Additional context Here’s also a snippet on PyTorch to produce the ONNX model like this:

import sys

import torch
from torch import nn

from torchinfo import summary

class Net3(nn.Sequential):
	def __init__(self):
			nn.Linear(784, 64),

def main():
	model = Net3()

	dummy_input = torch.randn(1, 1, 28, 28).to(dtype=torch.float32)

	summary(model, input_size=(1, 1, 28, 28))


if __name__ == "__main__":
	except KeyboardInterrupt:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

zhen8838commented, Jul 18, 2021

@aclex Hi, I update the nncase runtime lib in SDK(PR125). Now you can try your model(need recompile with latest nncase).

aclexcommented, Jul 18, 2021

Thank you very much for the fix, it indeed works just fine now with recent updates! Can confirm it working on K210 as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found