TFLite: 代码组成结构

2024-06-03 15:08
文章标签 代码 结构 组成 tflite

本文主要是介绍TFLite: 代码组成结构,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

编译命令

bazel build --cxxopt=--std=c++11 //tensorflow/contrib/lite/java/demo/app/src/main:TfLiteCameraDemo
编译目标从WORKSPACE所在的路径开始到package路径(BUILD文件所在路径) : target(name)

编译输出结果

Target //tensorflow/contrib/lite/java/demo/app/src/main:TfLiteCameraDemo up-to-date:
  bazel-bin/tensorflow/contrib/lite/java/demo/app/src/main/TfLiteCameraDemo_deploy.jar
  bazel-bin/tensorflow/contrib/lite/java/demo/app/src/main/TfLiteCameraDemo_unsigned.apk
  bazel-bin/tensorflow/contrib/lite/java/demo/app/src/main/TfLiteCameraDemo.apk
INFO: Elapsed time: 108.586s, Critical Path: 31.76s
INFO: 305 processes: 279 local, 26 worker.
INFO: Build completed successfully, 351 total actions

编译输出结果
bazel-bin ->         /home/mi/.cache/bazel/_bazel_mi/xxx/execroot/org_tensorflow/bazel-out/k8-opt/bin
bazel-out ->         /home/mi/.cache/bazel/_bazel_mi/xxx/execroot/org_tensorflow/bazel-out
bazel-genfiles ->     /home/mi/.cache/bazel/_bazel_mi/xxx/execroot/org_tensorflow/bazel-out/k8-opt/genfiles
bazel-tensorflow ->     /home/mi/.cache/bazel/_bazel_mi/xxx/execroot/org_tensorflow
bazel-testlogs ->     /home/mi/.cache/bazel/_bazel_mi/xxx/execroot/org_tensorflow/bazel-out/k8-opt/testlogs

分析编译生成的文件,看代码结构

execroot/org_tensorflow/bazel-out/android-armeabi-v7a-opt/bin/tensorflow/contrib/lite

find ./ -name "*.o"

1. framework

./_objs/framework/stderr_reporter.o
./_objs/framework/interpreter.o
./_objs/framework/mutable_op_resolver.o
./_objs/framework/nnapi_delegate.o
./_objs/framework/optional_debug_tools.o
./_objs/framework/model.o
./_objs/framework/graph_info.o
./_objs/framework/mmap_allocation.o
./_objs/framework/allocation.o

2. buildin_op_kernels

