* Fix Python module shadowing in Docker CI
Applies legacy_create_init = False to Python rules in BUILD files to prevent Bazel from automatically generating __init__.py files. This prevents the root 'signal/' directory (which contains C++ kernels but no Python source) from being treated as a Python package, which was shadowing the standard library 'signal' module and causing psutil failures in the tflm-ci Docker container.
* Fix directory path in Docker workflows
* Added ResetVariableTensor
* Return kTfLiteError if case of error
* Added new test to Makefile
* Better quantiazation check
* EXPECT in the test
* Typo
* Fixed API usage
- Upgraded the Bazel BuildTool to the latest version (8.2.1).
- Updated the `tflm-ci` Docker image and pushed the new tag (0.6.1) to the `ghcr.io/tflm-bot/tflm-ci registry`.
- Updated the WORKSPACE to load `rules_cc` and `rules_shell` explicitly
- Ran `buildifier` to ensure all BUILD files to have all the fixes.
BUG=Clean-up
@tensorflow/micro
Do not allow programs, which are not unit tests, to silently fail when run using the Xtensa simulator. The generic benchmark application is one such program for which failures were not being reported.
Check the exit status of the simulator when running programs that are not unit tests.
bug=fixes #3155
Replace cc_* targets remaining in TFLM code with tflm_cc_*
targets. These are targets which did not formerly use the common
copts. Avoid changing imported TFLite code, if for no other
reason than to avoid merge conflicts during the automatic sync
with upstream TFLite.
BUG=#2636
The tensorflow-cpu package does not support MacOS or non-x86 hardware. Replacing the tensorflow-cpu python package requirement with the tensorflow meta package should enable the bazel build and the dependent python scripts to be used on those platforms.
BUG=#2367, #1781
This change broke some internal models, so reverting this until we can better understand why.
This also reverts PR #2383. When relanded, both should go back in together.
BUG=b/318738218
@tensorflow/micro
Update the output tensor shape during prepare phase when the computed shape does not match the shape in the flatbuffer.
Kernels:
- BATCH_TO_SPACE_ND
- SPACE_TO_BATCH_ND
- CONV
- RESHAPE
- EXPAND_DIMS
- DEPTHWISE_CONV
Update CMSIS_NN and ARC_MLI optimized kernels.
Add additional tests from TfLite for BATCH_TO_SPACE_ND and SPACE_TO_BATCH_ND.
Update existing tests.
Add tests for Keras model using convolution with dilation > 1.
Update memory_arena_threshold_test to increase total, tail, and persistent allocation sizes:
- Add 20 bytes for CONV output shape
- Add 15 bytes for arena allocation alignment
- x2 convolution layers
Update micro_speech_test arena size as per description in C++ code.
See #2319 for additional details.
Resolves [b/317362237](https://issuetracker.google.com/317362237)
bug=fixes #2368#1646#1629#1231#2338#2319
Temporarily reverting so that we can reland with SpaceToBatch, BatchToSpace, Conv2D and ExpandDims output tensor resizing atomically.
Reverts tensorflow/tflite-micro#2335
BUG=#2338
@tensorflow/micro
Update the output tensor shape during prepare phase when the computed shape does not match the shape in the flatbuffer.
Added additional tests from TfLite.
See #2319 for additional details.
Resolves [b/313360569](https://issuetracker.google.com/313360569)
bug=fixes #2332fixes#2319#1646#1629#1231
@tensorflow/micro
Update makefile and download scripts to allow Corstone 300 to build and run on the CI backend.
Output extra stats at the end of the simulator run.
bug=fixes #2324
There were a few leftover files after PR #2061 for the riscv32_mcu target. Since that target is no longer buildable, these files are not needed. This PR removes those remaining files.
BUG=http://b/286622884
Addresses #1891 and adds Cortex M QEMU based unit tests to the CI flow.
Verification:
1. From repo root, run the command `tensorflow/lite/micro/tools/ci_build/test_cortex_m_qemu.sh`
2. Verify that all tests pass
Note this doesn't remove or change anything related to renode, for the sake of brevity, but we can remove renode here if desired.
BUG=1891
With help from @PiotrZierhoffer, this PR updates TFLM to use the Renode release from Oct 3 (renode-1.13.2.linux-portable).
Manually confirmed that I can run the following command locally (http://b/257332395):
```
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=bluepill test -j8
```
BUG=http://b/260027053 and http://b/257332395
BUG=b/248060722
Every random operation should be seeded to help debugging (deterministic outputs). Set the seed inside the conv net training code since random data is used as training inputs.
Also, testing criteria on the quantization parameters are relaxed before b/248061370 is ready.
* changed TF_LITE_MICRO_EXPECT_* macros to check for int type inputs using std::is_same and decltype.
* fix cpplint formatting
* more cpplint changes
* x86 compiler debug
* more x86 test debug
* debugging x86
* trying typeid instead of decltype/is_same combo
* trying typeid instead of decltype/is_same combo
* trying decltype/is_same again
* trying decltype/is_same again
* trying decltype/is_same again
* trying decltype/is_same again
* debug
* testing #error
* testing
* testing
* testing
* testing
* testing
* trying
* fixed cpplint error
* fixing github formatting presubmit error
* reverting changes
* isolated test to try changes to macro on
* Expect equal changes based on pr and bugonizer suggestions from Ting and Deqiang
* figuring out why changes don't compile
* syntax error
* syntax error
* debugging
* fixed control flow mistake
* Done with EQ macro time for NE
* wrote changes to NE based on EQ changes
* tested NE/EQ and then resotred file used for isolated testing back to what it was in main branch
* formating change for git style check presubmit
* formating change for git style check presubmit
* formating change for git style check presubmit
* refactored the parts of x86 and kernal test that weren't compatible with change. Replaced with EXPECT_NEAR equivalents using a very small epsilon
* git presubmit style formatting changes
* git presubmit style formatting changes
* git presubmit style formatting changes
* git presubmit style formatting changes
* bazel test fixes for presubmit
* change include iostream to type_traits for is_same
* changed .0.0000000001f to 1e-5f in test for to make it easier to read
* rolling back changes to all test files
* changed to EXPECT_EQ and EXPECT_NE to use std::numeric_limits<decltype(delta)>::epsilon()
* control flow fix
* control flow fix
* control flow fix
* debugging
* debugging
* debugging
* debugging
* debugging
* debugging compile error
* reverting EXPECT_NE to prev change and testing EQ seperately
* presubmit github formatting change
* reverting example to test to main
* git fromat fix for presubmit
* git fromat fix for presubmit
* changing is_same to is_floating_point to make code easier to read
* changing is_same to is_floating_point to make code easier to read
* debugging nullptr error with EXPECT_NE
* debugging nullptr error with EXPECT_NE
* debugging nullptr error with EXPECT_NE
* debugging nullptr error with EXPECT_NE
* debugging nullptr error with EXPECT_NE
* debugging nullptr error with EXPECT_NE
* debugging nullptr error with EXPECT_NE
* debugging nullptr error with EXPECT_NE
* debugging nullptr error with EXPECT_NE
* not using NEAR like implementation for NE due to issues with Null_ptrs used in NE test. But honestly no current test use EXPECT_NE with floats or doubles. But in case they do added error message suggestion users use EXPECT_NEAR for Float double not equals testing
* not using NEAR like implementation for NE due to issues with Null_ptrs used in NE test. But honestly no current test use EXPECT_NE with floats or doubles. But in case they do added error message suggestion users use EXPECT_NEAR for Float double not equals testing
* logic error fix for if statement
* returning test file used to test macro changes back to orginal
* changed based on cr suggestions by deqiang
* git style changes presubmit changes
* git style changes presubmit changes
* git style changes presubmit changes
* git style changes presubmit changes
* git style changes presubmit changes
* git style changes presubmit changes
* git style changes presubmit changes
* git style changes presubmit changes
* typo in a string
* fixed all test that used nullptr's with EXPECT_NE to use EXPECT macro instead
* github style presubmit fixes
* github style presubmit fixes
* github style presubmit fixes
* fixing compiler errors non x86 and accidental change to a test file
* channing EXPECT_NE in helloworld that was reverted
* fixing presubmit
* fixing style presubmit
* fixing presubmit
* changing TF_LITE_MICRO_EXPECT to be consistent
* accidentally changed a variable name
* changing all EXPECT to EXPECT(PTR != nullptr)
* irrevlavent EXPECT macro usage
* changing one ptr != nullptr to expect(ptr)
* style fixes for presubmit
* style fixes for presubmit
* fixing file from merge conflict
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* First pass working with float input/output
* Numpy buffer input works. Got a sine graph for hello world output.
Copyright notice
* Remove static references
* Output tensors work
* Output tensors work
* bazel test works
bazel test tensorflow/lite/micro/tools:interpreter_test
--test_output=all
* Successfully built extension with Python setuptools
cd tensorflow/lite/micro/tools/interpreter_pypi
python -m build
pip install dist/example_tflm_interpreter_psho-0.0.3-cp39-cp39-linux_x86_64.whl --force-reinstall
python tests/test-interpreter.py
TestPyPi:
pip uninstall example-tflm-interpreter-psho
python -m twine upload --repository testpypi dist/example-tflm-interpreter-psho-0.0.3.tar.gz
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple example-tflm-interpreter-psho==0.0.3
python tests/test-interpreter.py
* Refactored some
* Cleaned for production and tested with conv model
* Fixed formatting
* Fixed numpy header issue for Docker. Need to fix double registration issue that's somehow only present in Docker.
* Test fix with changes in ci.yml
* Added sudo
* Added nomsan and noasan tags to python test
* Added -layering-check, used py_library instead of py_binary to generate conv model, added micro namespace
* Removed extra debug code
* Added new tests
* Changed reinterpret_steal to cast
* Addressed PR comments
* size log refactor (#1156)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Addressed PR and review comments
* adding documentation to log_binary* workflows. (#1161)
* Automated binary size log update (#1160)
* Create an allocator to manage persistent arena (#1174)
* Create an allocator to manage persistent arena
This PR corresponds to internal cl/452380512.
Create an allocator to manage persistent arena.
This is another step towards the feature of enabling the client to
have two separate memory arenas.
BUG=https://b/226971240
* Manually patch due to Makefile difference
* Fix virtual environment when building Vela for Arm Ethos-U (#1177)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Removed print statement
Co-authored-by: jwithers <jpwithers@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: TFLM-bot <tflm-github-bot@google.com>
Co-authored-by: deqiangc <86809673+deqiangc@users.noreply.github.com>
Co-authored-by: Måns Nilsson <mans.nilsson@arm.com>
* Enable person_detection_test on stm32f4 + bluepill.
Manually tested the following command:
```
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=stm32f4 OPTIMIZED_KERNEL_DIR=cmsis_nn test_person_detection_test
```
Also, a little bit of cleanup in the name of the tests and binaries and
remove mentions to sparkfun_edge.
BUG=http://b/209700478
* exclude person_detection for bluepill.
* Update timeout to get test to pass on bluepill.
Sync additional Python flatbuffer utils from Tensorflow.
* strip_strings
* visualize
Manually confirmed that I can strip strings and visualize from the TFLM repo:
```
bazel build tensorflow/lite/tools:strip_strings
bazel build tensorflow/lite/tools:visualize
bazel-bin/tensorflow/lite/tools/strip_strings --input_tflite_file tensorflow/lite/micro/models/person_detect.tflite --output_tflite_file tensorflow/lite/micro/models/person_detect.strip_strings.tflite
bazel-bin/tensorflow/lite/tools/visualize tensorflow/lite/micro/models/person_detect.strip_strings.tflite tensorflow/lite/micro/models/person_detect.strip_strings.tflite.html
```
Additionally, this changes switches the bazel build to use tensorflow-cpu to avoid CUDA not found warnings.
BUG=http://b/204109200
* Add ability to use bazel + tensorflow pip package.
We can now run python tests that make use of the Tensorflow pip package
with bazel.
Tested the following command:
```
bazel run tensorflow/lite/micro/testing:generate_test_models
bazel test tensorflow/lite/micro/examples/person_detection/utils:raw_to_bitmap_test
```
BUG=http://b/186670822
* Adding absl_py as a source repo (instead of using as a pip package).
This PR adds support for running TFLM tests on a 32-bit RISC-V platform based on HiFive 1 simulated with Renode.
Issue #545 contains a summary of the changes.
BUG=#545
* Bump renode and robot versions
Signed-off-by: Jakub Piecuch <jpiecuch@antmicro.com>
* Refactor test_with_renode.sh
Pass the name of the UART device as a parameter, since RISC-V uses
a different name.
Also pass the full list of binaries to test instead of a directory,
so that we can filter some tests out from within make, which is easier
compared to doing it in bash.
Signed-off-by: Jakub Piecuch <jpiecuch@antmicro.com>
* Use TfLiteRound instead of std::round in hard_swish_test
Signed-off-by: Jakub Piecuch <jpiecuch@antmicro.com>
* Don't pass UART name as an argument to test_with_renode.sh
Passing it as an argument works when running tests via `make test`, but
it breaks when we try to run a single test via `make test_foo`, because
the recipe for `make test_foo` doesn't pass the `${UART_NAME}` argument
to the test script.
Signed-off-by: Jakub Piecuch <jpiecuch@antmicro.com>
1. Add TENSORFLOW_ROOT as a prefix to paths in helper_functions.inc. This enables us to include this file from an external directory. Useful when building a custom op library.
2. Add a script size_hexagon_binary.sh to measure the size of a Hexagon binary, and a matching make macro/rule to invoke it. Similar scripts can be created for any target.
3. Lint fixes to generate_cc_array.py
4. Move HEXAGON_TFLM_LIB from the ext_lib makefile to
hexagon_makefile.inc. This library is needed by any binary, so it
belongs on the LDFLAGS.
Co-authored-by: Advait Jain <advaitjain@users.noreply.github.com>