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

Building of tensorflow android libs #3

Open
TianweiXing opened this issue Jun 6, 2016 · 6 comments
Open

Building of tensorflow android libs #3

TianweiXing opened this issue Jun 6, 2016 · 6 comments

Comments

@TianweiXing
Copy link

Hi,
I 'm currently using "INV" op and encounter some error :
Error during inference: Invalid argument: No OpKernel was registered to support Op 'Inv' with these attrs [[Node: incept5b/in4_conv1x1_55/batch_norm/moments/moments_1/divisor = Inv[T=DT_FLOAT](incept5b/in4_conv1x1_55/batch_norm/moments/moments/Const)]]
I looked into tensorflow file, the "INV" register op should be in tensorflow/core/ops/math_ops.cc.

I think the tensorflow android libs don't include this op.
I'm interested in how you build these .a and .lo libs? Could you build a lib that support the INV?
Thanks

@miyosuda
Copy link
Owner

miyosuda commented Jun 6, 2016

First I've built original TensorFlow android demo with bazel, and after that I extracted .lo and .a files from "bazel-out" dir.
I've encountered similar error when I forgot to link "libandroid_tensorflow_kernels.lo"
Are you linking this .lo file?

@TianweiXing
Copy link
Author

@miyosuda Thanks for your response!
I think this "libandroid_tensorflow_kernels.lo" is included, because I didn't change the settings here:
https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/master/jni-build/jni/Android.mk#L28
Is this what you mean for "link the "libandroid_tensorflow_kernels.lo" "?
Thanks again!

@miyosuda
Copy link
Owner

miyosuda commented Jun 7, 2016

@TianweiXing

Is this what you mean for "link the "libandroid_tensorflow_kernels.lo" "?

Yes

"libandroid_tensorflow_kernels" is defined here.

https://github.com/tensorflow/tensorflow/blob/r0.8/tensorflow/core/kernels/BUILD#L1557

And it uses "android_core_ops" and "android_extended_ops" rules.
They seem to collect limited number of ops for android to keep the library small. For example,

https://github.com/tensorflow/tensorflow/blob/r0.8/tensorflow/core/kernels/BUILD#L1383-L1442

Could you take a look?

@TianweiXing
Copy link
Author

@miyosuda Thanks a lot!
I understand the structure now! And I solve the problem by adding the inverse op. It actually is included in tensorflow R0.9.

However, I met another error saying that:

06-06 15:26:10.871 16634-16634/jp.narr.tensorflowmnist E/native: tensorflow_jni.cc:262 Error during inference: Invalid argument: No OpKernel was registered to support Op 'Switch' with these attrs
                                                                      [[Node: incept5b/in4_conv1x1_55/batch_norm/cond/Switch = Switch[T=DT_BOOL](phase_train, phase_train)]]

But the switch op is in control_flow_ops.cc which is also included by android_extended_ops_group1....
So I really don't know how this error could happen...

By the way, do you know if there's any .io or .a file for tensorflow/core/framework/?

Thanks

@beniroquai
Copy link

Hey, this is an old one, but I'm trying to fulfill, what you've written above @miyosuda

I want to build the library for the TF 0.12 in the same way you've done that in your great app. I would really like to build the JNI-Files with NDK like you do in MNIST and also in this example. What exactly should I enter to build the DEMO app and what exactly do I need to extract from the build folder afterwards? I don't see any structure like you have in the jni-native folder (includes, *.lo files, etc.)

I'm a bit lost..Maybe you can help me and giving a quick hint? :) Thanks!

@beniroquai
Copy link

By the way..How do I find the files you put in the folder "include" ?

Is there any bazel rule which produces the entire output you've copied into /jni-build/jni? I'm a bit confused.

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

3 participants