./kernels/_objs/builtin_op_kernels/strided_slice.o
./kernels/_objs/builtin_op_kernels/lsh_projection.o
./kernels/_objs/builtin_op_kernels/arg_min_max.o
./kernels/_objs/builtin_op_kernels/gather.o
./kernels/_objs/builtin_op_kernels/unidirectional_sequence_rnn.o
./kernels/_objs/builtin_op_kernels/elementwise.o
./kernels/_objs/builtin_op_kernels/sub.o
./kernels/_objs/builtin_op_kernels/bidirectional_sequence_rnn.o
./kernels/_objs/builtin_op_kernels/resize_bilinear.o
./kernels/_objs/builtin_op_kernels/comparisons.o
./kernels/_objs/builtin_op_kernels/transpose_conv.o
./kernels/_objs/builtin_op_kernels/unidirectional_sequence_lstm.o
./kernels/_objs/builtin_op_kernels/cast.o
./kernels/_objs/builtin_op_kernels/layer_norm_lstm.o
./kernels/_objs/builtin_op_kernels/expand_dims.o
./kernels/_objs/builtin_op_kernels/audio_spectrogram.o
./kernels/_objs/builtin_op_kernels/space_to_depth.o
./kernels/_objs/builtin_op_kernels/space_to_batch_nd.o
./kernels/_objs/builtin_op_kernels/pad.o
./kernels/_objs/builtin_op_kernels/depthwise_conv.o
./kernels/_objs/builtin_op_kernels/div.o
./kernels/_objs/builtin_op_kernels/bidirectional_sequence_lstm.o
./kernels/_objs/builtin_op_kernels/concatenation.o
./kernels/_objs/builtin_op_kernels/exp.o
./kernels/_objs/builtin_op_kernels/add.o
./kernels/_objs/builtin_op_kernels/floor_div.o
./kernels/_objs/builtin_op_kernels/skip_gram.o
./kernels/_objs/builtin_op_kernels/dequantize.o
./kernels/_objs/builtin_op_kernels/l2norm.o
./kernels/_objs/builtin_op_kernels/local_response_norm.o
./kernels/_objs/builtin_op_kernels/select.o
./kernels/_objs/builtin_op_kernels/squeeze.o
./kernels/_objs/builtin_op_kernels/hashtable_lookup.o
./kernels/_objs/builtin_op_kernels/unpack.o
./kernels/_objs/builtin_op_kernels/shape.o
./kernels/_objs/builtin_op_kernels/slice.o
./kernels/_objs/builtin_op_kernels/logical.o
./kernels/_objs/builtin_op_kernels/one_hot.o
./kernels/_objs/builtin_op_kernels/conv.o
./kernels/_objs/builtin_op_kernels/fake_quant.o
./kernels/_objs/builtin_op_kernels/floor.o
./kernels/_objs/builtin_op_kernels/basic_rnn.o
./kernels/_objs/builtin_op_kernels/mfcc.o
./kernels/_objs/builtin_op_kernels/sparse_to_dense.o
./kernels/_objs/builtin_op_kernels/svdf.o
./kernels/_objs/builtin_op_kernels/detection_postprocess.o
./kernels/_objs/builtin_op_kernels/topk_v2.o
./kernels/_objs/builtin_op_kernels/maximum_minimum.o
./kernels/_objs/builtin_op_kernels/lstm.o
./kernels/_objs/builtin_op_kernels/nactivations.o
./kernels/_objs/builtin_op_kernels/transpose.o
./kernels/_objs/builtin_op_kernels/pow.o
./kernels/_objs/builtin_op_kernels/embedding_lookup.o
./kernels/_objs/builtin_op_kernels/embedding_lookup_sparse.o
./kernels/_objs/builtin_op_kernels/pack.o
./kernels/_objs/builtin_op_kernels/zeros_like.o
./kernels/_objs/builtin_op_kernels/reshape.o
./kernels/_objs/builtin_op_kernels/sparse_output_fully_connected.o
./kernels/_objs/builtin_op_kernels/relu1.o
./kernels/_objs/builtin_op_kernels/tile.o
./kernels/_objs/builtin_op_kernels/fully_connected.o
./kernels/_objs/builtin_op_kernels/batch_to_space_nd.o
./kernels/_objs/builtin_op_kernels/split.o
./kernels/_objs/builtin_op_kernels/reduce.o
./kernels/_objs/builtin_op_kernels/mul.o
./kernels/_objs/builtin_op_kernels/neg.o
./kernels/_objs/builtin_op_kernels/pooling.o

3. kernel/internal

./kernels/internal/_objs/kernel_utils/kernel_utils.o
./kernels/internal/_objs/quantization_util/quantization_util.o
./kernels/internal/_objs/audio_utils/mfcc_dct.o
./kernels/internal/_objs/audio_utils/mfcc_mel_filterbank.o
./kernels/internal/_objs/audio_utils/mfcc.o
./kernels/internal/_objs/audio_utils/spectrogram.o
./kernels/internal/_objs/tensor_utils/tensor_utils.o
./kernels/internal/_objs/neon_tensor_utils/portable_tensor_utils.o
./kernels/internal/_objs/neon_tensor_utils/neon_tensor_utils.o

4. kernel 其他

 kernel/gemm_support.cc
   kernel/kernel_util.cc
   kernel/lstm_eval.cc
   kernel/eigen_support.cc
   这几个怎么不是buildin_op_kernels??

5. lite下其他文件

./_objs/arena_planner/arena_planner.o

util.cc    直接在lite目录下
string_util.cc 直接在lite目录下

6. profiling/time, simple_memory_arena

./profiling/time.cc

./_objs/simple_memory_arena/simple_memory_arena.o

7 core/api


./core/api/_objs/api/error_reporter.o
./core/api/_objs/api/op_resolver.o
./core/api/_objs/api/flatbuffer_conversions.o

8. c/c_api_internal


./c/_objs/c_api_internal/c_api_internal.o

9. java_jni

./java/src/main/native/_objs/native/builtin_ops_jni.o
./java/src/main/native/_objs/native_framework_only/nativeinterpreterwrapper_jni.o
./java/src/main/native/_objs/native_framework_only/tensorflow_lite_jni.o
./java/src/main/native/_objs/native_framework_only/tensor_jni.o
./java/src/main/native/_objs/native_framework_only/exception_jni.o

10. external

androidndk  androidsdk  com_google_absl  farmhash_archive  fft2d  flatbuffers  org_checkerframework_qual

10.1 androidndk
./androidndk/_objs/cpufeatures/cpu-features.o
10.2 farmhash
./farmhash_archive/_objs/farmhash/farmhash.o
10.3 absl
./com_google_absl/absl/base/_objs/dynamic_annotations/dynamic_annotations.o
10.4 flatbuffer
./flatbuffers/_objs/flatbuffers/reflection.o
./flatbuffers/_objs/flatbuffers/code_generators.o
./flatbuffers/_objs/flatbuffers/idl_parser.o
./flatbuffers/_objs/flatbuffers/util.o
./flatbuffers/_objs/flatbuffers/idl_gen_general.o
./flatbuffers/_objs/flatbuffers/idl_gen_text.o
./flatbuffers/_objs/flatbuffers/idl_gen_fbs.o
10.5 fft2d
./fft2d/_objs/fft2d/fftsg.o

11.  zipinfo -l jar/ apk

➜  java zipinfo -l libtensorflowlite.jar
Archive:  libtensorflowlite.jar
Zip file size: 14443 bytes, number of entries: 12
-rw----     2.0 fat      752 bl      477 defN 10-Jan-01 00:00 org/tensorflow/lite/DataType$1.class
-rw----     2.0 fat     2676 bl     1382 defN 10-Jan-01 00:00 org/tensorflow/lite/DataType.class
-rw----     2.0 fat      983 bl      488 defN 10-Jan-01 00:00 org/tensorflow/lite/Interpreter$Options.class
-rw----     2.0 fat     5200 bl     2073 defN 10-Jan-01 00:00 org/tensorflow/lite/Interpreter.class
-rw----     2.0 fat     9352 bl     4250 defN 10-Jan-01 00:00 org/tensorflow/lite/NativeInterpreterWrapper.class
-rw----     2.0 fat     6431 bl     3174 defN 10-Jan-01 00:00 org/tensorflow/lite/Tensor.class
-rw----     2.0 fat     1308 bl      751 defN 10-Jan-01 00:00 org/tensorflow/lite/TensorFlowLite.class

zipinfo -l bazel-bin/tensorflow/contrib/lite/java/demo/app/src/main/TfLiteCameraDemo.apk
Archive:  bazel-bin/tensorflow/contrib/lite/java/demo/app/src/main/TfLiteCameraDemo.apk
Zip file size: 5537448 bytes, number of entries: 28
-rw----     2.0 fat  1228588 b-   579539 defN 80-Jan-01 00:00 lib/armeabi-v7a/libtensorflowlite_jni.so
-rw----     2.0 fat  1506380 bl   593277 defN 80-Jan-01 00:00 classes.dex
-rw-rw-rw-  2.3 unx     2336 b-      808 defX 80-Jan-01 00:00 AndroidManifest.xml
-rw-rw-rw-  2.3 unx      196 b-      143 defX 80-Jan-01 00:00 assets/BUILD
-rw-rw-rw-  2.3 unx      195 b-      142 defX 80-Jan-01 00:00 assets/BUILD.bazel
-rw-rw-rw-  2.3 unx      116 b-      116 stor 80-Jan-01 00:00 assets/WORKSPACE
-rw-rw-rw-  2.3 unx    10484 b-     5216 defX 80-Jan-01 00:00 assets/labels.txt
-rw-rw-rw-  2.3 unx    10479 b-     5216 defX 80-Jan-01 00:00 assets/labels_imagenet_slim.txt
-rw-rw-rw-  2.3 unx    10484 b-     5216 defX 80-Jan-01 00:00 assets/labels_mobilenet_quant_v1_224.txt
-rw-rw-rw-  2.3 unx  4276100 b-  4276100 stor 80-Jan-01 00:00 assets/mobilenet_quant_v1_224.tflite
-rw-rw-rw-  2.3 unx      583 b-      583 stor 80-Jan-01 00:00 res/drawable-hdpi-v4/ic_action_info.png
-rw-rw-rw-  2.3 unx     3845 b-     3845 stor 80-Jan-01 00:00 res/drawable-hdpi-v4/ic_launcher.png
-rw-rw-rw-  2.3 unx      234 b-      234 stor 80-Jan-01 00:00 res/drawable-hdpi-v4/tile.9.png
-rw-rw-rw-  2.3 unx      395 b-      395 stor 80-Jan-01 00:00 res/drawable-mdpi-v4/ic_action_info.png
-rw-rw-rw-  2.3 unx     2067 b-     2067 stor 80-Jan-01 00:00 res/drawable-mdpi-v4/ic_launcher.png
-rw-rw-rw-  2.3 unx      728 b-      728 stor 80-Jan-01 00:00 res/drawable-xhdpi-v4/ic_action_info.png
-rw-rw-rw-  2.3 unx     5855 b-     5855 stor 80-Jan-01 00:00 res/drawable-xhdpi-v4/ic_launcher.png
-rw-rw-rw-  2.3 unx     1129 b-     1129 stor 80-Jan-01 00:00 res/drawable-xxhdpi-v4/ic_action_info.png
-rw-rw-rw-  2.3 unx    10714 b-    10714 stor 80-Jan-01 00:00 res/drawable-xxhdpi-v4/ic_launcher.png
-rw-rw-rw-  2.3 unx    29110 b-    29110 stor 80-Jan-01 00:00 res/drawable-xxhdpi-v4/logo.png
-rw-rw-rw-  2.3 unx     1736 b-      690 defX 80-Jan-01 00:00 res/layout-land/fragment_camera2_basic.xml
-rw-rw-rw-  2.3 unx     2792 b-     1035 defX 80-Jan-01 00:00 res/layout-v26/fragment_camera2_basic.xml
-rw-rw-rw-  2.3 unx      404 b-      228 defX 80-Jan-01 00:00 res/layout/activity_camera.xml
-rw-rw-rw-  2.3 unx     2776 b-     1025 defX 80-Jan-01 00:00 res/layout/fragment_camera2_basic.xml
-rw-rw-rw-  2.3 unx     5152 b-     5152 stor 80-Jan-01 00:00 resources.arsc
-rw----     2.0 fat     2721 b-     1304 defN 80-Jan-01 00:00 META-INF/CERT.SF
-rw----     2.0 fat     1211 b-     1060 defN 80-Jan-01 00:00 META-INF/CERT.RSA
-rw----     2.0 fat     2620 b-     1207 defN 80-Jan-01 00:00 META-INF/MANIFEST.MF

12. 其他

