Skip to content

Instantly share code, notes, and snippets.

@alokprasad
Created July 19, 2019 08:18
Show Gist options
  • Save alokprasad/716b6f68d9ddddce4ba10bcc25859f4f to your computer and use it in GitHub Desktop.
Save alokprasad/716b6f68d9ddddce4ba10bcc25859f4f to your computer and use it in GitHub Desktop.
tensorflow-misc related notes
Optimization For Android Platform
=================================
best way is to add only the code that you use in the actual model.
1.python tensorflow/python/tools/print_selective_registration_header.py --graphs="xxx.pb" > ops_to_register.h"
ops_to_register.h -> Recompile the code by inserting the generated header.
cp ops_to_register.h tensorflow/core/framework/
When you build a bazel --copts=-DSELECTIVE_REGISTRATION added
Threading
==========
The desktop version of TensorFlow has a threading model.
This means that several operations can be performed in parallel.
Two types of parallelism are supported.
>inter-op
>intra-op
Quantization
=============
quantize_wieghts
Useful graph conversion tools
==============================
strip_unused_nodes
What Ops are available in the mobile environment?
=================================================
1.the first thing to do strip_unused_nodesis to do this .
If the ops with the errors go to the strip, it is a problem to solve!
Implementation Location
An operation is divided into two parts in implementation.
You can think of it as a signature for the op definition : operator. Because it is small in size, it is included in the library.
op implementation : The actual implementation code. It is mostly tensorflow/core/kernelsimplemented in subdirectories.
If you compile C ++, you can control what operations are actually needed.
For example Mul, the operation is actually tensorflow/core/kernels/cwise_op_mul_1.ccdescribed in.
If you want to search the code, try the following.
$ grep 'REGISTER.*"Mul"' tensorflow/core/kernels/*.cc
Add the necessary operators at build time.
If you are using Bazel, you can write the necessary files in the appropriate build file.
If you tensorflow/contrib/makefile/tf_op_files.txtare writing a makefile, you can add it and build it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment