Skip to content

Commit

Permalink
Merge branch 'main' into rq-sqrt
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 12, 2024
2 parents e77618a + 26ada36 commit b85ff2f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ build --cxxopt -std=c++17
# Treat warnings as errors
build --copt -Werror

# Common options for --config=ci
build:ci --curses=no
build:ci --color=no
build:ci --noshow_progress
build:ci --noshow_loading_progress
build:ci --show_timestamps
build:ci --terminal_columns=0
build:ci --verbose_failures

# When building with the address sanitizer
# E.g., bazel build --config asan
build:asan --repo_env CC=clang
Expand Down
8 changes: 6 additions & 2 deletions python/tflite_micro/numpy_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ int TfLiteTypeToPyArrayType(TfLiteType tf_lite_type) {
case kTfLiteFloat16:
return NPY_FLOAT16;
case kTfLiteBFloat16:
// TODO(b/329491949): NPY_BFLOAT16 currently doesn't exist
return NPY_FLOAT16;
// TODO(b/329491949): Supports other ml_dtypes user-defined types.
return NPY_USERDEF;
case kTfLiteFloat64:
return NPY_FLOAT64;
case kTfLiteInt32:
Expand Down Expand Up @@ -114,6 +114,10 @@ TfLiteType TfLiteTypeFromPyType(int py_type) {
return kTfLiteComplex64;
case NPY_COMPLEX128:
return kTfLiteComplex128;
case NPY_USERDEF:
// User-defined types are defined in ml_dtypes. (bfloat16, float8, etc.)
// Fow now, we only support bfloat16.
return kTfLiteBFloat16;
// Avoid default so compiler errors created when new types are made.
}
return kTfLiteNoType;
Expand Down
3 changes: 3 additions & 0 deletions tensorflow/lite/micro/tools/ci_build/test_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# ==============================================================================

set -e
set -x

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR=${SCRIPT_DIR}/../../../../..
Expand All @@ -27,8 +28,10 @@ source tensorflow/lite/micro/tools/ci_build/helper_functions.sh
# having build_test but that was removed with #194.

CC=clang readable_run bazel build ... \
--config=ci \
--build_tag_filters=-no_oss
CC=clang readable_run bazel test ... \
--config=ci \
--test_tag_filters=-no_oss --build_tag_filters=-no_oss \
--test_output=errors

Expand Down
4 changes: 4 additions & 0 deletions tensorflow/lite/micro/tools/ci_build/test_bazel_asan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# ==============================================================================

set -e
set -x

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR=${SCRIPT_DIR}/../../../../..
Expand All @@ -27,8 +28,11 @@ source tensorflow/lite/micro/tools/ci_build/helper_functions.sh
# having build_test but that was removed with #194.

CC=clang readable_run bazel build tensorflow/lite/micro/... \
--config=ci \
--config=asan --build_tag_filters=-no_oss,-noasan

CC=clang readable_run bazel test tensorflow/lite/micro/... \
--config=ci \
--config=asan \
--test_tag_filters=-no_oss,-noasan --build_tag_filters=-no_oss,-noasan \
--test_output=errors
4 changes: 4 additions & 0 deletions tensorflow/lite/micro/tools/ci_build/test_bazel_msan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# ==============================================================================

set -e
set -x

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR=${SCRIPT_DIR}/../../../../..
Expand All @@ -27,8 +28,11 @@ source tensorflow/lite/micro/tools/ci_build/helper_functions.sh
# having build_test but that was removed with #194.

CC=clang readable_run bazel build tensorflow/lite/micro/... \
--config=ci \
--config=msan --build_tag_filters=-no_oss,-nomsan

CC=clang readable_run bazel test tensorflow/lite/micro/... \
--config=ci \
--config=msan \
--test_tag_filters=-no_oss,-nomsan --build_tag_filters=-no_oss,-nomsan \
--test_output=errors
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# ==============================================================================

set -e
set -x

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR=${SCRIPT_DIR}/../../../../..
Expand All @@ -23,4 +24,5 @@ cd "${ROOT_DIR}"
source tensorflow/lite/micro/tools/ci_build/helper_functions.sh

readable_run bazel test tensorflow/lite/tools/... \
--config=ci \
--test_output=errors

0 comments on commit b85ff2f

Please sign in to comment.