从TfLiteCameraDemo的BUILD文件可以推导出TFLite包括那些文件

这篇关于TFLite: 代码组成结构的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1027337

相关文章

python实现pdf转word和excel的示例代码

《python实现pdf转word和excel的示例代码》本文主要介绍了python实现pdf转word和excel的示例代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价... 目录一、引言二、python编程1,PDF转Word2,PDF转Excel三、前端页面效果展示总结一

在MyBatis的XML映射文件中<trim>元素所有场景下的完整使用示例代码

《在MyBatis的XML映射文件中<trim>元素所有场景下的完整使用示例代码》在MyBatis的XML映射文件中,trim元素用于动态添加SQL语句的一部分,处理前缀、后缀及多余的逗号或连接符,示... 在MyBATis的XML映射文件中,<trim>元素用于动态地添加SQL语句的一部分,例如SET或W

使用C#代码计算数学表达式实例

《使用C#代码计算数学表达式实例》这段文字主要讲述了如何使用C#语言来计算数学表达式,该程序通过使用Dictionary保存变量,定义了运算符优先级,并实现了EvaluateExpression方法来... 目录C#代码计算数学表达式该方法很长,因此我将分段描述下面的代码片段显示了下一步以下代码显示该方法如

python多进程实现数据共享的示例代码

《python多进程实现数据共享的示例代码》本文介绍了Python中多进程实现数据共享的方法,包括使用multiprocessing模块和manager模块这两种方法,具有一定的参考价值,感兴趣的可以... 目录背景进程、进程创建进程间通信 进程间共享数据共享list实践背景 安卓ui自动化框架,使用的是

SpringBoot生成和操作PDF的代码详解

《SpringBoot生成和操作PDF的代码详解》本文主要介绍了在SpringBoot项目下,通过代码和操作步骤,详细的介绍了如何操作PDF,希望可以帮助到准备通过JAVA操作PDF的你,项目框架用的... 目录本文简介PDF文件简介代码实现PDF操作基于PDF模板生成,并下载完全基于代码生成,并保存合并P

SpringBoot基于MyBatis-Plus实现Lambda Query查询的示例代码

《SpringBoot基于MyBatis-Plus实现LambdaQuery查询的示例代码》MyBatis-Plus是MyBatis的增强工具,简化了数据库操作,并提高了开发效率,它提供了多种查询方... 目录引言基础环境配置依赖配置(Maven)application.yml 配置表结构设计demo_st

SpringCloud集成AlloyDB的示例代码

《SpringCloud集成AlloyDB的示例代码》AlloyDB是GoogleCloud提供的一种高度可扩展、强性能的关系型数据库服务,它兼容PostgreSQL,并提供了更快的查询性能... 目录1.AlloyDBjavascript是什么?AlloyDB 的工作原理2.搭建测试环境3.代码工程1.

Java调用Python代码的几种方法小结

《Java调用Python代码的几种方法小结》Python语言有丰富的系统管理、数据处理、统计类软件包,因此从java应用中调用Python代码的需求很常见、实用,本文介绍几种方法从java调用Pyt... 目录引言Java core使用ProcessBuilder使用Java脚本引擎总结引言python

Java中ArrayList的8种浅拷贝方式示例代码

《Java中ArrayList的8种浅拷贝方式示例代码》:本文主要介绍Java中ArrayList的8种浅拷贝方式的相关资料,讲解了Java中ArrayList的浅拷贝概念,并详细分享了八种实现浅... 目录引言什么是浅拷贝?ArrayList 浅拷贝的重要性方法一:使用构造函数方法二:使用 addAll(

Java中switch-case结构的使用方法举例详解

《Java中switch-case结构的使用方法举例详解》:本文主要介绍Java中switch-case结构使用的相关资料,switch-case结构是Java中处理多个分支条件的一种有效方式,它... 目录前言一、switch-case结构的基本语法二、使用示例三、注意事项四、总结前言对于Java初学者