From c3facd1aa7d30ec530db6565bd2d9c56c695ae76 Mon Sep 17 00:00:00 2001 From: Suleman Shahid Date: Tue, 12 Dec 2023 00:03:44 +0000 Subject: [PATCH 1/4] . --- .bazelrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.bazelrc b/.bazelrc index b150e1f7197..b95537a4af4 100644 --- a/.bazelrc +++ b/.bazelrc @@ -24,6 +24,9 @@ build --embed_label=0 # Get stamp values from a script's output build --workspace_status_command=./tools/workspace_status.sh +# Needed for Bazel 7.0, until migrated to bzlmod +build --noenable_bzlmod + # Use the following C++ standard build --cxxopt -std=c++17 From 8404368f142a799025ba144c01da820805b77799 Mon Sep 17 00:00:00 2001 From: Suleman Shahid Date: Tue, 30 Jan 2024 23:24:06 +0000 Subject: [PATCH 2/4] nl add --- .bazelrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index aa17659ea5d..af0b2fd5985 100644 --- a/.bazelrc +++ b/.bazelrc @@ -64,4 +64,4 @@ build:ubsan --copt -g build:ubsan --copt -O3 build:ubsan --copt -fno-omit-frame-pointer build:ubsan --linkopt -fsanitize=undefined -build:ubsan --linkopt -lubsan \ No newline at end of file +build:ubsan --linkopt -lubsan From eb5606e7598e832efa6285b30d5f8047c1d4af6e Mon Sep 17 00:00:00 2001 From: TFLM-bot Date: Fri, 18 Oct 2024 14:02:45 +0000 Subject: [PATCH 3/4] Sync from upstream TF. --- tensorflow/lite/array.cc | 2 ++ .../lite/kernels/internal/reference/batch_matmul.h | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tensorflow/lite/array.cc b/tensorflow/lite/array.cc index 1b1ff2e4557..21d704a76c4 100644 --- a/tensorflow/lite/array.cc +++ b/tensorflow/lite/array.cc @@ -15,6 +15,8 @@ limitations under the License. #include "tensorflow/lite/array.h" +#include "tensorflow/lite/c/common.h" + namespace tflite { namespace array_internal { diff --git a/tensorflow/lite/kernels/internal/reference/batch_matmul.h b/tensorflow/lite/kernels/internal/reference/batch_matmul.h index 767ad6ab0af..d83696219c2 100644 --- a/tensorflow/lite/kernels/internal/reference/batch_matmul.h +++ b/tensorflow/lite/kernels/internal/reference/batch_matmul.h @@ -111,7 +111,8 @@ inline void BatchMatMul(const RuntimeShape& lhs_shape, const int8_t* lhs_data, const float* scaling_factors, const int32_t* input_offset, int32_t* row_sums, const RuntimeShape& output_shape, float* output_data, - bool* compute_row_sums) { + bool* compute_row_sums, + const float* per_channel_scales) { const RuntimeShape extended_lhs_shape = RuntimeShape::ExtendedShape(5, lhs_shape); const RuntimeShape extended_rhs_shape = @@ -188,7 +189,11 @@ inline void BatchMatMul(const RuntimeShape& lhs_shape, const int8_t* lhs_data, int32_t row_sum = woff_ptr2[i]; total -= row_sum * batch_offset; int idx = lhs_rows * j + i; - out_ptr[idx] += batch_scaling_factor * total; + float scale = batch_scaling_factor; + if (per_channel_scales) { + scale *= per_channel_scales[i]; + } + out_ptr[idx] += scale * total; } } } From 1200e27d0da768d3406b1c36b2f00dd1b9277d9c Mon Sep 17 00:00:00 2001 From: Suleman Shahid Date: Mon, 21 Oct 2024 20:17:13 +0000 Subject: [PATCH 4/4] fix include --- tensorflow/lite/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/tensorflow/lite/BUILD b/tensorflow/lite/BUILD index 57cce631fa0..dbe2cb22af8 100644 --- a/tensorflow/lite/BUILD +++ b/tensorflow/lite/BUILD @@ -8,6 +8,7 @@ cc_library( srcs = ["array.cc"], hdrs = ["array.h"], deps = [ + "//tensorflow/lite/c:common", "//tensorflow/lite/core/c:common", ], )