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

How to add more operator? #141

Open
auvilink opened this issue Feb 2, 2019 · 3 comments
Open

How to add more operator? #141

auvilink opened this issue Feb 2, 2019 · 3 comments

Comments

@auvilink
Copy link

auvilink commented Feb 2, 2019

Hi, guys, great job so far.

I tried to export TF trained model (simple audio recognition) to utensor, however, there are many operators in my pb file not supported by utensor, for example:
DecodeWav, AudioSpectrogram, Mfcc, Identity, Conv2D, BiasAdd...

Any chance I can add those operators to uTensor? If so, how?

Thanks.

@dboyliao
Copy link
Member

dboyliao commented Feb 3, 2019

Hi, @auvilink.
It involves two things:

  1. the uTensor runtime kernel
  2. code generator support

For 1, let's take Relu as example.
You can take a look over here.
A Relu consist of two parts, the kernel and an Op using that kernel.
The template function,Relu, is the kernel and ReluOp is the operator.
The op interface is defined over here.
So you can extend the kernel following this approach.

After the C++ kernel is done, you also need to add it to the code generator.
I recommend you to work with develop branch of utensor_cgen.
You can find it here.
To be specific, you need to take a look of its backend.
Basically, you need to add template for the snippet objects (you can find it in backend/snippet submodule) and the operator object (defined in backend/operators.py).
I'm sorry that this part is kinda messy for now.
Let me know if you have any issue about the code generator part.

Of course, if you want to write C++ by hands, 2 is not optional.

@dboyliao
Copy link
Member

dboyliao commented Feb 3, 2019

Or you can make a PR to uTensor for the c++ kernel, and then my teammate and I will add them to the code generator.
Maybe that'd be faster.

@auvilink
Copy link
Author

auvilink commented Feb 3, 2019

@dboyliao
Thanks for the explanation.

I'll try to figure it out.

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

2 participants