commit | fbf407383c93774d10bd7c45cd66788a070b0e07 | [log] [tgz] |
---|---|---|
author | Nick Kreeger <kreeger@google.com> | Fri Jun 19 10:40:30 2020 -0700 |
committer | TensorFlower Gardener <gardener@tensorflow.org> | Fri Jun 19 10:45:51 2020 -0700 |
tree | 44d2dcea78d6bf606aafee5b415d86b3afb012da | |
parent | e0780ef031fc27f4f2a71d745004d859a711c90a [diff] |
Reduce the size of TfLiteTensor for the TF Micro runtime. This change uses the existing micro-specific build flag (TF_LITE_STATIC_MEMORY) to reduce the size of TfLiteTensor. In this build setting, only the minimum number of fields required for preparing and initializing a model in TFLM are used. This build define is opt-in only for internal builds and continues to be enabled by default in Makefile builds./ All TFLM internal targets can be built with this flag by adding '--copt=-DTF_LITE_STATIC_MEMORY'. This change reduces the sizeof(TfLiteTensor) to 64 bytes (64bit systems) down from 112 bytes (64 bit systems). TfLiteTensor struct reduced by 1.75x (~43% reduction) Tail allocation reduced by: 2,592kb (~12.5% reduction) Total allocation reduced by: 2,592kb (~12% reduction) Optimized results from memory_arena_threshold_test: Keyword Model: -------------- [RecordingMicroAllocator] Arena allocation total 18448 bytes [RecordingMicroAllocator] Arena allocation head 672 bytes [RecordingMicroAllocator] Arena allocation tail 17776 bytes [RecordingMicroAllocator] 'TfLiteTensor struct' used 3456 bytes with alignment overhead (requested 3456 bytes for 54 tensors) [RecordingMicroAllocator] 'TfLiteTensor quantization data' used 1728 bytes with alignment overhead (requested 1728 bytes for 108 allocations) [RecordingMicroAllocator] 'TfLiteTensor variable buffer data' used 10240 bytes with alignment overhead (requested 10240 bytes for 7 allocations) [RecordingMicroAllocator] 'NodeAndRegistration struct' used 1200 bytes with alignment overhead (requested 1200 bytes for 15 NodeAndRegistration structs) [RecordingMicroAllocator] 'Operator runtime data' used 148 bytes with alignment overhead (requested 148 bytes for 13 OpData structs) Test Conv Model: ---------------- [RecordingMicroAllocator] Arena allocation total 10960 bytes [RecordingMicroAllocator] Arena allocation head 7744 bytes [RecordingMicroAllocator] Arena allocation tail 3216 bytes [RecordingMicroAllocator] 'TfLiteTensor struct' used 960 bytes with alignment overhead (requested 960 bytes for 15 tensors) [RecordingMicroAllocator] 'TfLiteTensor quantization data' used 768 bytes with alignment overhead (requested 752 bytes for 24 allocations) [RecordingMicroAllocator] 'TfLiteTensor variable buffer data' used 0 bytes with alignment overhead (requested 0 bytes for 0 allocations) [RecordingMicroAllocator] 'NodeAndRegistration struct' used 560 bytes with alignment overhead (requested 560 bytes for 7 NodeAndRegistration structs) [RecordingMicroAllocator] 'Operator runtime data' used 136 bytes with alignment overhead (requested 136 bytes for 5 OpData structs) PiperOrigin-RevId: 317335359 Change-Id: Ic3d4d2c3e62249f072ece8f621f9ef94eaa28589
Documentation |
---|
TensorFlow is an end-to-end open source platform for machine learning. It has a comprehensive, flexible ecosystem of tools, libraries, and community resources that lets researchers push the state-of-the-art in ML and developers easily build and deploy ML-powered applications.
TensorFlow was originally developed by researchers and engineers working on the Google Brain team within Google's Machine Intelligence Research organization to conduct machine learning and deep neural networks research. The system is general enough to be applicable in a wide variety of other domains, as well.
TensorFlow provides stable Python and C++ APIs, as well as non-guaranteed backward compatible API for other languages.
Keep up-to-date with release announcements and security updates by subscribing to announce@tensorflow.org. See all the mailing lists.
See the TensorFlow install guide for the pip package, to enable GPU support, use a Docker container, and build from source.
To install the current release, which includes support for CUDA-enabled GPU cards (Ubuntu and Windows):
$ pip install tensorflow
A smaller CPU-only package is also available:
$ pip install tensorflow-cpu
To update TensorFlow to the latest version, add --upgrade
flag to the above commands.
Nightly binaries are available for testing using the tf-nightly and tf-nightly-cpu packages on PyPi.
$ python
>>> import tensorflow as tf >>> tf.add(1, 2).numpy() 3 >>> hello = tf.constant('Hello, TensorFlow!') >>> hello.numpy() b'Hello, TensorFlow!'
For more examples, see the TensorFlow tutorials.
If you want to contribute to TensorFlow, be sure to review the contribution guidelines. This project adheres to TensorFlow's code of conduct. By participating, you are expected to uphold this code.
We use GitHub issues for tracking requests and bugs, please see TensorFlow Discuss for general questions and discussion, and please direct specific questions to Stack Overflow.
The TensorFlow project strives to abide by generally accepted best practices in open-source software development:
Build Type | Status | Artifacts |
---|---|---|
Linux CPU | PyPI | |
Linux GPU | PyPI | |
Linux XLA | TBA | |
macOS | PyPI | |
Windows CPU | PyPI | |
Windows GPU | PyPI | |
Android | ||
Raspberry Pi 0 and 1 | Py3 | |
Raspberry Pi 2 and 3 | Py3 | |
Libtensorflow MacOS CPU | GCS | |
Libtensorflow Linux CPU | GCS | |
Libtensorflow Linux GPU | GCS | |
Libtensorflow Windows CPU | GCS | |
Libtensorflow Windows GPU | GCS |
Build Type | Status | Artifacts |
---|---|---|
Linux AMD ROCm GPU Nightly | Nightly | |
Linux AMD ROCm GPU Stable Release | Release 1.15 / 2.x | |
Linux s390x Nightly | Nightly | |
Linux s390x CPU Stable Release | Release | |
Linux ppc64le CPU Nightly | Nightly | |
Linux ppc64le CPU Stable Release | Release 1.15 / 2.x | |
Linux ppc64le GPU Nightly | Nightly | |
Linux ppc64le GPU Stable Release | Release 1.15 / 2.x | |
Linux CPU with Intel® MKL-DNN Nightly | Nightly | |
Linux CPU with Intel® MKL-DNN Stable Release | Release 1.15 / 2.x | |
Red Hat® Enterprise Linux® 7.6 CPU & GPU Python 2.7, 3.6 | 1.13.1 PyPI |
Learn more about the TensorFlow community and how to contribute.