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

Layer by Layer TFLM vs TfLite python debug tool #2284

Merged
merged 3 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tensorflow/lite/micro/kernels/xtensa/lstm_eval_hifi.cc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll probably need to revert the changes in this file. These show up with newer versions of clang-format than what is installed on the docker image. It'll likely fail CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah every time I run the script to format everything it gets added . I thought I excluded it when pushing the format changes , will revert right now !

Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void calc_cell_state_without_cifg(int16_t* cell_state,
// residue iterations
#pragma concurrent
#pragma loop_count max = 7
for (i = 0; i < ((num_elms)&7); i++) {
for (i = 0; i < ((num_elms) & 7); i++) {
d_cs_r_0 = p16_cs_r[i];
d_fg_0 = p16_fg_r[i];
d_cg_0 = p16_cg_r[i];
Expand Down Expand Up @@ -179,7 +179,7 @@ void calc_cell_state_without_cifg(int16_t* cell_state,
// residue iterations
#pragma concurrent
#pragma loop_count max = 7
for (i = 0; i < ((num_elms)&7); i++) {
for (i = 0; i < ((num_elms) & 7); i++) {
d_cs_r_0 = p16_cs_r[i];
d_fg_0 = p16_fg_r[i];
d_cg_0 = p16_cg_r[i];
Expand Down Expand Up @@ -288,7 +288,7 @@ void calc_cell_state_with_cifg(int16_t* cell_state, const int16_t* forget_gate,
// residue iterations
#pragma concurrent
#pragma loop_count max = 7
for (i = 0; i < ((num_elms)&7); i++) {
for (i = 0; i < ((num_elms) & 7); i++) {
d_cs_r_0 = p16_cs_r[i];
d_fg_0 = p16_fg_r[i];
d_cg_0 = p16_cg_r[i];
Expand Down Expand Up @@ -353,7 +353,7 @@ void calc_cell_state_with_cifg(int16_t* cell_state, const int16_t* forget_gate,
// residue iterations
#pragma concurrent
#pragma loop_count max = 7
for (i = 0; i < ((num_elms)&7); i++) {
for (i = 0; i < ((num_elms) & 7); i++) {
d_cs_r_0 = p16_cs_r[i];
d_fg_0 = p16_fg_r[i];
d_cg_0 = p16_cg_r[i];
Expand Down Expand Up @@ -440,7 +440,7 @@ void xa_nn_elm_mul_16x16_asym8s(int8_t* output, const int16_t* input_1,
// residue iterations
#pragma concurrent
#pragma loop_count max = 7
for (int j = 0; j < ((num_elms)&7); j++) {
for (int j = 0; j < ((num_elms) & 7); j++) {
AE_L16_IP(data_a_0, (ae_int16*)tmp_input_1, 2);
AE_L16_IP(data_b_0, (ae_int16*)tmp_input_2, 2);

Expand Down
34 changes: 34 additions & 0 deletions tensorflow/lite/micro/tools/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")
load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library")
load("@tflm_pip_deps//:requirements.bzl", "requirement")
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
load("//tensorflow:extra_rules.bzl", "tflm_application_friends")
Expand Down Expand Up @@ -140,6 +141,28 @@ py_library(
],
)

cc_binary(
name = "layer_by_layer_output_tool",
srcs = ["layer_by_layer.cc"],
deps = [
":layer_by_layer_schema",
"//tensorflow/lite/c:c_api_types",
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels:op_macros",
"//tensorflow/lite/micro:micro_allocator",
"//tensorflow/lite/micro:micro_context",
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro:micro_log",
"//tensorflow/lite/micro:micro_resource_variable",
"//tensorflow/lite/micro:micro_utils",
"//tensorflow/lite/micro:op_resolvers",
"//tensorflow/lite/micro/kernels:kernel_util",
"//tensorflow/lite/micro/tools/benchmarking:op_resolver",
"//tensorflow/lite/schema:schema_fbs",
"@flatbuffers",
],
)

py_binary(
name = "tflm_model_transforms",
srcs = ["tflm_model_transforms.py"],
Expand Down Expand Up @@ -180,6 +203,7 @@ py_binary(
python_version = "PY3",
srcs_version = "PY3",
deps = [
":layer_by_layer_schema_py",
":model_transforms_utils",
"@absl_py//absl:app",
"@absl_py//absl/flags",
Expand All @@ -188,3 +212,13 @@ py_binary(
"//tensorflow/lite/tools:flatbuffer_utils",
],
)

flatbuffer_cc_library(
name = "layer_by_layer_schema",
srcs = ["layer_by_layer_schema.fbs"],
)

flatbuffer_py_library(
name = "layer_by_layer_schema_py",
srcs = ["layer_by_layer_schema.fbs"],
)
1 change: 1 addition & 0 deletions tensorflow/lite/micro/tools/benchmarking/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cc_library(
name = "op_resolver",
hdrs = ["op_resolver.h"],
visibility = ["//tensorflow/lite/micro/tools:__subpackages__"],
deps = ["//tensorflow/lite/micro:op_resolvers"],
)

Expand Down
Loading
Loading