[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-PINTO0309--Tensorflow-bin":3,"tool-PINTO0309--Tensorflow-bin":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":10,"last_commit_at":50,"category_tags":51,"status":17},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[14,15,13,52],"视频",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[14,35],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":78,"owner_email":79,"owner_twitter":80,"owner_website":79,"owner_url":81,"languages":82,"stars":87,"forks":88,"last_commit_at":89,"license":90,"difficulty_score":32,"env_os":91,"env_gpu":92,"env_ram":93,"env_deps":94,"category_tags":108,"github_topics":109,"view_count":32,"oss_zip_url":79,"oss_zip_packed_at":79,"status":17,"created_at":123,"updated_at":124,"faqs":125,"releases":155},4343,"PINTO0309\u002FTensorflow-bin","Tensorflow-bin","Prebuilt binary with Tensorflow Lite enabled. For RaspberryPi \u002F Jetson Nano. Support for custom operations in MediaPipe. XNNPACK, XNNPACK Multi-Threads, FlexDelegate.","Tensorflow-bin 是一个专为树莓派（RaspberryPi）和英伟达 Jetson Nano 等边缘计算设备打造的 TensorFlow 预编译二进制包集合。它主要解决了开发者在这些资源受限的硬件上从零编译 TensorFlow 耗时极长、环境配置复杂且容易失败的痛点，让用户能够直接安装并运行深度学习模型。\n\n该项目特别适合嵌入式 AI 开发者、研究人员以及希望在边缘设备上部署视觉应用的工程师使用。其核心亮点在于全面启用了 TensorFlow Lite 支持，并针对 ARM 架构进行了深度优化：不仅集成了 XNNPACK 加速引擎以提升推理速度，还支持半精度（Float16）推断，据称可使端侧性能翻倍。此外，它还兼容 MediaPipe 自定义算子及 FlexDelegate，极大地扩展了模型部署的灵活性。\n\nTensorflow-bin 提供了覆盖从 Python 2.7 到 3.11 多个版本、适配 Raspbian、Ubuntu、Debian 等不同操作系统及 32\u002F64 位架构的丰富 Wheel 文件。无论是需要维护旧版 TF 1.15 项目的用户，还是追求最新 ","Tensorflow-bin 是一个专为树莓派（RaspberryPi）和英伟达 Jetson Nano 等边缘计算设备打造的 TensorFlow 预编译二进制包集合。它主要解决了开发者在这些资源受限的硬件上从零编译 TensorFlow 耗时极长、环境配置复杂且容易失败的痛点，让用户能够直接安装并运行深度学习模型。\n\n该项目特别适合嵌入式 AI 开发者、研究人员以及希望在边缘设备上部署视觉应用的工程师使用。其核心亮点在于全面启用了 TensorFlow Lite 支持，并针对 ARM 架构进行了深度优化：不仅集成了 XNNPACK 加速引擎以提升推理速度，还支持半精度（Float16）推断，据称可使端侧性能翻倍。此外，它还兼容 MediaPipe 自定义算子及 FlexDelegate，极大地扩展了模型部署的灵活性。\n\nTensorflow-bin 提供了覆盖从 Python 2.7 到 3.11 多个版本、适配 Raspbian、Ubuntu、Debian 等不同操作系统及 32\u002F64 位架构的丰富 Wheel 文件。无论是需要维护旧版 TF 1.15 项目的用户，还是追求最新 TF 2.x 特性的开发者，都能在这里找到即装即用的解决方案，从而将精力集中于算法优化与应用落地，而非繁琐的环境搭建。","# Tensorflow-bin\n\n**Older versions of Wheel files can be obtained from the [Previous version download script (GoogleDrive)](previous_versions).**\n\nPrebuilt binary with Tensorflow Lite enabled. For RaspberryPi. Since the 64-bit OS for RaspberryPi has been officially released, I stopped building Wheel in armhf. If you need Wheel for armhf, please use this. **[TensorflowLite-bin](https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin)**\n- ~Support for Flex Delegate.~\n- Support for XNNPACK.\n- Support for XNNPACK `Half-precision Inference Doubles On-Device Inference Performance`.\n\n**Python API packages**\n\n|Device|OS|Distribution|Architecture|Python ver|Note|\n|:--|:--|:--|:--|:--|:--|\n|RaspberryPi3\u002F4|Raspbian\u002FDebian|Stretch|armhf \u002F armv7l|3.5.3|32bit, glibc2.24|\n|RaspberryPi3\u002F4|Raspbian\u002FDebian|Buster|armhf \u002F armv7l|3.7.3 \u002F 2.7.16|32bit, glibc2.28|\n|RaspberryPi3\u002F4|RaspberryPiOS\u002FDebian|Buster|aarch64 \u002F armv8|3.7.3|64bit, glibc2.28|\n|RaspberryPi3\u002F4|Ubuntu 18.04|Bionic|aarch64 \u002F armv8|3.6.9|64bit, glibc2.27|\n|RaspberryPi3\u002F4|Ubuntu 20.04|Focal|aarch64 \u002F armv8|3.8.2|64bit, glibc2.31|\n|RaspberryPi3\u002F4,PiZero|Ubuntu 21.04\u002FDebian\u002FRaspberryPiOS|Hirsute\u002FBullseye|aarch64 \u002F armv8|3.9.x|64bit, glibc2.33\u002Fglibc2.31|\n|RaspberryPi3\u002F4|Ubuntu 22.04|Jammy|aarch64 \u002F armv8|3.10.x|64bit, glibc2.35|\n|RaspberryPi4\u002F5,PiZero|Debian\u002FRaspberryPiOS|Bookworm|aarch64 \u002F armv8|3.11.x|64bit, glibc2.36|\n\nMinimal configuration stand-alone installer for Tensorflow Lite.\n**https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin.git**\n\n## Binary type\n\n**\u003Cdetails>\u003Csummary>Python 2.x \u002F 3.x + Tensorflow v1.15.0\u003C\u002Fsummary>\u003Cdiv>**\n\n|.whl|4Threads|Note|\n|:--|:--:|:--|\n|tensorflow-1.15.0-cp35-cp35m-linux_armv7l.whl|○|Raspbian\u002FDebian Stretch, glibc 2.24|\n|tensorflow-1.15.0-cp27-cp27mu-linux_armv7l.whl|○|Raspbian\u002FDebian Buster, glibc 2.28|\n|tensorflow-1.15.0-cp37-cp37m-linux_armv7l.whl|○|Raspbian\u002FDebian Buster, glibc 2.28|\n|tensorflow-1.15.0-cp37-cp37m-linux_aarch64.whl|○|Debian Buster, glibc 2.28|\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n**Python 3.x + Tensorflow v2**\n\n\\*FD = FlexDelegate, \\*\\*XP = XNNPACK Float16 boost, \\*\\*\\*MP = MediaPipe CustomOP, \\*\\*\\*\\*NP = Numpy\n\n|.whl|FD|XP|MP|NP|Note|\n|:--|:--:|:--:|:--:|:--:|:--|\n|tensorflow-2.15.0.post1-cp39-none-linux_aarch64.whl||○||1.26|Ubuntu 21.04 glibc 2.33, Debian Bullseye glibc 2.31|\n|tensorflow-2.15.0.post1-cp310-none-linux_aarch64.whl||○||1.26|Ubuntu 22.04 glibc 2.35|\n|tensorflow-2.15.0.post1-cp311-none-linux_aarch64.whl||○||1.26|Debian Bookworm glibc 2.36|\n\n**\u003Cdetails>\u003Csummary>【Appendix】 C Library + Tensorflow v1.x.x \u002F v2.x.x\u003C\u002Fsummary>\u003Cdiv>**\n\nThe behavior is unconfirmed because I do not have C language implementation skills.\n**[Official tutorial on Tensorflow C binding generation](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fblob\u002Fmaster\u002Ftensorflow\u002Ftools\u002Flib_package\u002FREADME.md)**\n\n**Appx1. C-API build procedure**\n**[Native build procedure of Tensorflow v2.0.0 C API for RaspberryPi \u002F arm64 devices (armhf \u002F aarch64)](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F4f26f63bf40014bec146)**\n\n**Appx2. C-API Usage**\n```sh\n$ wget https:\u002F\u002Fraw.githubusercontent.com\u002FPINTO0309\u002FTensorflow-bin\u002Fmain\u002FC-library\u002F2.2.0-armhf\u002Finstall-buster.sh\n$ .\u002Finstall-buster.sh\n```\n|Version|Binary|Note|\n|:--:|:--|:--|\n|v1.15.0|C-library\u002F1.15.0-armhf\u002Finstall-buster.sh|Raspbian\u002FDebian Buster, glibc 2.28|\n|v1.15.0|C-library\u002F1.15.0-aarch64\u002Finstall-buster.sh|Raspbian\u002FDebian Buster, glibc 2.28|\n|v2.2.0|C-library\u002F2.2.0-armhf\u002Finstall-buster.sh|Raspbian\u002FDebian Buster, glibc 2.28|\n|v2.3.0|C-library\u002F2.3.0-aarch64\u002Finstall-buster.sh|RaspberryPiOS\u002FRaspbian\u002FDebian Buster, glibc 2.28|\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n## Usage\n**\u003Cdetails>\u003Csummary>Example of Python 3.x + Tensorflow v1 series\u003C\u002Fsummary>\u003Cdiv>**\n\n```bash\n$ sudo apt-get install -y \\\n    libhdf5-dev libc-ares-dev libeigen3-dev gcc gfortran \\\n    libgfortran5 libatlas3-base libatlas-base-dev \\\n    libopenblas-dev libopenblas-base libblas-dev \\\n    liblapack-dev cython3 openmpi-bin libopenmpi-dev \\\n    libatlas-base-dev python3-dev\n$ sudo pip3 install pip --upgrade\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo pip3 install pybind11\n$ pip3 install -U --user six wheel mock\n$ sudo pip3 uninstall tensorflow\n$ wget \"https:\u002F\u002Fraw.githubusercontent.com\u002FPINTO0309\u002FTensorflow-bin\u002Fmaster\u002Fprevious_versions\u002Fdownload_tensorflow-1.15.0-cp37-cp37m-linux_armv7l.sh\"\n$ .\u002Fdownload_tensorflow-1.15.0-cp37-cp37m-linux_armv7l.sh\n$ sudo pip3 install tensorflow-1.15.0-cp37-cp37m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n**Example of Python 3.x + Tensorflow v2 series**\n```bash\n##### Bullseye, Ubuntu22.04\nsudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n    libhdf5-dev \\\n    unzip \\\n    pkg-config \\\n    python3-pip \\\n    cmake \\\n    make \\\n    git \\\n    python-is-python3 \\\n    wget \\\n    patchelf && \\\npip install -U pip && \\\npip install numpy==1.26.2 && \\\npip install keras_applications==1.0.8 --no-deps && \\\npip install keras_preprocessing==1.1.2 --no-deps && \\\npip install h5py==3.6.0 && \\\npip install pybind11==2.9.2 && \\\npip install packaging && \\\npip install protobuf==3.20.3 && \\\npip install six wheel mock gdown\n```\n```bash\n##### Bookworm\nsudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n    libhdf5-dev \\\n    unzip \\\n    pkg-config \\\n    python3-pip \\\n    cmake \\\n    make \\\n    git \\\n    python-is-python3 \\\n    wget \\\n    patchelf && \\\npip install -U pip --break-system-packages && \\\npip install numpy==1.26.2 --break-system-packages && \\\npip install keras_applications==1.0.8 --no-deps --break-system-packages && \\\npip install keras_preprocessing==1.1.2 --no-deps --break-system-packages && \\\npip install h5py==3.10.0 --break-system-packages && \\\npip install pybind11==2.9.2 --break-system-packages && \\\npip install packaging --break-system-packages && \\\npip install protobuf==3.20.3 --break-system-packages && \\\npip install six wheel mock gdown --break-system-packages\n```\n```bash\npip uninstall tensorflow\n\nTFVER=2.15.0.post1\n\nPYVER=39\nor\nPYVER=310\nor\nPYVER=311\n\nARCH=`python -c 'import platform; print(platform.machine())'`\necho CPU ARCH: ${ARCH}\n\npip install \\\n--no-cache-dir \\\nhttps:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Freleases\u002Fdownload\u002Fv${TFVER}\u002Ftensorflow-${TFVER}-cp${PYVER}-none-linux_${ARCH}.whl\n```\n\n## Operation check\n**Example of Python 3.x series**\n```bash\n$ python -c 'import tensorflow as tf;print(tf.__version__)'\n2.15.0.post1\n```\n\n**Sample of MultiThread x4**\n- Preparation of test environment\n```bash\n$ cd ~;mkdir test\n$ curl https:\u002F\u002Fraw.githubusercontent.com\u002Ftensorflow\u002Ftensorflow\u002Fmaster\u002Ftensorflow\u002Flite\u002Fexamples\u002Flabel_image\u002Ftestdata\u002Fgrace_hopper.bmp > ~\u002Ftest\u002Fgrace_hopper.bmp\n$ curl https:\u002F\u002Fstorage.googleapis.com\u002Fdownload.tensorflow.org\u002Fmodels\u002Fmobilenet_v1_1.0_224_frozen.tgz | tar xzv -C ~\u002Ftest mobilenet_v1_1.0_224\u002Flabels.txt\n$ mv ~\u002Ftest\u002Fmobilenet_v1_1.0_224\u002Flabels.txt ~\u002Ftest\u002F\n$ curl http:\u002F\u002Fdownload.tensorflow.org\u002Fmodels\u002Fmobilenet_v1_2018_02_22\u002Fmobilenet_v1_1.0_224_quant.tgz | tar xzv -C ~\u002Ftest\n$ cp tensorflow\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fexamples\u002Fpython\u002Flabel_image.py ~\u002Ftest\n```\n\u003Cdetails>\u003Csummary>[Sample Code] label_image.py\u003C\u002Fsummary>\u003Cdiv>\n\n```python\nimport argparse\nimport numpy as np\nimport time\n\nfrom PIL import Image\n\n# Tensorflow -v1.12.0\n#from tensorflow.contrib.lite.python import interpreter as interpreter_wrapper\n\n# Tensorflow v1.13.0+, v2.x.x\nfrom tensorflow.lite.python import interpreter as interpreter_wrapper\n\ndef load_labels(filename):\n  my_labels = []\n  input_file = open(filename, 'r')\n  for l in input_file:\n    my_labels.append(l.strip())\n  return my_labels\nif __name__ == \"__main__\":\n  floating_model = False\n  parser = argparse.ArgumentParser()\n  parser.add_argument(\"-i\", \"--image\", default=\"\u002Ftmp\u002Fgrace_hopper.bmp\", \\\n    help=\"image to be classified\")\n  parser.add_argument(\"-m\", \"--model_file\", \\\n    default=\"\u002Ftmp\u002Fmobilenet_v1_1.0_224_quant.tflite\", \\\n    help=\".tflite model to be executed\")\n  parser.add_argument(\"-l\", \"--label_file\", default=\"\u002Ftmp\u002Flabels.txt\", \\\n    help=\"name of file containing labels\")\n  parser.add_argument(\"--input_mean\", default=127.5, help=\"input_mean\")\n  parser.add_argument(\"--input_std\", default=127.5, \\\n    help=\"input standard deviation\")\n  parser.add_argument(\"--num_threads\", default=1, help=\"number of threads\")\n  args = parser.parse_args()\n\n  ### Tensorflow -v2.2.0\n  #interpreter = interpreter_wrapper.Interpreter(model_path=args.model_file)\n  ### Tensorflow v2.3.0+\n  interpreter = interpreter_wrapper.Interpreter(model_path=args.model_file, num_threads=int(args.num_threads))\n\n  interpreter.allocate_tensors()\n  input_details = interpreter.get_input_details()\n  output_details = interpreter.get_output_details()\n  # check the type of the input tensor\n  if input_details[0]['dtype'] == np.float32:\n    floating_model = True\n  # NxHxWxC, H:1, W:2\n  height = input_details[0]['shape'][1]\n  width = input_details[0]['shape'][2]\n  img = Image.open(args.image)\n  img = img.resize((width, height))\n  # add N dim\n  input_data = np.expand_dims(img, axis=0)\n  if floating_model:\n    input_data = (np.float32(input_data) - args.input_mean) \u002F args.input_std\n\n  ### Tensorflow -v2.2.0\n  #interpreter.set_num_threads(int(args.num_threads))\n  interpreter.set_tensor(input_details[0]['index'], input_data)\n\n  start_time = time.time()\n  interpreter.invoke()\n  stop_time = time.time()\n\n  output_data = interpreter.get_tensor(output_details[0]['index'])\n  results = np.squeeze(output_data)\n  top_k = results.argsort()[-5:][::-1]\n  labels = load_labels(args.label_file)\n  for i in top_k:\n    if floating_model:\n      print('{0:08.6f}'.format(float(results[i]))+\":\", labels[i])\n    else:\n      print('{0:08.6f}'.format(float(results[i]\u002F255.0))+\":\", labels[i])\n\n  print(\"time: \", stop_time - start_time)\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\u003Cbr>\n\n- Run test\n```bash\n$ cd ~\u002Ftest\n$ python3 label_image.py \\\n--num_threads 1 \\\n--image grace_hopper.bmp \\\n--model_file mobilenet_v1_1.0_224_quant.tflite \\\n--label_file labels.txt\n\n0.415686: 653:military uniform\n0.352941: 907:Windsor tie\n0.058824: 668:mortarboard\n0.035294: 458:bow tie, bow-tie, bowtie\n0.035294: 835:suit, suit of clothes\ntime:  0.4152982234954834\n```\n```bash\n$ cd ~\u002Ftest\n$ python3 label_image.py \\\n--num_threads 4 \\\n--image grace_hopper.bmp \\\n--model_file mobilenet_v1_1.0_224_quant.tflite \\\n--label_file labels.txt\n\n0.415686: 653:military uniform\n0.352941: 907:Windsor tie\n0.058824: 668:mortarboard\n0.035294: 458:bow tie, bow-tie, bowtie\n0.035294: 835:suit, suit of clothes\ntime:  0.1647195816040039\n```\n\n**Sample of MultiThread x4 - Real-time inference with a USB camera**\n- RaspberryPi4 (CPU only)\n- Ubuntu 19.10 aarch64\n- High resolution IPS 1080p display\n- USB camera resolution 640x480\n- Tensorflow Lite\n- **[MobileNetV2-SSDLite (Pascal-VOC, Integer Quantization)](https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FPINTO_model_zoo\u002Ftree\u002Fmaster\u002F06_mobilenetv2-ssdlite\u002F02_voc)**\n\n![002](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPINTO0309_Tensorflow-bin_readme_0d2875873a3a.gif)\n\n## Build Parameter\n\n\u003Cdetails>\u003Csummary>Tensorflow v1.11.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v1.11.0**\n\n============================================================\n\n**Python2.x - Bazel 0.17.2**\n```bash\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev libhdf5-dev\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.11.0\n$ .\u002Fconfigure\n\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]:\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython2.7\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fhome\u002Fpi\u002Ftensorflow\u002Ftensorflow\u002Fcontrib\u002Flite\u002Ftools\u002Fmake\u002Fgen\u002Frpi_armv7l\u002Flib\n  \u002Fusr\u002Flib\u002Fpython2.7\u002Fdist-packages\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib\u002Fpython2.7\u002Fdist-packages]\n\nDo you wish to build TensorFlow with jemalloc as malloc support? [Y\u002Fn]: y\nNo jemalloc as malloc support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Google Cloud Platform support? [Y\u002Fn]: n\nNo Google Cloud Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Hadoop File System support? [Y\u002Fn]: n\nNo Hadoop File System support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Amazon AWS Platform support? [Y\u002Fn]: n\nNo Amazon AWS Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Apache Kafka Platform support? [Y\u002Fn]: n\nNo Apache Kafka Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with XLA JIT support? [y\u002FN]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with GDR support? [y\u002FN]: n\nNo GDR support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with VERBS support? [y\u002FN]: n\nNo VERBS support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with nGraph support? [y\u002FN]: n\nNo nGraph support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\n```\n```bash\n$ sudo bazel build --config opt --local_resources 1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo pip2 install \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.11.0-cp27-cp27mu-linux_armv7l.whl\n```\n\n**Python3.x- Bazel 0.17.2 + ZRAM + PythonAPI(MultiThread) Feb 23, 2019, Compilation work completed**\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.11.0\n```\nModify the program with reference to the following.\n\u003Cdetails>\u003Csummary>tensorflow\u002Fcontrib\u002Flite\u002Fexamples\u002Fpython\u002Flabel_image.py\u003C\u002Fsummary>\u003Cdiv>\n\n```python\nimport argparse\nimport numpy as np\nimport time\n\nfrom PIL import Image\n\nfrom tensorflow.contrib.lite.python import interpreter as interpreter_wrapper\ndef load_labels(filename):\n  my_labels = []\n  input_file = open(filename, 'r')\n  for l in input_file:\n    my_labels.append(l.strip())\n  return my_labels\nif __name__ == \"__main__\":\n  floating_model = False\n  parser = argparse.ArgumentParser()\n  parser.add_argument(\"-i\", \"--image\", default=\"\u002Ftmp\u002Fgrace_hopper.bmp\", \\\n    help=\"image to be classified\")\n  parser.add_argument(\"-m\", \"--model_file\", \\\n    default=\"\u002Ftmp\u002Fmobilenet_v1_1.0_224_quant.tflite\", \\\n    help=\".tflite model to be executed\")\n  parser.add_argument(\"-l\", \"--label_file\", default=\"\u002Ftmp\u002Flabels.txt\", \\\n    help=\"name of file containing labels\")\n  parser.add_argument(\"--input_mean\", default=127.5, help=\"input_mean\")\n  parser.add_argument(\"--input_std\", default=127.5, \\\n    help=\"input standard deviation\")\n  parser.add_argument(\"--num_threads\", default=1, help=\"number of threads\")\n  args = parser.parse_args()\n\n  interpreter = interpreter_wrapper.Interpreter(model_path=args.model_file)\n  interpreter.allocate_tensors()\n  input_details = interpreter.get_input_details()\n  output_details = interpreter.get_output_details()\n  # check the type of the input tensor\n  if input_details[0]['dtype'] == np.float32:\n    floating_model = True\n  # NxHxWxC, H:1, W:2\n  height = input_details[0]['shape'][1]\n  width = input_details[0]['shape'][2]\n  img = Image.open(args.image)\n  img = img.resize((width, height))\n  # add N dim\n  input_data = np.expand_dims(img, axis=0)\n  if floating_model:\n    input_data = (np.float32(input_data) - args.input_mean) \u002F args.input_std\n\n  interpreter.set_num_threads(int(args.num_threads))\n  interpreter.set_tensor(input_details[0]['index'], input_data)\n\n  start_time = time.time()\n  interpreter.invoke()\n  stop_time = time.time()\n\n  output_data = interpreter.get_tensor(output_details[0]['index'])\n  results = np.squeeze(output_data)\n  top_k = results.argsort()[-5:][::-1]\n  labels = load_labels(args.label_file)\n  for i in top_k:\n    if floating_model:\n      print('{0:08.6f}'.format(float(results[i]))+\":\", labels[i])\n    else:\n      print('{0:08.6f}'.format(float(results[i]\u002F255.0))+\":\", labels[i])\n\n  print(\"time: \", stop_time - start_time)\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>tensorflow\u002Fcontrib\u002Flite\u002Fpython\u002Finterpreter.py\u003C\u002Fsummary>\u003Cdiv>\n\n```python\n#Add the following two lines to the last line\n\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>tensorflow\u002Fcontrib\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\u003C\u002Fsummary>\u003Cdiv>\n\n```cpp\n\u002F\u002FCorrected the vicinity of the last line as follows\n\n  PyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>tensorflow\u002Fcontrib\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\u003C\u002Fsummary>\u003Cdiv>\n\n```cpp\n\u002F\u002FModified the middle of the logic as follows\n\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\u003Cbr>\n\n```bash\n$ .\u002Fconfigure\n\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib] \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n\nDo you wish to build TensorFlow with jemalloc as malloc support? [Y\u002Fn]: y\nNo jemalloc as malloc support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Google Cloud Platform support? [Y\u002Fn]: n\nNo Google Cloud Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Hadoop File System support? [Y\u002Fn]: n\nNo Hadoop File System support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Amazon AWS Platform support? [Y\u002Fn]: n\nNo Amazon AWS Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Apache Kafka Platform support? [Y\u002Fn]: n\nNo Apache Kafka Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with XLA JIT support? [y\u002FN]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with GDR support? [y\u002FN]: n\nNo GDR support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with VERBS support? [y\u002FN]: n\nNo VERBS support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with nGraph support? [y\u002FN]: n\nNo nGraph support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See tools\u002Fbazel.rc for more details.\n    --config=mkl            # Build with MKL support.\n    --config=monolithic     # Config for mostly static monolithic build.\nConfiguration finished\n```\n```bash\n$ sudo bazel build --config opt --local_resources 1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ sudo -s\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo pip3 install \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.11.0-cp35-cp35m-linux_armv7l.whl\n```\n\n**Python3.x + jemalloc + MPI + MultiThread [C++ Only]**\n\nEdit **`tensorflow\u002Ftensorflow\u002Fcontrib\u002Fmpi\u002Fmpi_rendezvous_mgr.cc`** Line139 \u002F Line140, Line261.\n```cxx\n  MPIRendezvousMgr* mgr =\n      reinterpret_cast\u003CMPIRendezvousMgr*>(this->rendezvous_mgr_);\n- mgr->QueueRequest(parsed.FullKey().ToString(), step_id_,\n-                   std::move(request_call), rendezvous_call);\n+ mgr->QueueRequest(string(parsed.FullKey()), step_id_, std::move(request_call),\n+                   rendezvous_call);\n}\n MPIRemoteRendezvous::~MPIRemoteRendezvous() {}\n\n\n        std::function\u003CMPISendTensorCall*()> res = std::bind(\n            send_cb, status, send_args, recv_args, val, is_dead, mpi_send_call);\n-       SendQueueEntry req(parsed.FullKey().ToString().c_str(), std::move(res));\n+       SendQueueEntry req(string(parsed.FullKey()), std::move(res));\n         this->QueueSendRequest(req);\n```\nEdit **`tensorflow\u002Ftensorflow\u002Fcontrib\u002Fmpi\u002Fmpi_rendezvous_mgr.h`** Line74\n```cxx\n  void Init(const Rendezvous::ParsedKey& parsed, const int64 step_id,\n            const bool is_dead) {\n-   mRes_.set_key(parsed.FullKey().ToString());\n+   mRes_.set_key(string(parsed.FullKey()));\n    mRes_.set_step_id(step_id);\n    mRes_.mutable_response()->set_is_dead(is_dead);\n    mRes_.mutable_response()->set_send_start_micros(\n```\nEdit **`tensorflow\u002Ftensorflow\u002Fcontrib\u002Flite\u002Finterpreter.cc`** Line127.\n```cxx\n-  context_.recommended_num_threads = -1;\n+  context_.recommended_num_threads = 4;\n```\n```bash\n$ sudo apt-get install -y libhdf5-dev\n$ sudo pip3 install keras_applications==1.0.4 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.2 --no-deps\n$ sudo pip3 install h5py==2.8.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.11.0\n$ .\u002Fconfigure\n\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib] \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n\nDo you wish to build TensorFlow with jemalloc as malloc support? [Y\u002Fn]: y\njemalloc as malloc support will be enabled for Tensorflow.\n\nDo you wish to build TensorFlow with Google Cloud Platform support? [Y\u002Fn]: n\nNo Google Cloud Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Hadoop File System support? [Y\u002Fn]: n\nNo Hadoop File System support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Amazon AWS Platform support? [Y\u002Fn]: n\nNo Amazon AWS Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Apache Kafka Platform support? [Y\u002Fn]: n\nNo Apache Kafka Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with XLA JIT support? [y\u002FN]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with GDR support? [y\u002FN]: n\nNo GDR support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with VERBS support? [y\u002FN]: n\nNo VERBS support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with nGraph support? [y\u002FN]: n\nNo nGraph support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: y\nMPI support will be enabled for Tensorflow.\n\nPlease specify the MPI toolkit folder. [Default is \u002Fusr]: \u002Fusr\u002Flib\u002Farm-linux-gnueabihf\u002Fopenmpi\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See tools\u002Fbazel.rc for more details.\n    --config=mkl            # Build with MKL support.\n    --config=monolithic     # Config for mostly static monolithic build.\nConfiguration finished\n```\n```bash\n$ sudo bazel build --config opt --local_resources 1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n**Python3.x + jemalloc + XLA JIT (Build impossible)**\n\n```bash\n$ sudo apt-get install -y libhdf5-dev\n$ sudo pip3 install keras_applications==1.0.4 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.2 --no-deps\n$ sudo pip3 install h5py==2.8.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ JAVA_OPTIONS=-Xmx256M\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.11.0\n$ .\u002Fconfigure\n\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib] \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n\nDo you wish to build TensorFlow with jemalloc as malloc support? [Y\u002Fn]: y\njemalloc as malloc support will be enabled for Tensorflow.\n\nDo you wish to build TensorFlow with Google Cloud Platform support? [Y\u002Fn]: n\nNo Google Cloud Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Hadoop File System support? [Y\u002Fn]: n\nNo Hadoop File System support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Amazon AWS Platform support? [Y\u002Fn]: n\nNo Amazon AWS Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with Apache Kafka Platform support? [Y\u002Fn]: n\nNo Apache Kafka Platform support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with XLA JIT support? [y\u002FN]: y\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with GDR support? [y\u002FN]: n\nNo GDR support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with VERBS support? [y\u002FN]: n\nNo VERBS support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with nGraph support? [y\u002FN]: n\nNo nGraph support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nMPI support will be enabled for Tensorflow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See tools\u002Fbazel.rc for more details.\n    --config=mkl            # Build with MKL support.\n    --config=monolithic     # Config for mostly static monolithic build.\nConfiguration finished\n```\n```bash\n$ sudo bazel build --config opt --local_resources 1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n**Python3.x + TX2 aarch64 - Bazel 0.18.1 (JetPack-L4T-3.3-linux-x64_b39)**\n\n```\n- L4T R28.2.1（TX2 \u002F TX2i）\n- L4T R28.2（TX1）\n- CUDA 9.0\n- cuDNN 7.1.5\n- TensorRT 4.0\n- VisionWorks 1.6\n```\n\n**https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F21574#issuecomment-429758923**\n**https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fserving\u002Fissues\u002F832**\n**https:\u002F\u002Fdocs.nvidia.com\u002Fdeeplearning\u002Fsdk\u002Fnccl-archived\u002Fnccl_2213\u002Fnccl-install-guide\u002Findex.html**\n\n```\nbuild --action_env PYTHON_BIN_PATH=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --action_env PYTHON_LIB_PATH=\"\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\"\nbuild --python_path=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --define with_jemalloc=true\nbuild:gcp --define with_gcp_support=true\nbuild:hdfs --define with_hdfs_support=true\nbuild:aws --define with_aws_support=true\nbuild:kafka --define with_kafka_support=true\nbuild:xla --define with_xla_support=true\nbuild:gdr --define with_gdr_support=true\nbuild:verbs --define with_verbs_support=true\nbuild:ngraph --define with_ngraph_support=true\nbuild --action_env TF_NEED_OPENCL_SYCL=\"0\"\nbuild --action_env TF_NEED_CUDA=\"1\"\nbuild --action_env CUDA_TOOLKIT_PATH=\"\u002Fusr\u002Flocal\u002Fcuda-9.0\"\nbuild --action_env TF_CUDA_VERSION=\"9.0\"\nbuild --action_env CUDNN_INSTALL_PATH=\"\u002Fusr\u002Flib\u002Faarch64-linux-gnu\"\nbuild --action_env TF_CUDNN_VERSION=\"7\"\nbuild --action_env NCCL_INSTALL_PATH=\"\u002Fusr\u002Flocal\"\nbuild --action_env TF_NCCL_VERSION=\"2\"\nbuild --action_env TF_CUDA_COMPUTE_CAPABILITIES=\"3.5,7.0\"\nbuild --action_env LD_LIBRARY_PATH=\"\u002Fusr\u002Flocal\u002Fcuda-9.0\u002Flib64:..\u002Fsrc\u002F.libs\"\nbuild --action_env TF_CUDA_CLANG=\"0\"\nbuild --action_env GCC_HOST_COMPILER_PATH=\"\u002Fusr\u002Fbin\u002Fgcc\"\nbuild --config=cuda\ntest --config=cuda\nbuild --define grpc_no_ares=true\nbuild:opt --copt=-march=native\nbuild:opt --host_copt=-march=native\nbuild:opt --define with_default_optimizations=true\n```\n\n```bash\n$ sudo apt-get install -y libhdf5-dev\n$ sudo pip3 install keras_applications==1.0.4 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.2 --no-deps\n$ sudo pip3 install h5py==2.8.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ bazel build -c opt --config=cuda --local_resources 3072.0,4.0,1.0 --verbose_failures \u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v1.12.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v1.12.0 - Bazel 0.18.1**\n\n============================================================\n\n**Python3.x (Nov 15, 2018 Under construction)**\n\n- tensorflow\u002FBUILD\n```config\nconfig_setting(\n    name = \"no_aws_support\",\n    define_values = {\"no_aws_support\": \"false\"},\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n\nconfig_setting(\n    name = \"no_gcp_support\",\n    define_values = {\"no_gcp_support\": \"false\"},\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n\nconfig_setting(\n    name = \"no_hdfs_support\",\n    define_values = {\"no_hdfs_support\": \"false\"},\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n\nconfig_setting(\n    name = \"no_ignite_support\",\n    define_values = {\"no_ignite_support\": \"false\"},\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n\nconfig_setting(\n    name = \"no_kafka_support\",\n    define_values = {\"no_kafka_support\": \"false\"},\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n```\n- bazel.rc\n```rc\n# Options to disable default on features\nbuild:noaws --define=no_aws_support=true\nbuild:nogcp --define=no_gcp_support=true\nbuild:nohdfs --define=no_hdfs_support=true\nbuild:nokafka --define=no_kafka_support=true\nbuild:noignite --define=no_ignite_support=true\n```\n- configure.py\n```python:configure.py\n  #set_build_var(environ_cp, 'TF_NEED_IGNITE', 'Apache Ignite',\n  #              'with_ignite_support', True, 'ignite')\n\n\n  ## On Windows, we don't have MKL support and the build is always monolithic.\n  ## So no need to print the following message.\n  ## TODO(pcloudy): remove the following if check when they make sense on Windows\n  #if not is_windows():\n  #  print('Preconfigured Bazel build configs. You can use any of the below by '\n  #        'adding \"--config=\u003C>\" to your build command. See tools\u002Fbazel.rc for '\n  #        'more details.')\n  #  config_info_line('mkl', 'Build with MKL support.')\n  #  config_info_line('monolithic', 'Config for mostly static monolithic build.')\n  #  config_info_line('gdr', 'Build with GDR support.')\n  #  config_info_line('verbs', 'Build with libverbs support.')\n  #  config_info_line('ngraph', 'Build with Intel nGraph support.')\n  print('Preconfigured Bazel build configs. You can use any of the below by '\n        'adding \"--config=\u003C>\" to your build command. See .bazelrc for more '\n        'details.')\n  config_info_line('mkl', 'Build with MKL support.')\n  config_info_line('monolithic', 'Config for mostly static monolithic build.')\n  config_info_line('gdr', 'Build with GDR support.')\n  config_info_line('verbs', 'Build with libverbs support.')\n  config_info_line('ngraph', 'Build with Intel nGraph support.')\n\n  print('Preconfigured Bazel build configs to DISABLE default on features:')\n  config_info_line('noaws', 'Disable AWS S3 filesystem support.')\n  config_info_line('nogcp', 'Disable GCP support.')\n  config_info_line('nohdfs', 'Disable HDFS support.')\n  config_info_line('noignite', 'Disable Apacha Ignite support.')\n  config_info_line('nokafka', 'Disable Apache Kafka support.')\n```\n\n```tensorflow\u002Fcontrib\u002FBUILD\n# Description:\n#   contains parts of TensorFlow that are experimental or unstable and which are not supported.\n\nlicenses([\"notice\"])  # Apache 2.0\n\npackage(default_visibility = [\"\u002F\u002Ftensorflow:__subpackages__\"])\n\nload(\"\u002F\u002Fthird_party\u002Fmpi:mpi.bzl\", \"if_mpi\")\nload(\"@local_config_cuda\u002F\u002Fcuda:build_defs.bzl\", \"if_cuda\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_not_windows\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_not_windows_cuda\")\n\npy_library(\n    name = \"contrib_py\",\n    srcs = glob(\n        [\"**\u002F*.py\"],\n        exclude = [\n            \"**\u002F*_test.py\",\n        ],\n    ),\n    srcs_version = \"PY2AND3\",\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n    deps = [\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fall_reduce\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fbatching:batch_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fbayesflow:bayesflow_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fboosted_trees:init_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcheckpoint\u002Fpython:checkpoint\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcluster_resolver:cluster_resolver_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcoder:coder_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcompiler:compiler_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcompiler:xla\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fautograph\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fconstrained_optimization\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcopy_graph:copy_graph_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcrf:crf_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcudnn_rnn:cudnn_rnn_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fdata\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fdeprecated:deprecated_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fdistribute:distribute\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fdistributions:distributions_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Feager\u002Fpython:tfe\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Festimator:estimator_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ffactorization:factorization_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ffeature_column:feature_column_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fframework:framework_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fgan\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fgraph_editor:graph_editor_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fgrid_rnn:grid_rnn_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fhadoop\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fhooks\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fimage:distort_image_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fimage:image_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fimage:single_image_random_dot_stereograms_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Finput_pipeline:input_pipeline_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fintegrate:integrate_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkeras\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkernel_methods\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flabeled_tensor\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flayers:layers_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flearn\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flegacy_seq2seq:seq2seq_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flibsvm\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flinear_optimizer:sdca_estimator_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flinear_optimizer:sdca_ops_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fpython:lite\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flookup:lookup_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flosses:losses_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flosses:metric_learning_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmemory_stats:memory_stats_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmeta_graph_transform\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmetrics:metrics_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmixed_precision:mixed_precision\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmodel_pruning\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnccl:nccl_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnearest_neighbor:nearest_neighbor_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnn:nn_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fopt:opt_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Foptimizer_v2:optimizer_v2_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fperiodic_resample:init_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fpredictor\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fproto\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fquantization:quantization_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fquantize:quantize_graph\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Freceptive_field:receptive_field_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frecurrent:recurrent_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Freduce_slice_ops:reduce_slice_ops_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fremote_fused_graph\u002Fpylib:remote_fused_graph_ops_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fresampler:resampler_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frnn:rnn_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frpc\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsaved_model:saved_model_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fseq2seq:seq2seq_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsignal:signal_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fslim\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fslim:nets\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsolvers:solvers_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsparsemax:sparsemax_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fspecs\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fstaging\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fstat_summarizer:stat_summarizer_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fstateless\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsummary:summary\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:init_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensorboard\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftesting:testing_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftext:text_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftfprof\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftimeseries\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftpu\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftraining:training_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Futil:util_py\",\n        \"\u002F\u002Ftensorflow\u002Fpython:util\",\n        \"\u002F\u002Ftensorflow\u002Fpython\u002Festimator:estimator_py\",\n    ] + if_mpi([\"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmpi_collectives:mpi_collectives_py\"]) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_kafka_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkafka\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkinesis\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ffused_conv:fused_conv_py\",\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensorrt:init_py\",\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fffmpeg:ffmpeg_ops_py\",\n         ],\n     }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fbigtable\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcloud:cloud_py\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_ignite_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fignite\",\n         ],\n     }),\n )\n\ncc_library(\n    name = \"contrib_kernels\",\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n    deps = [\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fboosted_trees:boosted_trees_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcoder:all_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ffactorization\u002Fkernels:all_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fhadoop:dataset_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Finput_pipeline:input_pipeline_ops_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flayers:sparse_feature_cross_op_kernel\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnearest_neighbor:nearest_neighbor_ops_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frnn:all_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fseq2seq:beam_search_ops_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:model_ops_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:stats_ops_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:tensor_forest_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftext:all_kernels\",\n     ] + if_mpi([\"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmpi_collectives:mpi_collectives_py\"]) + if_cuda([\n         \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnccl:nccl_kernels\",\n     ]) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n         \"\u002F\u002Ftensorflow:linux_s390x\": [],\n         \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_kafka_support\": [],\n         \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkafka:dataset_kernels\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkinesis:dataset_kernels\",\n         ],\n    }) + if_not_windows([\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensorrt:trt_engine_op_kernel\",\n    ]),\n )\n\ncc_library(\n    name = \"contrib_ops_op_lib\",\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n    deps = [\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fboosted_trees:boosted_trees_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcoder:all_ops\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ffactorization:all_ops\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fframework:all_ops\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fhadoop:dataset_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Finput_pipeline:input_pipeline_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flayers:sparse_feature_cross_op_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnccl:nccl_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnearest_neighbor:nearest_neighbor_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frnn:all_ops\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fseq2seq:beam_search_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:model_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:stats_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:tensor_forest_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftext:all_ops\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftpu:all_ops\",\n    ] + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n         \"\u002F\u002Ftensorflow:linux_s390x\": [],\n         \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_kafka_support\": [],\n         \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkafka:dataset_ops_op_lib\",\n         ],\n     }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkinesis:dataset_ops_op_lib\",\n        ],\n    }) + if_not_windows([\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensorrt:trt_engine_op_op_lib\",\n    ]) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_ignite_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fignite:dataset_ops_op_lib\",\n         ],\n     }),\n )\n```\n- tensorflow\u002Fcore\u002Fplatform\u002Fdefault\u002Fbuild_config.bzl\n```\n# Platform-specific build configurations.\n\nload(\"@protobuf_archive\u002F\u002F:protobuf.bzl\", \"proto_gen\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_not_mobile\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_windows\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_not_windows\")\nload(\"\u002F\u002Ftensorflow\u002Fcore:platform\u002Fdefault\u002Fbuild_config_root.bzl\", \"if_static\")\nload(\"@local_config_cuda\u002F\u002Fcuda:build_defs.bzl\", \"if_cuda\")\nload(\n    \"\u002F\u002Fthird_party\u002Fmkl:build_defs.bzl\",\n    \"if_mkl_ml\",\n)\n\n# Appends a suffix to a list of deps.\ndef tf_deps(deps, suffix):\n    tf_deps = []\n\n    # If the package name is in shorthand form (ie: does not contain a ':'),\n    # expand it to the full name.\n    for dep in deps:\n        tf_dep = dep\n\n        if not \":\" in dep:\n            dep_pieces = dep.split(\"\u002F\")\n            tf_dep += \":\" + dep_pieces[len(dep_pieces) - 1]\n\n        tf_deps += [tf_dep + suffix]\n\n    return tf_deps\n\n# Modified from @cython\u002F\u002F:Tools\u002Frules.bzl\ndef pyx_library(\n        name,\n        deps = [],\n        py_deps = [],\n        srcs = [],\n        **kwargs):\n    \"\"\"Compiles a group of .pyx \u002F .pxd \u002F .py files.\n\n    First runs Cython to create .cpp files for each input .pyx or .py + .pxd\n    pair. Then builds a shared object for each, passing \"deps\" to each cc_binary\n    rule (includes Python headers by default). Finally, creates a py_library rule\n    with the shared objects and any pure Python \"srcs\", with py_deps as its\n    dependencies; the shared objects can be imported like normal Python files.\n\n    Args:\n      name: Name for the rule.\n      deps: C\u002FC++ dependencies of the Cython (e.g. Numpy headers).\n      py_deps: Pure Python dependencies of the final library.\n      srcs: .py, .pyx, or .pxd files to either compile or pass through.\n      **kwargs: Extra keyword arguments passed to the py_library.\n    \"\"\"\n\n    # First filter out files that should be run compiled vs. passed through.\n    py_srcs = []\n    pyx_srcs = []\n    pxd_srcs = []\n    for src in srcs:\n        if src.endswith(\".pyx\") or (src.endswith(\".py\") and\n                                    src[:-3] + \".pxd\" in srcs):\n            pyx_srcs.append(src)\n        elif src.endswith(\".py\"):\n            py_srcs.append(src)\n        else:\n            pxd_srcs.append(src)\n        if src.endswith(\"__init__.py\"):\n            pxd_srcs.append(src)\n\n    # Invoke cython to produce the shared object libraries.\n    for filename in pyx_srcs:\n        native.genrule(\n            name = filename + \"_cython_translation\",\n            srcs = [filename],\n            outs = [filename.split(\".\")[0] + \".cpp\"],\n            # Optionally use PYTHON_BIN_PATH on Linux platforms so that python 3\n            # works. Windows has issues with cython_binary so skip PYTHON_BIN_PATH.\n            cmd = \"PYTHONHASHSEED=0 $(location @cython\u002F\u002F:cython_binary) --cplus $(SRCS) --output-file $(OUTS)\",\n            tools = [\"@cython\u002F\u002F:cython_binary\"] + pxd_srcs,\n        )\n\n    shared_objects = []\n    for src in pyx_srcs:\n        stem = src.split(\".\")[0]\n        shared_object_name = stem + \".so\"\n        native.cc_binary(\n            name = shared_object_name,\n            srcs = [stem + \".cpp\"],\n            deps = deps + [\"\u002F\u002Fthird_party\u002Fpython_runtime:headers\"],\n            linkshared = 1,\n        )\n        shared_objects.append(shared_object_name)\n\n    # Now create a py_library with these shared objects as data.\n    native.py_library(\n        name = name,\n        srcs = py_srcs,\n        deps = py_deps,\n        srcs_version = \"PY2AND3\",\n        data = shared_objects,\n        **kwargs\n    )\n\ndef _proto_cc_hdrs(srcs, use_grpc_plugin = False):\n    ret = [s[:-len(\".proto\")] + \".pb.h\" for s in srcs]\n    if use_grpc_plugin:\n        ret += [s[:-len(\".proto\")] + \".grpc.pb.h\" for s in srcs]\n    return ret\n\ndef _proto_cc_srcs(srcs, use_grpc_plugin = False):\n    ret = [s[:-len(\".proto\")] + \".pb.cc\" for s in srcs]\n    if use_grpc_plugin:\n        ret += [s[:-len(\".proto\")] + \".grpc.pb.cc\" for s in srcs]\n    return ret\n\ndef _proto_py_outs(srcs, use_grpc_plugin = False):\n    ret = [s[:-len(\".proto\")] + \"_pb2.py\" for s in srcs]\n    if use_grpc_plugin:\n        ret += [s[:-len(\".proto\")] + \"_pb2_grpc.py\" for s in srcs]\n    return ret\n\n# Re-defined protocol buffer rule to allow building \"header only\" protocol\n# buffers, to avoid duplicate registrations. Also allows non-iterable cc_libs\n# containing select() statements.\ndef cc_proto_library(\n        name,\n        srcs = [],\n        deps = [],\n        cc_libs = [],\n        include = None,\n        protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n        internal_bootstrap_hack = False,\n        use_grpc_plugin = False,\n        use_grpc_namespace = False,\n        default_header = False,\n        **kargs):\n    \"\"\"Bazel rule to create a C++ protobuf library from proto source files.\n\n    Args:\n      name: the name of the cc_proto_library.\n      srcs: the .proto files of the cc_proto_library.\n      deps: a list of dependency labels; must be cc_proto_library.\n      cc_libs: a list of other cc_library targets depended by the generated\n          cc_library.\n      include: a string indicating the include path of the .proto files.\n      protoc: the label of the protocol compiler to generate the sources.\n      internal_bootstrap_hack: a flag indicate the cc_proto_library is used only\n          for bootstraping. When it is set to True, no files will be generated.\n          The rule will simply be a provider for .proto files, so that other\n          cc_proto_library can depend on it.\n      use_grpc_plugin: a flag to indicate whether to call the grpc C++ plugin\n          when processing the proto files.\n      default_header: Controls the naming of generated rules. If True, the `name`\n          rule will be header-only, and an _impl rule will contain the\n          implementation. Otherwise the header-only rule (name + \"_headers_only\")\n          must be referred to explicitly.\n      **kargs: other keyword arguments that are passed to cc_library.\n    \"\"\"\n\n    includes = []\n    if include != None:\n        includes = [include]\n\n    if internal_bootstrap_hack:\n        # For pre-checked-in generated files, we add the internal_bootstrap_hack\n        # which will skip the codegen action.\n        proto_gen(\n            name = name + \"_genproto\",\n            srcs = srcs,\n            includes = includes,\n            protoc = protoc,\n            visibility = [\"\u002F\u002Fvisibility:public\"],\n            deps = [s + \"_genproto\" for s in deps],\n        )\n\n        # An empty cc_library to make rule dependency consistent.\n        native.cc_library(\n            name = name,\n            **kargs\n        )\n        return\n\n    grpc_cpp_plugin = None\n    plugin_options = []\n    if use_grpc_plugin:\n        grpc_cpp_plugin = \"\u002F\u002Fexternal:grpc_cpp_plugin\"\n        if use_grpc_namespace:\n            plugin_options = [\"services_namespace=grpc\"]\n\n    gen_srcs = _proto_cc_srcs(srcs, use_grpc_plugin)\n    gen_hdrs = _proto_cc_hdrs(srcs, use_grpc_plugin)\n    outs = gen_srcs + gen_hdrs\n\n    proto_gen(\n        name = name + \"_genproto\",\n        srcs = srcs,\n        outs = outs,\n        gen_cc = 1,\n        includes = includes,\n        plugin = grpc_cpp_plugin,\n        plugin_language = \"grpc\",\n        plugin_options = plugin_options,\n        protoc = protoc,\n        visibility = [\"\u002F\u002Fvisibility:public\"],\n        deps = [s + \"_genproto\" for s in deps],\n    )\n\n    if use_grpc_plugin:\n        cc_libs += select({\n            \"\u002F\u002Ftensorflow:linux_s390x\": [\"\u002F\u002Fexternal:grpc_lib_unsecure\"],\n            \"\u002F\u002Fconditions:default\": [\"\u002F\u002Fexternal:grpc_lib\"],\n        })\n\n    if default_header:\n        header_only_name = name\n        impl_name = name + \"_impl\"\n    else:\n        header_only_name = name + \"_headers_only\"\n        impl_name = name\n\n    native.cc_library(\n        name = impl_name,\n        srcs = gen_srcs,\n        hdrs = gen_hdrs,\n        deps = cc_libs + deps,\n        includes = includes,\n        **kargs\n    )\n    native.cc_library(\n        name = header_only_name,\n        deps = [\"@protobuf_archive\u002F\u002F:protobuf_headers\"] + if_static([impl_name]),\n        hdrs = gen_hdrs,\n        **kargs\n    )\n\n# Re-defined protocol buffer rule to bring in the change introduced in commit\n# https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fprotobuf\u002Fcommit\u002F294b5758c373cbab4b72f35f4cb62dc1d8332b68\n# which was not part of a stable protobuf release in 04\u002F2018.\n# TODO(jsimsa): Remove this once the protobuf dependency version is updated\n# to include the above commit.\ndef py_proto_library(\n        name,\n        srcs = [],\n        deps = [],\n        py_libs = [],\n        py_extra_srcs = [],\n        include = None,\n        default_runtime = \"@protobuf_archive\u002F\u002F:protobuf_python\",\n        protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n        use_grpc_plugin = False,\n        **kargs):\n    \"\"\"Bazel rule to create a Python protobuf library from proto source files\n\n    NOTE: the rule is only an internal workaround to generate protos. The\n    interface may change and the rule may be removed when bazel has introduced\n    the native rule.\n\n    Args:\n      name: the name of the py_proto_library.\n      srcs: the .proto files of the py_proto_library.\n      deps: a list of dependency labels; must be py_proto_library.\n      py_libs: a list of other py_library targets depended by the generated\n          py_library.\n      py_extra_srcs: extra source files that will be added to the output\n          py_library. This attribute is used for internal bootstrapping.\n      include: a string indicating the include path of the .proto files.\n      default_runtime: the implicitly default runtime which will be depended on by\n          the generated py_library target.\n      protoc: the label of the protocol compiler to generate the sources.\n      use_grpc_plugin: a flag to indicate whether to call the Python C++ plugin\n          when processing the proto files.\n      **kargs: other keyword arguments that are passed to cc_library.\n    \"\"\"\n    outs = _proto_py_outs(srcs, use_grpc_plugin)\n\n    includes = []\n    if include != None:\n        includes = [include]\n\n    grpc_python_plugin = None\n    if use_grpc_plugin:\n        grpc_python_plugin = \"\u002F\u002Fexternal:grpc_python_plugin\"\n        # Note: Generated grpc code depends on Python grpc module. This dependency\n        # is not explicitly listed in py_libs. Instead, host system is assumed to\n        # have grpc installed.\n\n    proto_gen(\n        name = name + \"_genproto\",\n        srcs = srcs,\n        outs = outs,\n        gen_py = 1,\n        includes = includes,\n        plugin = grpc_python_plugin,\n        plugin_language = \"grpc\",\n        protoc = protoc,\n        visibility = [\"\u002F\u002Fvisibility:public\"],\n        deps = [s + \"_genproto\" for s in deps],\n    )\n\n    if default_runtime and not default_runtime in py_libs + deps:\n        py_libs = py_libs + [default_runtime]\n\n    native.py_library(\n        name = name,\n        srcs = outs + py_extra_srcs,\n        deps = py_libs + deps,\n        imports = includes,\n        **kargs\n    )\n\ndef tf_proto_library_cc(\n        name,\n        srcs = [],\n        has_services = None,\n        protodeps = [],\n        visibility = [],\n        testonly = 0,\n        cc_libs = [],\n        cc_stubby_versions = None,\n        cc_grpc_version = None,\n        j2objc_api_version = 1,\n        cc_api_version = 2,\n        dart_api_version = 2,\n        java_api_version = 2,\n        py_api_version = 2,\n        js_api_version = 2,\n        js_codegen = \"jspb\",\n        default_header = False):\n    js_codegen = js_codegen  # unused argument\n    js_api_version = js_api_version  # unused argument\n    native.filegroup(\n        name = name + \"_proto_srcs\",\n        srcs = srcs + tf_deps(protodeps, \"_proto_srcs\"),\n        testonly = testonly,\n        visibility = visibility,\n    )\n\n    use_grpc_plugin = None\n    if cc_grpc_version:\n        use_grpc_plugin = True\n\n    cc_deps = tf_deps(protodeps, \"_cc\")\n    cc_name = name + \"_cc\"\n    if not srcs:\n        # This is a collection of sub-libraries. Build header-only and impl\n        # libraries containing all the sources.\n        proto_gen(\n            name = cc_name + \"_genproto\",\n            protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n            visibility = [\"\u002F\u002Fvisibility:public\"],\n            deps = [s + \"_genproto\" for s in cc_deps],\n        )\n        native.cc_library(\n            name = cc_name,\n            deps = cc_deps + [\"@protobuf_archive\u002F\u002F:protobuf_headers\"] + if_static([name + \"_cc_impl\"]),\n            testonly = testonly,\n            visibility = visibility,\n        )\n        native.cc_library(\n            name = cc_name + \"_impl\",\n            deps = [s + \"_impl\" for s in cc_deps] + [\"@protobuf_archive\u002F\u002F:cc_wkt_protos\"],\n        )\n\n        return\n\n    cc_proto_library(\n        name = cc_name,\n        testonly = testonly,\n        srcs = srcs,\n        cc_libs = cc_libs + if_static(\n            [\"@protobuf_archive\u002F\u002F:protobuf\"],\n            [\"@protobuf_archive\u002F\u002F:protobuf_headers\"],\n        ),\n        copts = if_not_windows([\n            \"-Wno-unknown-warning-option\",\n            \"-Wno-unused-but-set-variable\",\n            \"-Wno-sign-compare\",\n        ]),\n        default_header = default_header,\n        protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n        use_grpc_plugin = use_grpc_plugin,\n        visibility = visibility,\n        deps = cc_deps + [\"@protobuf_archive\u002F\u002F:cc_wkt_protos\"],\n    )\n\ndef tf_proto_library_py(\n        name,\n        srcs = [],\n        protodeps = [],\n        deps = [],\n        visibility = [],\n        testonly = 0,\n        srcs_version = \"PY2AND3\",\n        use_grpc_plugin = False):\n    py_deps = tf_deps(protodeps, \"_py\")\n    py_name = name + \"_py\"\n    if not srcs:\n        # This is a collection of sub-libraries. Build header-only and impl\n        # libraries containing all the sources.\n        proto_gen(\n            name = py_name + \"_genproto\",\n            protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n            visibility = [\"\u002F\u002Fvisibility:public\"],\n            deps = [s + \"_genproto\" for s in py_deps],\n        )\n        native.py_library(\n            name = py_name,\n            deps = py_deps + [\"@protobuf_archive\u002F\u002F:protobuf_python\"],\n            testonly = testonly,\n            visibility = visibility,\n        )\n        return\n\n    py_proto_library(\n        name = py_name,\n        testonly = testonly,\n        srcs = srcs,\n        default_runtime = \"@protobuf_archive\u002F\u002F:protobuf_python\",\n        protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n        srcs_version = srcs_version,\n        use_grpc_plugin = use_grpc_plugin,\n        visibility = visibility,\n        deps = deps + py_deps + [\"@protobuf_archive\u002F\u002F:protobuf_python\"],\n    )\n\ndef tf_jspb_proto_library(**kwargs):\n    pass\n\ndef tf_nano_proto_library(**kwargs):\n    pass\n\ndef tf_proto_library(\n        name,\n        srcs = [],\n        has_services = None,\n        protodeps = [],\n        visibility = [],\n        testonly = 0,\n        cc_libs = [],\n        cc_api_version = 2,\n        cc_grpc_version = None,\n        dart_api_version = 2,\n        j2objc_api_version = 1,\n        java_api_version = 2,\n        py_api_version = 2,\n        js_api_version = 2,\n        js_codegen = \"jspb\",\n        provide_cc_alias = False,\n        default_header = False):\n    \"\"\"Make a proto library, possibly depending on other proto libraries.\"\"\"\n    _ignore = (js_api_version, js_codegen, provide_cc_alias)\n\n    tf_proto_library_cc(\n        name = name,\n        testonly = testonly,\n        srcs = srcs,\n        cc_grpc_version = cc_grpc_version,\n        cc_libs = cc_libs,\n        default_header = default_header,\n        protodeps = protodeps,\n        visibility = visibility,\n    )\n\n    tf_proto_library_py(\n        name = name,\n        testonly = testonly,\n        srcs = srcs,\n        protodeps = protodeps,\n        srcs_version = \"PY2AND3\",\n        use_grpc_plugin = has_services,\n        visibility = visibility,\n    )\n\n# A list of all files under platform matching the pattern in 'files'. In\n# contrast with 'tf_platform_srcs' below, which seletive collects files that\n# must be compiled in the 'default' platform, this is a list of all headers\n# mentioned in the platform\u002F* files.\ndef tf_platform_hdrs(files):\n    return native.glob([\"platform\u002F*\u002F\" + f for f in files])\n\ndef tf_platform_srcs(files):\n    base_set = [\"platform\u002Fdefault\u002F\" + f for f in files]\n    windows_set = base_set + [\"platform\u002Fwindows\u002F\" + f for f in files]\n    posix_set = base_set + [\"platform\u002Fposix\u002F\" + f for f in files]\n\n    # Handle cases where we must also bring the posix file in. Usually, the list\n    # of files to build on windows builds is just all the stuff in the\n    # windows_set. However, in some cases the implementations in 'posix\u002F' are\n    # just what is necessary and historically we choose to simply use the posix\n    # file instead of making a copy in 'windows'.\n    for f in files:\n        if f == \"error.cc\":\n            windows_set.append(\"platform\u002Fposix\u002F\" + f)\n\n    return select({\n        \"\u002F\u002Ftensorflow:windows\": native.glob(windows_set),\n        \"\u002F\u002Fconditions:default\": native.glob(posix_set),\n    })\n\ndef tf_additional_lib_hdrs(exclude = []):\n    windows_hdrs = native.glob([\n        \"platform\u002Fdefault\u002F*.h\",\n        \"platform\u002Fwindows\u002F*.h\",\n        \"platform\u002Fposix\u002Ferror.h\",\n    ], exclude = exclude)\n    return select({\n        \"\u002F\u002Ftensorflow:windows\": windows_hdrs,\n        \"\u002F\u002Fconditions:default\": native.glob([\n            \"platform\u002Fdefault\u002F*.h\",\n            \"platform\u002Fposix\u002F*.h\",\n        ], exclude = exclude),\n    })\n\ndef tf_additional_lib_srcs(exclude = []):\n    windows_srcs = native.glob([\n        \"platform\u002Fdefault\u002F*.cc\",\n        \"platform\u002Fwindows\u002F*.cc\",\n        \"platform\u002Fposix\u002Ferror.cc\",\n    ], exclude = exclude)\n    return select({\n        \"\u002F\u002Ftensorflow:windows\": windows_srcs,\n        \"\u002F\u002Fconditions:default\": native.glob([\n            \"platform\u002Fdefault\u002F*.cc\",\n            \"platform\u002Fposix\u002F*.cc\",\n        ], exclude = exclude),\n    })\n\ndef tf_additional_minimal_lib_srcs():\n    return [\n        \"platform\u002Fdefault\u002Fintegral_types.h\",\n        \"platform\u002Fdefault\u002Fmutex.h\",\n    ]\n\ndef tf_additional_proto_hdrs():\n    return [\n        \"platform\u002Fdefault\u002Fintegral_types.h\",\n        \"platform\u002Fdefault\u002Flogging.h\",\n        \"platform\u002Fdefault\u002Fprotobuf.h\",\n    ] + if_windows([\n        \"platform\u002Fwindows\u002Fintegral_types.h\",\n    ])\n\ndef tf_additional_proto_compiler_hdrs():\n    return [\n        \"platform\u002Fdefault\u002Fprotobuf_compiler.h\",\n    ]\n\ndef tf_additional_proto_srcs():\n    return [\n        \"platform\u002Fdefault\u002Fprotobuf.cc\",\n    ]\n\ndef tf_additional_human_readable_json_deps():\n    return []\n\ndef tf_additional_all_protos():\n    return [\"\u002F\u002Ftensorflow\u002Fcore:protos_all\"]\n\ndef tf_protos_all_impl():\n    return [\"\u002F\u002Ftensorflow\u002Fcore:protos_all_cc_impl\"]\n\ndef tf_protos_all():\n    return if_static(\n        extra_deps = tf_protos_all_impl(),\n        otherwise = [\"\u002F\u002Ftensorflow\u002Fcore:protos_all_cc\"],\n    )\n\ndef tf_protos_grappler_impl():\n    return [\"\u002F\u002Ftensorflow\u002Fcore\u002Fgrappler\u002Fcosts:op_performance_data_cc_impl\"]\n\ndef tf_protos_grappler():\n    return if_static(\n        extra_deps = tf_protos_grappler_impl(),\n        otherwise = [\"\u002F\u002Ftensorflow\u002Fcore\u002Fgrappler\u002Fcosts:op_performance_data_cc\"],\n    )\n\ndef tf_additional_cupti_wrapper_deps():\n    return [\"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fdefault\u002Fgpu:cupti_wrapper\"]\n\ndef tf_additional_device_tracer_srcs():\n    return [\"platform\u002Fdefault\u002Fdevice_tracer.cc\"]\n\ndef tf_additional_device_tracer_cuda_deps():\n    return []\n\ndef tf_additional_device_tracer_deps():\n    return []\n\ndef tf_additional_libdevice_data():\n    return []\n\ndef tf_additional_libdevice_deps():\n    return [\"@local_config_cuda\u002F\u002Fcuda:cuda_headers\"]\n\ndef tf_additional_libdevice_srcs():\n    return [\"platform\u002Fdefault\u002Fcuda_libdevice_path.cc\"]\n\ndef tf_additional_test_deps():\n    return []\n\ndef tf_additional_test_srcs():\n    return [\n        \"platform\u002Fdefault\u002Ftest_benchmark.cc\",\n    ] + select({\n        \"\u002F\u002Ftensorflow:windows\": [\n            \"platform\u002Fwindows\u002Ftest.cc\",\n        ],\n        \"\u002F\u002Fconditions:default\": [\n            \"platform\u002Fposix\u002Ftest.cc\",\n        ],\n    })\n\ndef tf_kernel_tests_linkstatic():\n    return 0\n\ndef tf_additional_lib_defines():\n    \"\"\"Additional defines needed to build TF libraries.\"\"\"\n    return []\n\ndef tf_additional_lib_deps():\n    \"\"\"Additional dependencies needed to build TF libraries.\"\"\"\n    return [\n        \"@com_google_absl\u002F\u002Fabsl\u002Fbase:base\",\n        \"@com_google_absl\u002F\u002Fabsl\u002Fcontainer:inlined_vector\",\n        \"@com_google_absl\u002F\u002Fabsl\u002Ftypes:span\",\n        \"@com_google_absl\u002F\u002Fabsl\u002Ftypes:optional\",\n    ] + if_static(\n        [\"@nsync\u002F\u002F:nsync_cpp\"],\n        [\"@nsync\u002F\u002F:nsync_headers\"],\n    )\n\ndef tf_additional_core_deps():\n     return select({\n         \"\u002F\u002Ftensorflow:android\": [],\n         \"\u002F\u002Ftensorflow:ios\": [],\n         \"\u002F\u002Ftensorflow:linux_s390x\": [],\n         \"\u002F\u002Ftensorflow:windows\": [],\n         \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n         \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fcloud:gcs_file_system\",\n         ],\n     }) + select({\n         \"\u002F\u002Ftensorflow:android\": [],\n         \"\u002F\u002Ftensorflow:ios\": [],\n         \"\u002F\u002Ftensorflow:linux_s390x\": [],\n         \"\u002F\u002Ftensorflow:windows\": [],\n         \"\u002F\u002Ftensorflow:no_hdfs_support\": [],\n         \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fhadoop:hadoop_file_system\",\n         ],\n     }) + select({\n         \"\u002F\u002Ftensorflow:android\": [],\n         \"\u002F\u002Ftensorflow:ios\": [],\n         \"\u002F\u002Ftensorflow:linux_s390x\": [],\n         \"\u002F\u002Ftensorflow:windows\": [],\n         \"\u002F\u002Ftensorflow:no_aws_support\": [],\n         \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fs3:s3_file_system\",\n         ],\n     })\n\n# TODO(jart, jhseu): Delete when GCP is default on.\ndef tf_additional_cloud_op_deps():\n    return select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n           \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcloud:bigquery_reader_ops_op_lib\",\n           \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcloud:gcs_config_ops_op_lib\",\n       ],\n   })\n\n# TODO(jart, jhseu): Delete when GCP is default on.\ndef tf_additional_cloud_kernel_deps():\n    return select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcloud\u002Fkernels:bigquery_reader_ops\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcloud\u002Fkernels:gcs_config_ops\",\n        ],\n    })\n\ndef tf_lib_proto_parsing_deps():\n    return [\n        \":protos_all_cc\",\n        \"\u002F\u002Fthird_party\u002Feigen3\",\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fdefault\u002Fbuild_config:proto_parsing\",\n    ]\n\ndef tf_lib_proto_compiler_deps():\n    return [\n        \"@protobuf_archive\u002F\u002F:protoc_lib\",\n    ]\n\ndef tf_additional_verbs_lib_defines():\n    return select({\n        \"\u002F\u002Ftensorflow:with_verbs_support\": [\"TENSORFLOW_USE_VERBS\"],\n        \"\u002F\u002Fconditions:default\": [],\n    })\n\ndef tf_additional_mpi_lib_defines():\n    return select({\n        \"\u002F\u002Ftensorflow:with_mpi_support\": [\"TENSORFLOW_USE_MPI\"],\n        \"\u002F\u002Fconditions:default\": [],\n    })\n\ndef tf_additional_gdr_lib_defines():\n    return select({\n        \"\u002F\u002Ftensorflow:with_gdr_support\": [\"TENSORFLOW_USE_GDR\"],\n        \"\u002F\u002Fconditions:default\": [],\n    })\n\ndef tf_py_clif_cc(name, visibility = None, **kwargs):\n    pass\n\ndef tf_pyclif_proto_library(\n        name,\n        proto_lib,\n        proto_srcfile = \"\",\n        visibility = None,\n        **kwargs):\n    pass\n\ndef tf_additional_binary_deps():\n    return [\"@nsync\u002F\u002F:nsync_cpp\"] + if_cuda(\n        [\n            \"\u002F\u002Ftensorflow\u002Fstream_executor:cuda_platform\",\n            \"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fdefault\u002Fbuild_config:cuda\",\n        ],\n    ) + [\n        # TODO(allenl): Split these out into their own shared objects (they are\n        # here because they are shared between contrib\u002F op shared objects and\n        # core).\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Fkernels:lookup_util\",\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Futil\u002Ftensor_bundle\",\n    ] + if_mkl_ml(\n        [\n            \"\u002F\u002Fthird_party\u002Fmkl:intel_binary_blob\",\n        ],\n    )\n```\n- tensorflow\u002Ftools\u002Flib_package\u002FBUILD\n```\n# Packaging for TensorFlow artifacts other than the Python API (pip whl).\n# This includes the C API, Java API, and protocol buffer files.\n\npackage(default_visibility = [\"\u002F\u002Fvisibility:private\"])\n\nload(\"@bazel_tools\u002F\u002Ftools\u002Fbuild_defs\u002Fpkg:pkg.bzl\", \"pkg_tar\")\nload(\"@local_config_syslibs\u002F\u002F:build_defs.bzl\", \"if_not_system_lib\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"tf_binary_additional_srcs\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_cuda\")\nload(\"\u002F\u002Fthird_party\u002Fmkl:build_defs.bzl\", \"if_mkl\")\n\ngenrule(\n    name = \"libtensorflow_proto\",\n    srcs = [\"\u002F\u002Ftensorflow\u002Fcore:protos_all_proto_srcs\"],\n    outs = [\"libtensorflow_proto.zip\"],\n    cmd = \"zip $@ $(SRCS)\",\n)\n\npkg_tar(\n    name = \"libtensorflow\",\n    extension = \"tar.gz\",\n    # Mark as \"manual\" till\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # and https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # are resolved, otherwise these rules break when built\n    # with Python 3.\n    tags = [\"manual\"],\n    deps = [\n        \":cheaders\",\n        \":clib\",\n        \":clicenses\",\n        \":eager_cheaders\",\n    ],\n)\n\npkg_tar(\n    name = \"libtensorflow_jni\",\n    extension = \"tar.gz\",\n    files = [\n        \"include\u002Ftensorflow\u002Fjni\u002FLICENSE\",\n        \"\u002F\u002Ftensorflow\u002Fjava:libtensorflow_jni\",\n    ],\n    # Mark as \"manual\" till\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # and https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # are resolved, otherwise these rules break when built\n    # with Python 3.\n    tags = [\"manual\"],\n    deps = [\":common_deps\"],\n)\n\n# Shared objects that all TensorFlow libraries depend on.\npkg_tar(\n    name = \"common_deps\",\n    files = tf_binary_additional_srcs(),\n    tags = [\"manual\"],\n)\n\npkg_tar(\n    name = \"cheaders\",\n    files = [\n        \"\u002F\u002Ftensorflow\u002Fc:headers\",\n    ],\n    package_dir = \"include\u002Ftensorflow\u002Fc\",\n    # Mark as \"manual\" till\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # and https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # are resolved, otherwise these rules break when built\n    # with Python 3.\n    tags = [\"manual\"],\n)\n\npkg_tar(\n    name = \"eager_cheaders\",\n    files = [\n        \"\u002F\u002Ftensorflow\u002Fc\u002Feager:headers\",\n    ],\n    package_dir = \"include\u002Ftensorflow\u002Fc\u002Feager\",\n    # Mark as \"manual\" till\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # and https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # are resolved, otherwise these rules break when built\n    # with Python 3.\n    tags = [\"manual\"],\n)\n\npkg_tar(\n    name = \"clib\",\n    files = [\"\u002F\u002Ftensorflow:libtensorflow.so\"],\n    package_dir = \"lib\",\n    # Mark as \"manual\" till\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # and https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # are resolved, otherwise these rules break when built\n    # with Python 3.\n    tags = [\"manual\"],\n    deps = [\":common_deps\"],\n)\n\npkg_tar(\n    name = \"clicenses\",\n    files = [\":include\u002Ftensorflow\u002Fc\u002FLICENSE\"],\n    package_dir = \"include\u002Ftensorflow\u002Fc\",\n    # Mark as \"manual\" till\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # and https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # are resolved, otherwise these rules break when built\n    # with Python 3.\n    tags = [\"manual\"],\n)\n\ngenrule(\n    name = \"clicenses_generate\",\n    srcs = [\n        \"\u002F\u002Fthird_party\u002Fhadoop:LICENSE.txt\",\n        \"\u002F\u002Fthird_party\u002Feigen3:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Ffft2d:LICENSE\",\n        \"@boringssl\u002F\u002F:LICENSE\",\n        \"@com_googlesource_code_re2\u002F\u002F:LICENSE\",\n        \"@curl\u002F\u002F:COPYING\",\n        \"@double_conversion\u002F\u002F:LICENSE\",\n        \"@eigen_archive\u002F\u002F:COPYING.MPL2\",\n        \"@farmhash_archive\u002F\u002F:COPYING\",\n        \"@fft2d\u002F\u002F:fft\u002Freadme.txt\",\n        \"@gemmlowp\u002F\u002F:LICENSE\",\n        \"@gif_archive\u002F\u002F:COPYING\",\n        \"@highwayhash\u002F\u002F:LICENSE\",\n        \"@icu\u002F\u002F:icu4c\u002FLICENSE\",\n        \"@jpeg\u002F\u002F:LICENSE.md\",\n        \"@llvm\u002F\u002F:LICENSE.TXT\",\n        \"@lmdb\u002F\u002F:LICENSE\",\n        \"@local_config_sycl\u002F\u002Fsycl:LICENSE.text\",\n        \"@nasm\u002F\u002F:LICENSE\",\n        \"@nsync\u002F\u002F:LICENSE\",\n        \"@png_archive\u002F\u002F:LICENSE\",\n        \"@protobuf_archive\u002F\u002F:LICENSE\",\n        \"@snappy\u002F\u002F:COPYING\",\n        \"@zlib_archive\u002F\u002F:zlib.h\",\n    ] + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@aws\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@com_github_googlecloudplatform_google_cloud_cpp\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Fkernels:xsmm\": [\n            \"@libxsmm_archive\u002F\u002F:LICENSE.md\",\n        ],\n        \"\u002F\u002Fconditions:default\": [],\n    }) + if_cuda([\n        \"@cub_archive\u002F\u002F:LICENSE.TXT\",\n    ]) + if_mkl([\n        \"\u002F\u002Fthird_party\u002Fmkl:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Fmkl_dnn:LICENSE\",\n    ]) + if_not_system_lib(\n        \"grpc\",\n        [\n            \"@grpc\u002F\u002F:LICENSE\",\n            \"@grpc\u002F\u002Fthird_party\u002Fnanopb:LICENSE.txt\",\n            \"@grpc\u002F\u002Fthird_party\u002Faddress_sorting:LICENSE\",\n        ],\n    ),\n    outs = [\"include\u002Ftensorflow\u002Fc\u002FLICENSE\"],\n    cmd = \"$(location :concat_licenses.sh) $(SRCS) >$@\",\n    tools = [\":concat_licenses.sh\"],\n)\n\ngenrule(\n    name = \"jnilicenses_generate\",\n    srcs = [\n        \"\u002F\u002Fthird_party\u002Fhadoop:LICENSE.txt\",\n        \"\u002F\u002Fthird_party\u002Feigen3:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Ffft2d:LICENSE\",\n        \"@boringssl\u002F\u002F:LICENSE\",\n        \"@com_googlesource_code_re2\u002F\u002F:LICENSE\",\n        \"@curl\u002F\u002F:COPYING\",\n        \"@double_conversion\u002F\u002F:LICENSE\",\n        \"@eigen_archive\u002F\u002F:COPYING.MPL2\",\n        \"@farmhash_archive\u002F\u002F:COPYING\",\n        \"@fft2d\u002F\u002F:fft\u002Freadme.txt\",\n        \"@gemmlowp\u002F\u002F:LICENSE\",\n        \"@gif_archive\u002F\u002F:COPYING\",\n        \"@highwayhash\u002F\u002F:LICENSE\",\n        \"@icu\u002F\u002F:icu4j\u002Fmain\u002Fshared\u002Flicenses\u002FLICENSE\",\n        \"@jpeg\u002F\u002F:LICENSE.md\",\n        \"@llvm\u002F\u002F:LICENSE.TXT\",\n        \"@lmdb\u002F\u002F:LICENSE\",\n        \"@local_config_sycl\u002F\u002Fsycl:LICENSE.text\",\n        \"@nasm\u002F\u002F:LICENSE\",\n        \"@nsync\u002F\u002F:LICENSE\",\n        \"@png_archive\u002F\u002F:LICENSE\",\n        \"@protobuf_archive\u002F\u002F:LICENSE\",\n        \"@snappy\u002F\u002F:COPYING\",\n        \"@zlib_archive\u002F\u002F:zlib.h\",\n    ] + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@aws\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@com_github_googlecloudplatform_google_cloud_cpp\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Fkernels:xsmm\": [\n            \"@libxsmm_archive\u002F\u002F:LICENSE.md\",\n        ],\n        \"\u002F\u002Fconditions:default\": [],\n    }) + if_cuda([\n        \"@cub_archive\u002F\u002F:LICENSE.TXT\",\n    ]) + if_mkl([\n        \"\u002F\u002Fthird_party\u002Fmkl:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Fmkl_dnn:LICENSE\",\n    ]),\n    outs = [\"include\u002Ftensorflow\u002Fjni\u002FLICENSE\"],\n    cmd = \"$(location :concat_licenses.sh) $(SRCS) >$@\",\n    tools = [\":concat_licenses.sh\"],\n)\n\nsh_test(\n    name = \"libtensorflow_test\",\n    size = \"small\",\n    srcs = [\"libtensorflow_test.sh\"],\n    data = [\n        \"libtensorflow_test.c\",\n        \":libtensorflow.tar.gz\",\n    ],\n    # Mark as \"manual\" till\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # and https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # are resolved, otherwise these rules break when built\n    # with Python 3.\n    # Till then, this test is explicitly executed when building\n    # the release by tensorflow\u002Ftools\u002Fci_build\u002Fbuilds\u002Flibtensorflow.sh\n    tags = [\"manual\"],\n)\n\nsh_test(\n    name = \"libtensorflow_java_test\",\n    size = \"small\",\n    srcs = [\"libtensorflow_java_test.sh\"],\n    data = [\n        \":LibTensorFlowTest.java\",\n        \":libtensorflow_jni.tar.gz\",\n        \"\u002F\u002Ftensorflow\u002Fjava:libtensorflow.jar\",\n    ],\n    # Mark as \"manual\" till\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # and https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # are resolved, otherwise these rules break when built\n    # with Python 3.\n    # Till then, this test is explicitly executed when building\n    # the release by tensorflow\u002Ftools\u002Fci_build\u002Fbuilds\u002Flibtensorflow.sh\n    tags = [\"manual\"],\n)\n```\n- tensorflow\u002Ftools\u002Fpip_package\u002FBUILD\n```\n# Description:\n#  Tools for building the TensorFlow pip package.\n\npackage(default_visibility = [\"\u002F\u002Fvisibility:private\"])\n\nload(\n    \"\u002F\u002Ftensorflow:tensorflow.bzl\",\n    \"if_not_windows\",\n    \"if_windows\",\n    \"transitive_hdrs\",\n)\nload(\"\u002F\u002Fthird_party\u002Fmkl:build_defs.bzl\", \"if_mkl\", \"if_mkl_ml\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_cuda\")\nload(\"@local_config_syslibs\u002F\u002F:build_defs.bzl\", \"if_not_system_lib\")\nload(\"\u002F\u002Ftensorflow\u002Fcore:platform\u002Fdefault\u002Fbuild_config_root.bzl\", \"tf_additional_license_deps\")\nload(\n    \"\u002F\u002Fthird_party\u002Fngraph:build_defs.bzl\",\n    \"if_ngraph\",\n)\n\n# This returns a list of headers of all public header libraries (e.g.,\n# framework, lib), and all of the transitive dependencies of those\n# public headers.  Not all of the headers returned by the filegroup\n# are public (e.g., internal headers that are included by public\n# headers), but the internal headers need to be packaged in the\n# pip_package for the public headers to be properly included.\n#\n# Public headers are therefore defined by those that are both:\n#\n# 1) \"publicly visible\" as defined by bazel\n# 2) Have documentation.\n#\n# This matches the policy of \"public\" for our python API.\ntransitive_hdrs(\n    name = \"included_headers\",\n    deps = [\n        \"\u002F\u002Ftensorflow\u002Fcore:core_cpu\",\n        \"\u002F\u002Ftensorflow\u002Fcore:framework\",\n        \"\u002F\u002Ftensorflow\u002Fcore:lib\",\n        \"\u002F\u002Ftensorflow\u002Fcore:protos_all_cc\",\n        \"\u002F\u002Ftensorflow\u002Fcore:stream_executor\",\n        \"\u002F\u002Fthird_party\u002Feigen3\",\n    ] + if_cuda([\n        \"@local_config_cuda\u002F\u002Fcuda:cuda_headers\",\n    ]),\n)\n\npy_binary(\n    name = \"simple_console\",\n    srcs = [\"simple_console.py\"],\n    srcs_version = \"PY2AND3\",\n    deps = [\"\u002F\u002Ftensorflow:tensorflow_py\"],\n)\n\nCOMMON_PIP_DEPS = [\n    \":licenses\",\n    \"MANIFEST.in\",\n    \"README\",\n    \"setup.py\",\n    \":included_headers\",\n    \"\u002F\u002Ftensorflow:tensorflow_py\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fautograph:autograph\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fboosted_trees:boosted_trees_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcluster_resolver:cluster_resolver_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcompiler:xla\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fconstrained_optimization:constrained_optimization_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Feager\u002Fpython\u002Fexamples:examples_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Feager\u002Fpython:evaluator\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fgan:gan\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fgraph_editor:graph_editor_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkeras:keras\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flabeled_tensor:labeled_tensor_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnn:nn_py\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fpredictor:predictor_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fproto:proto\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Freceptive_field:receptive_field_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frate:rate\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frpc:rpc_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsession_bundle:session_bundle_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsignal:signal_py\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsignal:test_util\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fslim:slim\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fslim\u002Fpython\u002Fslim\u002Fdata:data_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fslim\u002Fpython\u002Fslim\u002Fnets:nets_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fspecs:specs\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsummary:summary_test_util\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:init_py\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest\u002Fhybrid:hybrid_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftimeseries:timeseries_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftpu\",\n    \"\u002F\u002Ftensorflow\u002Fexamples\u002Ftutorials\u002Fmnist:package\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fconverters:converters\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fcore:core\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fcore:test_lib\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fimpl:impl\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Flang:lang\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Foperators:operators\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fpyct:pyct\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fpyct\u002Ftesting:testing\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fpyct\u002Fstatic_analysis:static_analysis\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fpyct\u002Fcommon_transformers:common_transformers\",\n    \"\u002F\u002Ftensorflow\u002Fpython:cond_v2\",\n    \"\u002F\u002Ftensorflow\u002Fpython:distributed_framework_test_lib\",\n    \"\u002F\u002Ftensorflow\u002Fpython:meta_graph_testdata\",\n    \"\u002F\u002Ftensorflow\u002Fpython:spectral_ops_test_util\",\n    \"\u002F\u002Ftensorflow\u002Fpython:util_example_parser_configuration\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fdata\u002Fexperimental\u002Fkernel_tests\u002Fserialization:dataset_serialization_test_base\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fdata\u002Fexperimental\u002Fkernel_tests:stats_dataset_test_base\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fdata\u002Fkernel_tests:test_base\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fdebug:debug_pip\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Feager:eager_pip\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fkernel_tests\u002Ftestdata:self_adjoint_eig_op_test_files\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fsaved_model:saved_model\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Ftools:tools_pip\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Ftools\u002Fapi\u002Fgenerator:create_python_api\",\n    \"\u002F\u002Ftensorflow\u002Fpython:test_ops\",\n    \"\u002F\u002Ftensorflow\u002Fpython:while_v2\",\n    \"\u002F\u002Ftensorflow\u002Ftools\u002Fdist_test\u002Fserver:grpc_tensorflow_server\",\n]\n\n# On Windows, python binary is a zip file of runfiles tree.\n# Add everything to its data dependency for generating a runfiles tree\n# for building the pip package on Windows.\npy_binary(\n    name = \"simple_console_for_windows\",\n    srcs = [\"simple_console_for_windows.py\"],\n    data = COMMON_PIP_DEPS,\n    srcs_version = \"PY2AND3\",\n    deps = [\"\u002F\u002Ftensorflow:tensorflow_py\"],\n)\n\nfilegroup(\n    name = \"licenses\",\n    data = [\n        \"\u002F\u002Fthird_party\u002Feigen3:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Ffft2d:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Fhadoop:LICENSE.txt\",\n        \"@absl_py\u002F\u002Fabsl\u002Fflags:LICENSE\",\n        \"@arm_neon_2_x86_sse\u002F\u002F:LICENSE\",\n        \"@astor_archive\u002F\u002F:LICENSE\",\n        \"@boringssl\u002F\u002F:LICENSE\",\n        \"@com_google_absl\u002F\u002F:LICENSE\",\n        \"@com_googlesource_code_re2\u002F\u002F:LICENSE\",\n        \"@curl\u002F\u002F:COPYING\",\n        \"@double_conversion\u002F\u002F:LICENSE\",\n        \"@eigen_archive\u002F\u002F:COPYING.MPL2\",\n        \"@farmhash_archive\u002F\u002F:COPYING\",\n        \"@fft2d\u002F\u002F:fft\u002Freadme.txt\",\n        \"@flatbuffers\u002F\u002F:LICENSE.txt\",\n        \"@gast_archive\u002F\u002F:PKG-INFO\",\n        \"@gemmlowp\u002F\u002F:LICENSE\",\n        \"@gif_archive\u002F\u002F:COPYING\",\n        \"@highwayhash\u002F\u002F:LICENSE\",\n        \"@icu\u002F\u002F:icu4c\u002FLICENSE\",\n        \"@jpeg\u002F\u002F:LICENSE.md\",\n        \"@lmdb\u002F\u002F:LICENSE\",\n        \"@local_config_sycl\u002F\u002Fsycl:LICENSE.text\",\n        \"@nasm\u002F\u002F:LICENSE\",\n        \"@nsync\u002F\u002F:LICENSE\",\n        \"@pcre\u002F\u002F:LICENCE\",\n        \"@png_archive\u002F\u002F:LICENSE\",\n        \"@protobuf_archive\u002F\u002F:LICENSE\",\n        \"@six_archive\u002F\u002F:LICENSE\",\n        \"@snappy\u002F\u002F:COPYING\",\n        \"@swig\u002F\u002F:LICENSE\",\n        \"@termcolor_archive\u002F\u002F:COPYING.txt\",\n        \"@zlib_archive\u002F\u002F:zlib.h\",\n        \"@org_python_pypi_backports_weakref\u002F\u002F:LICENSE\",\n    ] + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@aws\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@com_github_googleapis_googleapis\u002F\u002F:LICENSE\",\n            \"@com_github_googlecloudplatform_google_cloud_cpp\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_kafka_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@kafka\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Fkernels:xsmm\": [\n            \"@libxsmm_archive\u002F\u002F:LICENSE.md\",\n        ],\n        \"\u002F\u002Fconditions:default\": [],\n    }) + if_cuda([\n        \"@cub_archive\u002F\u002F:LICENSE.TXT\",\n        \"@local_config_nccl\u002F\u002F:LICENSE\",\n    ]) + if_mkl([\n        \"\u002F\u002Fthird_party\u002Fmkl:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Fmkl_dnn:LICENSE\",\n    ]) + if_not_system_lib(\n        \"grpc\",\n        [\n            \"@grpc\u002F\u002F:LICENSE\",\n            \"@grpc\u002F\u002Fthird_party\u002Fnanopb:LICENSE.txt\",\n            \"@grpc\u002F\u002Fthird_party\u002Faddress_sorting:LICENSE\",\n        ],\n    ) + if_ngraph([\n        \"@ngraph\u002F\u002F:LICENSE\",\n        \"@ngraph_tf\u002F\u002F:LICENSE\",\n        \"@nlohmann_json_lib\u002F\u002F:LICENSE.MIT\",\n        \"@tbb\u002F\u002F:LICENSE\",\n    ]) + tf_additional_license_deps(),\n)\n\nsh_binary(\n    name = \"build_pip_package\",\n    srcs = [\"build_pip_package.sh\"],\n    data = select({\n        \"\u002F\u002Ftensorflow:windows\": [\n            \":simple_console_for_windows\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fpython:interpreter_test_data\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fpython:tflite_convert\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Ftoco\u002Fpython:toco_from_protos\",\n        ],\n        \"\u002F\u002Fconditions:default\": COMMON_PIP_DEPS + [\n            \":simple_console\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fpython:interpreter_test_data\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fpython:tflite_convert\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Ftoco\u002Fpython:toco_from_protos\",\n        ],\n    }) + if_mkl_ml([\"\u002F\u002Fthird_party\u002Fmkl:intel_binary_blob\"]),\n)\n\n# A genrule for generating a marker file for the pip package on Windows\n#\n# This only works on Windows, because :simple_console_for_windows is a\n# python zip file containing everything we need for building the pip package.\n# However, on other platforms, due to https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F4223,\n# when C++ extensions change, this generule doesn't rebuild.\ngenrule(\n    name = \"win_pip_package_marker\",\n    srcs = if_windows([\n        \":build_pip_package\",\n        \":simple_console_for_windows\",\n    ]),\n    outs = [\"win_pip_package_marker_file\"],\n    cmd = select({\n        \"\u002F\u002Fconditions:default\": \"touch $@\",\n        \"\u002F\u002Ftensorflow:windows\": \"md5sum $(locations :build_pip_package) $(locations :simple_console_for_windows) > $@\",\n    }),\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n```\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n\n$ .\u002Fconfigure\nWARNING: Processed legacy workspace file \u002Fhome\u002Fpi\u002Fwork\u002Ftensorflow\u002Ftools\u002Fbazel.rc. This file will not be processed in the next release of Bazel. Please read https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F6319 for further information, including how to upgrade.\nWARNING: Running Bazel server needs to be killed, because the startup options are different.\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.18.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\u002Farmv7l\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\u002Farmv7l]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apacha Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\nConfiguration finished\n```\n~~https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F22819~~\n~~https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fcommit\u002Fd80eb525e94763e09cbb9fa3cbef9a0f64e2cb2a~~\n~~https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fcommit\u002F5847293aeb9ab45a02c4231c40569a15bd4541c6~~\nhttps:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F23721\nhttps:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fpull\u002F25748\nhttps:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F25120#issuecomment-464296755\nhttps:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Ftree\u002Fmaster\u002Ftensorflow\u002Flite\u002Ftools\u002Fpip_package\nhttps:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F24372\nhttps:\u002F\u002Fgist.github.com\u002Ffyhertz\u002F4cef0b696b37d38964801d3ef21e8ce2\n```\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v1.13.1\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v1.13.1 - Bazel 0.19.2**\n\n============================================================\n\n**Python3.x**\n\n\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.19.2\u002FRaspbian_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\nimport sys\nimport numpy as np\n\n# pylint: disable=g-import-not-at-top\ntry:\n  from tensorflow.python.util.lazy_loader import LazyLoader\n  from tensorflow.python.util.tf_export import tf_export as _tf_export\n\n  # Lazy load since some of the performance benchmark skylark rules\n  # break dependencies. Must use double quotes to match code internal rewrite\n  # rule.\n  # pylint: disable=g-inconsistent-quotes\n  _interpreter_wrapper = LazyLoader(\n      \"_interpreter_wrapper\", globals(),\n      \"tensorflow.lite.python.interpreter_wrapper.\"\n      \"tensorflow_wrap_interpreter_wrapper\")\n  # pylint: enable=g-inconsistent-quotes\n\n  del LazyLoader\nexcept ImportError:\n  # When full Tensorflow Python PIP is not available do not use lazy load\n  # and instead uf the tflite_runtime path.\n  from tflite_runtime.lite.python import interpreter_wrapper as _interpreter_wrapper\n\n  def tf_export_dummy(*x, **kwargs):\n    del x, kwargs\n    return lambda x: x\n  _tf_export = tf_export_dummy\n\n\n@_tf_export('lite.Interpreter')\nclass Interpreter(object):\n  \"\"\"Interpreter inferace for TF-Lite Models.\"\"\"\n\n  def __init__(self, model_path=None, model_content=None):\n    \"\"\"Constructor.\n    Args:\n      model_path: Path to TF-Lite Flatbuffer file.\n      model_content: Content of model.\n    Raises:\n      ValueError: If the interpreter was unable to create.\n    \"\"\"\n    if model_path and not model_content:\n      self._interpreter = (\n          _interpreter_wrapper.InterpreterWrapper_CreateWrapperCPPFromFile(\n              model_path))\n      if not self._interpreter:\n        raise ValueError('Failed to open {}'.format(model_path))\n    elif model_content and not model_path:\n      # Take a reference, so the pointer remains valid.\n      # Since python strings are immutable then PyString_XX functions\n      # will always return the same pointer.\n      self._model_content = model_content\n      self._interpreter = (\n          _interpreter_wrapper.InterpreterWrapper_CreateWrapperCPPFromBuffer(\n              model_content))\n    elif not model_path and not model_path:\n      raise ValueError('`model_path` or `model_content` must be specified.')\n    else:\n      raise ValueError('Can\\'t both provide `model_path` and `model_content`')\n\n  def allocate_tensors(self):\n    self._ensure_safe()\n    return self._interpreter.AllocateTensors()\n\n  def _safe_to_run(self):\n    \"\"\"Returns true if there exist no numpy array buffers.\n    This means it is safe to run tflite calls that may destroy internally\n    allocated memory. This works, because in the wrapper.cc we have made\n    the numpy base be the self._interpreter.\n    \"\"\"\n    # NOTE, our tensor() call in cpp will use _interpreter as a base pointer.\n    # If this environment is the only _interpreter, then the ref count should be\n    # 2 (1 in self and 1 in temporary of sys.getrefcount).\n    return sys.getrefcount(self._interpreter) == 2\n\n  def _ensure_safe(self):\n    \"\"\"Makes sure no numpy arrays pointing to internal buffers are active.\n    This should be called from any function that will call a function on\n    _interpreter that may reallocate memory e.g. invoke(), ...\n    Raises:\n      RuntimeError: If there exist numpy objects pointing to internal memory\n        then we throw.\n    \"\"\"\n    if not self._safe_to_run():\n      raise RuntimeError(\"\"\"There is at least 1 reference to internal data\n      in the interpreter in the form of a numpy array or slice. Be sure to\n      only hold the function returned from tensor() if you are using raw\n      data access.\"\"\")\n\n  def _get_tensor_details(self, tensor_index):\n    \"\"\"Gets tensor details.\n    Args:\n      tensor_index: Tensor index of tensor to query.\n    Returns:\n      a dictionary containing the name, index, shape and type of the tensor.\n    Raises:\n      ValueError: If tensor_index is invalid.\n    \"\"\"\n    tensor_index = int(tensor_index)\n    tensor_name = self._interpreter.TensorName(tensor_index)\n    tensor_size = self._interpreter.TensorSize(tensor_index)\n    tensor_type = self._interpreter.TensorType(tensor_index)\n    tensor_quantization = self._interpreter.TensorQuantization(tensor_index)\n\n    if not tensor_name or not tensor_type:\n      raise ValueError('Could not get tensor details')\n\n    details = {\n        'name': tensor_name,\n        'index': tensor_index,\n        'shape': tensor_size,\n        'dtype': tensor_type,\n        'quantization': tensor_quantization,\n    }\n\n    return details\n\n  def get_tensor_details(self):\n    \"\"\"Gets tensor details for every tensor with valid tensor details.\n    Tensors where required information about the tensor is not found are not\n    added to the list. This includes temporary tensors without a name.\n    Returns:\n      A list of dictionaries containing tensor information.\n    \"\"\"\n    tensor_details = []\n    for idx in range(self._interpreter.NumTensors()):\n      try:\n        tensor_details.append(self._get_tensor_details(idx))\n      except ValueError:\n        pass\n    return tensor_details\n\n  def get_input_details(self):\n    \"\"\"Gets model input details.\n    Returns:\n      A list of input details.\n    \"\"\"\n    return [\n        self._get_tensor_details(i) for i in self._interpreter.InputIndices()\n    ]\n\n  def set_tensor(self, tensor_index, value):\n    \"\"\"Sets the value of the input tensor. Note this copies data in `value`.\n    If you want to avoid copying, you can use the `tensor()` function to get a\n    numpy buffer pointing to the input buffer in the tflite interpreter.\n    Args:\n      tensor_index: Tensor index of tensor to set. This value can be gotten from\n                    the 'index' field in get_input_details.\n      value: Value of tensor to set.\n    Raises:\n      ValueError: If the interpreter could not set the tensor.\n    \"\"\"\n    self._interpreter.SetTensor(tensor_index, value)\n\n  def resize_tensor_input(self, input_index, tensor_size):\n    \"\"\"Resizes an input tensor.\n    Args:\n      input_index: Tensor index of input to set. This value can be gotten from\n                   the 'index' field in get_input_details.\n      tensor_size: The tensor_shape to resize the input to.\n    Raises:\n      ValueError: If the interpreter could not resize the input tensor.\n    \"\"\"\n    self._ensure_safe()\n    # `ResizeInputTensor` now only accepts int32 numpy array as `tensor_size\n    # parameter.\n    tensor_size = np.array(tensor_size, dtype=np.int32)\n    self._interpreter.ResizeInputTensor(input_index, tensor_size)\n\n  def get_output_details(self):\n    \"\"\"Gets model output details.\n    Returns:\n      A list of output details.\n    \"\"\"\n    return [\n        self._get_tensor_details(i) for i in self._interpreter.OutputIndices()\n    ]\n\n  def get_tensor(self, tensor_index):\n    \"\"\"Gets the value of the input tensor (get a copy).\n    If you wish to avoid the copy, use `tensor()`. This function cannot be used\n    to read intermediate results.\n    Args:\n      tensor_index: Tensor index of tensor to get. This value can be gotten from\n                    the 'index' field in get_output_details.\n    Returns:\n      a numpy array.\n    \"\"\"\n    return self._interpreter.GetTensor(tensor_index)\n\n  def tensor(self, tensor_index):\n    \"\"\"Returns function that gives a numpy view of the current tensor buffer.\n    This allows reading and writing to this tensors w\u002Fo copies. This more\n    closely mirrors the C++ Interpreter class interface's tensor() member, hence\n    the name. Be careful to not hold these output references through calls\n    to `allocate_tensors()` and `invoke()`. This function cannot be used to read\n    intermediate results.\n    Usage:\n    ```\n    interpreter.allocate_tensors()\n    input = interpreter.tensor(interpreter.get_input_details()[0][\"index\"])\n    output = interpreter.tensor(interpreter.get_output_details()[0][\"index\"])\n    for i in range(10):\n      input().fill(3.)\n      interpreter.invoke()\n      print(\"inference %s\" % output())\n    ```\n    Notice how this function avoids making a numpy array directly. This is\n    because it is important to not hold actual numpy views to the data longer\n    than necessary. If you do, then the interpreter can no longer be invoked,\n    because it is possible the interpreter would resize and invalidate the\n    referenced tensors. The NumPy API doesn't allow any mutability of the\n    the underlying buffers.\n    WRONG:\n    ```\n    input = interpreter.tensor(interpreter.get_input_details()[0][\"index\"])()\n    output = interpreter.tensor(interpreter.get_output_details()[0][\"index\"])()\n    interpreter.allocate_tensors()  # This will throw RuntimeError\n    for i in range(10):\n      input.fill(3.)\n      interpreter.invoke()  # this will throw RuntimeError since input,output\n    ```\n    Args:\n      tensor_index: Tensor index of tensor to get. This value can be gotten from\n                    the 'index' field in get_output_details.\n    Returns:\n      A function that can return a new numpy array pointing to the internal\n      TFLite tensor state at any point. It is safe to hold the function forever,\n      but it is not safe to hold the numpy array forever.\n    \"\"\"\n    return lambda: self._interpreter.tensor(self._interpreter, tensor_index)\n\n  def invoke(self):\n    \"\"\"Invoke the interpreter.\n    Be sure to set the input sizes, allocate tensors and fill values before\n    calling this.\n    Raises:\n      ValueError: When the underlying interpreter fails raise ValueError.\n    \"\"\"\n    self._ensure_safe()\n    self._interpreter.Invoke()\n\n  def reset_all_variables(self):\n    return self._interpreter.ResetVariableTensors()\n\n  def set_num_threads(self, i):\n    \"\"\"Set number of threads used by TFLite kernels.\n    If not set, kernels are running single-threaded. Note that currently,\n    only some kernels, such as conv, are multithreaded.\n    Args:\n      i: number of threads.\n    \"\"\"\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - Delete the following\n```\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```\nBUILD_WITH_NNAPI=false\nifeq ($(BUILD_WITH_NNAPI),true)\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fnnapi_delegate_disabled.cc\nelse\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fnnapi_delegate.cc\nendif\n\nifeq ($(TARGET),ios)\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fminimal_logging_android.cc\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fminimal_logging_default.cc\nelse\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fminimal_logging_android.cc\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fminimal_logging_ios.cc\nendif\n```\n- configure\n```bash\n$ .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.19.2- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fhome\u002Fb920405\u002Fgit\u002Fcaffe-jacinto\u002Fpython\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fpython\u002Fpython3.5\u002Fubuntu16\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fpython\u002Fpython3.5\n  .\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fdeployment_tools\u002Fmodel_optimizer\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n    --config=mkl            # Build with MKL support.\n    --config=monolithic     # Config for mostly static monolithic build.\n    --config=gdr            # Build with GDR support.\n    --config=verbs          # Build with libverbs support.\n    --config=ngraph         # Build with Intel nGraph support.\n    --config=dynamic_kernels    # (Experimental) Build kernels into separate shared objects.\nPreconfigured Bazel build configs to DISABLE default on features:\n    --config=noaws          # Disable AWS S3 filesystem support.\n    --config=nogcp          # Disable GCP support.\n    --config=nohdfs         # Disable HDFS support.\n    --config=noignite       # Disable Apache Ignite support.\n    --config=nokafka        # Disable Apache Kafka support.\n    --config=nonccl         # Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.13.1-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-1.13.1-cp35-cp35m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v1.14.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v1.14.0 - Bazel 0.24.1 - Stretch - armhf**\n\n============================================================\n\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev openjdk-8-jdk\n\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.24.1\u002FRaspbian_Stretch_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v1.14.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.14.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - Delete the following\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- configure\n```bash\n$ .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.24.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.14.0-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-1.14.0-cp35-cp35m-linux_armv7l.whl\n```\n\n============================================================\n\n**Tensorflow v1.14.0 - Bazel 0.24.1 - Buster - armhf**\n\n============================================================\nFirst, prepare an emulation environment for armhf with QEMU 4.0.0. (CPU 4core, RAM 4GB)\n**[How to create a Debian Buster armhf OS image from scratch in hardware emulation mode of QEMU 4.0.0 (Kernel 4.19.0-5-armmp-lpae, for building Tensorflow armhf)](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fc10283a28d0699f01e01)**\n```bash\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev openjdk-11-jdk\n\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fnumpy-1.16.4-cp37-cp37m-linux_armv7l.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fh5py-2.9.0-cp37-cp37m-linux_armv7l.whl\n$ sudo pip3 install numpy-1.16.4-cp37-cp37m-linux_armv7l.whl\n$ sudo pip3 install h5py-2.9.0-cp37-cp37m-linux_armv7l.whl\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.24.1\u002FRaspbian_Buster_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v1.14.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.14.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib import checkpoint\n#if os.name != \"nt\" and platform.machine() != \"s390x\":\n#  from tensorflow.contrib import cloud\nfrom tensorflow.contrib import cluster_resolver\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib.summary import summary\n\nif os.name != \"nt\" and platform.machine() != \"s390x\":\n  try:\n    from tensorflow.contrib import cloud\n  except ImportError:\n    pass\n\nfrom tensorflow.python.util.lazy_loader import LazyLoader\nffmpeg = LazyLoader(\"ffmpeg\", globals(),\n                    \"tensorflow.contrib.ffmpeg\")\n```\n- configure\n```bash\n$ .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.24.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n```bash\n$ sudo bazel build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=4096.0,2.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.14.0-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-1.14.0-cp37-cp37m-linux_armv7l.whl\n```\n\n============================================================\n\n**Tensorflow v1.14.0 - Bazel 0.24.1 - Buster - aarch64**\n\n============================================================\n\nFirst, prepare an emulation environment for aarch64 with QEMU 4.0.0.\n**[How to create a Debian Buster aarch64 OS image from scratch in QEMU 4.0.0 hardware emulation mode (Kernel 4.19.0-5-arm64, for Tensorflow aarch64 build)](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fe117bb0389f2163e2ac8)**\n\nNext, build Bazel and Tensorflow according to the following procedure in the emulator environment.\n```bash\n$ sudo apt-get install -y \\\nlibhdf5-dev libc-ares-dev libeigen3-dev \\\nlibatlas3-base net-tools build-essential \\\nzip unzip python3-pip curl wget git zip unzip\n$ sudo pip3 install pip --upgrade\n$ sudo pip3 install zipper\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fabsl_py-0.7.1-cp37-none-any.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fgast-0.2.2-cp37-none-any.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fgrpcio-1.21.1-cp37-cp37m-linux_aarch64.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fh5py-2.9.0-cp37-cp37m-linux_aarch64.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fnumpy-1.16.4-cp37-cp37m-linux_aarch64.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fwrapt-1.11.2-cp37-cp37m-linux_aarch64.whl\n$ sudo pip3 install *.whl\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo pip3 install -U --user mock zipper wheel\n\n$ sudo apt-get update\n$ sudo apt-get remove -y openjdk-8* --purge\n$ sudo apt-get install -y openjdk-11-jdk\n\n$ cd ~\n$ mkdir bazel;cd bazel\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F0.24.1\u002Fbazel-0.24.1-dist.zip\n$ unzip bazel-0.24.1-dist.zip\n$ env EXTRA_BAZEL_ARGS=\"--host_javabase=@local_jdk\u002F\u002F:jdk\"\n\n$ nano compile.sh\n\n#################################################################################\nbazel_build \"src:bazel_nojdk${EXE_EXT}\" \\\n  --action_env=PATH \\\n  --host_platform=@bazel_tools\u002F\u002Fplatforms:host_platform \\\n  --platforms=@bazel_tools\u002F\u002Fplatforms:target_platform \\\n  || fail \"Could not build Bazel\"\n#################################################################################\n↓\n#################################################################################\nbazel_build \"src:bazel_nojdk${EXE_EXT}\" \\\n  --host_javabase=@local_jdk\u002F\u002F:jdk \\\n  --action_env=PATH \\\n  --host_platform=@bazel_tools\u002F\u002Fplatforms:host_platform \\\n  --platforms=@bazel_tools\u002F\u002Fplatforms:target_platform \\\n  || fail \"Could not build Bazel\"\n#################################################################################\n\n$ sudo bash .\u002Fcompile.sh\n$ sudo cp output\u002Fbazel \u002Fusr\u002Flocal\u002Fbin\n\n$ bazel version\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nBuild label: 0.24.1- (@non-git)\nBuild target: bazel-out\u002Faarch64-opt\u002Fbin\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Fgoogle\u002Fdevtools\u002Fbuild\u002Flib\u002Fbazel\u002FBazelServer_deploy.jar\nBuild time: Sun Jun 23 20:46:48 2019 (1561322808)\nBuild timestamp: 1561322808\nBuild timestamp as int: 1561322808\n\n$ cd ~\n$ git clone -b v1.14.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.14.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```bash\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n```bash\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```bash\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002Ftargets\u002Faarch64_makefile.inc\n**https:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F56055359\u002Ftensorflow-lite-arm64-error-cannot-convert-const-int8x8-t**\n```bash\n# Settings for generic aarch64 boards such as Odroid C2 or Pine64.\nifeq ($(TARGET),aarch64)\n  # The aarch64 architecture covers all 64-bit ARM chips. This arch mandates\n  # NEON, so FPU flags are not needed below.\n  TARGET_ARCH := armv8-a\n  TARGET_TOOLCHAIN_PREFIX := aarch64-linux-gnu-\n\n  CXXFLAGS += \\\n    -march=armv8-a \\\n    -funsafe-math-optimizations \\\n    -ftree-vectorize \\\n    -flax-vector-conversions \\\n    -fomit-frame-pointer \\\n    -fPIC\n\n  CFLAGS += \\\n    -march=armv8-a \\\n    -funsafe-math-optimizations \\\n    -ftree-vectorize \\\n    -flax-vector-conversions \\\n    -fomit-frame-pointer \\\n    -fPIC\n\n  LDFLAGS := \\\n    -Wl,--no-export-dynamic \\\n    -Wl,--exclude-libs,ALL \\\n    -Wl,--gc-sections \\\n    -Wl,--as-needed\n\n\n  LIBS := \\\n    -lstdc++ \\\n    -lpthread \\\n    -lm \\\n    -ldl \\\n    -lrt\n\nendif\n```\n- tensorflow\u002Flite\u002Fbuild_def.bzl\n**https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F26731**\n**https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fpull\u002F29515\u002Ffiles**\n```bash\n            \"\u002FDTF_COMPILE_LIBRARY\",\n            \"\u002Fwd4018\",  # -Wno-sign-compare\n        ],\n+       str(Label(\"\u002F\u002Ftensorflow:linux_aarch64\")): [\n+           \"-flax-vector-conversions\",\n+           \"-fomit-frame-pointer\",\n+       ],\n        \"\u002F\u002Fconditions:default\": [\n            \"-Wno-sign-compare\",\n        ],\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib import checkpoint\n#if os.name != \"nt\" and platform.machine() != \"s390x\":\n#  from tensorflow.contrib import cloud\nfrom tensorflow.contrib import cluster_resolver\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib.summary import summary\n\nif os.name != \"nt\" and platform.machine() != \"s390x\":\n  try:\n    from tensorflow.contrib import cloud\n  except ImportError:\n    pass\n\nfrom tensorflow.python.util.lazy_loader import LazyLoader\nffmpeg = LazyLoader(\"ffmpeg\", globals(),\n                    \"tensorflow.contrib.ffmpeg\")\n```\n```bash\n$ .\u002Fconfigure\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages]\n\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n```bash\n$ sudo bazel build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=8192.0,4.0,1.0 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-flax-vector-conversions \\\n--copt=-fomit-frame-pointer \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.14.0-cp37-cp37m-linux_aarch64.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-1.14.0-cp37-cp37m-linux_aarch64.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v1.15.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v1.15.0 - Bazel 0.26.1 - Buster - armhf**\n\n============================================================\nFirst, install openjdk-8-jdk according to the procedure of the following URL.\n**[[Stable] Install openjdk-8-jdk safely in Raspbian Buster (Debian 10) environment](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F612718c0ce4f1def6c6e)**\nNext, follow the steps below to build Tensorflow on RaspberryPi3\u002F4.\n```bash\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v1.15.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.15.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- configure\n```bash\n$ .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.26.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n```bash\n$ sudo bazel build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.15.0-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-1.15.0-cp37-cp37m-linux_armv7l.whl\n```\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0-alpha\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0-alpha - Stretch - Bazel 0.19.2**\n\n============================================================\n\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.19.2\u002FRaspbian_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-alpha0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-alpha0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - Delete the following\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib import checkpoint\n#if os.name != \"nt\" and platform.machine() != \"s390x\":\n#  from tensorflow.contrib import cloud\nfrom tensorflow.contrib import cluster_resolver\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib.summary import summary\n\nif os.name != \"nt\" and platform.machine() != \"s390x\":\n  try:\n    from tensorflow.contrib import cloud\n  except ImportError:\n    pass\n\nfrom tensorflow.python.util.lazy_loader import LazyLoader\nffmpeg = LazyLoader(\"ffmpeg\", globals(),\n                    \"tensorflow.contrib.ffmpeg\")\n```\n- configure\n```bash\n$ .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.19.2- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fhome\u002Fb920405\u002Fgit\u002Fcaffe-jacinto\u002Fpython\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fpython\u002Fpython3.5\u002Fubuntu16\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fpython\u002Fpython3.5\n  .\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fdeployment_tools\u002Fmodel_optimizer\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n    --config=mkl            # Build with MKL support.\n    --config=monolithic     # Config for mostly static monolithic build.\n    --config=gdr            # Build with GDR support.\n    --config=verbs          # Build with libverbs support.\n    --config=ngraph         # Build with Intel nGraph support.\n    --config=dynamic_kernels    # (Experimental) Build kernels into separate shared objects.\nPreconfigured Bazel build configs to DISABLE default on features:\n    --config=noaws          # Disable AWS S3 filesystem support.\n    --config=nogcp          # Disable GCP support.\n    --config=nohdfs         # Disable HDFS support.\n    --config=noignite       # Disable Apache Ignite support.\n    --config=nokafka        # Disable Apache Kafka support.\n    --config=nonccl         # Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0a0-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0a0-cp35-cp35m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0-beta0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0-beta0 - Stretch - Bazel 0.24.1**\n\n============================================================\n\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.24.1\u002FRaspbian_Stretch_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-beta0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-beta0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - Delete the following\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib import checkpoint\n#if os.name != \"nt\" and platform.machine() != \"s390x\":\n#  from tensorflow.contrib import cloud\nfrom tensorflow.contrib import cluster_resolver\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib.summary import summary\n\nif os.name != \"nt\" and platform.machine() != \"s390x\":\n  try:\n    from tensorflow.contrib import cloud\n  except ImportError:\n    pass\n\nfrom tensorflow.python.util.lazy_loader import LazyLoader\nffmpeg = LazyLoader(\"ffmpeg\", globals(),\n                    \"tensorflow.contrib.ffmpeg\")\n```\n- configure\n```bash\n$ .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.24.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0b0-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0b0-cp35-cp35m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0-beta1\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0-beta1 - Stretch - Bazel 0.24.1**\n\n============================================================\n\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.24.1\u002FRaspbian_Stretch_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-beta1 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-beta1\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - Delete the following\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib import checkpoint\n#if os.name != \"nt\" and platform.machine() != \"s390x\":\n#  from tensorflow.contrib import cloud\nfrom tensorflow.contrib import cluster_resolver\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib.summary import summary\n\nif os.name != \"nt\" and platform.machine() != \"s390x\":\n  try:\n    from tensorflow.contrib import cloud\n  except ImportError:\n    pass\n\nfrom tensorflow.python.util.lazy_loader import LazyLoader\nffmpeg = LazyLoader(\"ffmpeg\", globals(),\n                    \"tensorflow.contrib.ffmpeg\")\n```\n- configure\n```bash\n$ .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.24.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0b1-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0b1-cp35-cp35m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0-rc0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0-rc0 - Buster - Bazel 0.26.1**\n\n============================================================\nFirst, install openjdk-8-jdk according to the procedure of the following URL.\n**[How to install openjdk-8-jdk on Raspbian Buster armhf](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fa6ae8e04d382493ef369)**\nor\n**[How to install openjdk-8-jdk on Debian Buster (Debian 10) armhf](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F5445c5e899f68d928f0d)**\nNext, follow the steps below to build Tensorflow on RaspberryPi3.\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-rc0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-rc0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - Delete the following\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- configure\n```bash\n$ .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.26.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.7\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\n\t--config=v2             # Build Tensorflow 2.x instead of 1.x\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0rc0-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0rc0-cp37-cp37m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0-rc1\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0-rc1 - Buster - Bazel 0.26.1**\n\n============================================================\nFirst, install openjdk-8-jdk according to the procedure of the following URL.\n**[How to install openjdk-8-jdk on Raspbian Buster armhf](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fa6ae8e04d382493ef369)**\nor\n**[How to install openjdk-8-jdk on Debian Buster (Debian 10) armhf](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F5445c5e899f68d928f0d)**\nNext, follow the steps below to build Tensorflow on RaspberryPi3.\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-rc1 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-rc1\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - Delete the following\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- configure\n```bash\n$ .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.26.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.7\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\n\t--config=v2             # Build Tensorflow 2.x instead of 1.x\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0rc1-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0rc1-cp37-cp37m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0-rc2\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0-rc2 - Buster - Bazel 0.26.1**\n\n============================================================\nFirst, install openjdk-8-jdk according to the procedure of the following URL.\n**[How to install openjdk-8-jdk on Raspbian Buster armhf](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fa6ae8e04d382493ef369)**\nor\n**[How to install openjdk-8-jdk on Debian Buster (Debian 10) armhf](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F5445c5e899f68d928f0d)**\nNext, follow the steps below to build Tensorflow on RaspberryPi3.\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-rc2 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-rc2\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - Delete the following\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- configure\n```bash\n$ .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.26.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.7\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\n\t--config=v2             # Build Tensorflow 2.x instead of 1.x\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0rc2-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0rc2-cp37-cp37m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0 - Stretch - Bazel 0.26.1**\n\n============================================================\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev openjdk-8-jdk\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Flite\u002Fexperimental\u002Fruy\u002Fpack_arm.cc - Line 1292\n```bash\n\"mov r0, 0\\n\"\n  ↓\n\"mov r0, #0\\n\"\n```\n\n- configure\n```bash\n$ sudo .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.26.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.7\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\n\t--config=v2             # Build Tensorflow 2.x instead of 1.x\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0-cp35-cp35m-linux_armv7l.whl\n```\n\n============================================================\n\n**Tensorflow v2.0.0 - Buster - Bazel 0.26.1**\n\n============================================================\nFirst, install openjdk-8-jdk according to the procedure of the following URL.\n**[[Stable] Install openjdk-8-jdk safely in Raspbian Buster (Debian 10) environment](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F612718c0ce4f1def6c6e)**\nNext, follow the steps below to build Tensorflow on RaspberryPi3\u002F4.\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# Add the following two lines to the last line\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F Corrected the vicinity of the last line as follows\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F should be the interpreter object providing the memory.\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F Helper function to construct an `InterpreterWrapper` object.\n  \u002F\u002F It only returns InterpreterWrapper if it can construct an `Interpreter`.\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Flite\u002Fexperimental\u002Fruy\u002Fpack_arm.cc - Line 1292\n```bash\n\"mov r0, 0\\n\"\n  ↓\n\"mov r0, #0\\n\"\n```\n- configure\n```bash\n$ sudo .\u002Fconfigure\nExtracting Bazel installation...\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.26.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.7\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native -Wno-sign-compare]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\n\t--config=numa        \t# Build with NUMA support.\n\t--config=dynamic_kernels\t# (Experimental) Build kernels into separate shared objects.\n\t--config=v2             # Build Tensorflow 2.x instead of 1.x\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apache Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\n\t--config=nonccl      \t# Disable NVIDIA NCCL support.\nConfiguration finished\n```\n- build\n\n(1) RaspberryPi3\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n(2) RaspberryPi4\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0-cp37-cp37m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.1.0-rc0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.1.0-rc0 - Buster - Bazel 0.29.1**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.1.0-rc1\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.1.0-rc1 - Buster - Bazel 0.29.1**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.1.0-rc2\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.1.0-rc2 - Buster - Bazel 0.29.1**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.1.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.1.0 - Ubuntu 19.10 aarch64 - Bazel 0.29.1**\n\n============================================================\n\n**[Update grpc dependency for glibc 2.30 compatibility](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F33758)**\n\n```bash\n$ curl -L https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fcompare\u002Fmaster...hi-ogawa:grpc-backport-pr-18950.patch | git apply\n\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.1.0 - Buster - Bazel 0.29.1**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.2.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.2.0 - Buster - Bazel 2.0.0**\n\n============================================================\n\n```bash\n$ sudo nano .tf_configure.bazelrc\n\nbuild --action_env PYTHON_BIN_PATH=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --action_env PYTHON_LIB_PATH=\"\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\"\nbuild --python_path=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --config=xla\nbuild:opt --copt=-march=native\nbuild:opt --copt=-Wno-sign-compare\nbuild:opt --host_copt=-march=native\nbuild:opt --define with_default_optimizations=true\ntest --flaky_test_attempts=3\ntest --test_size_filters=small,medium\ntest:v1 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial\ntest:v1 --build_tag_filters=-benchmark-test,-no_oss,-gpu\ntest:v2 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial,-v1only\ntest:v2 --build_tag_filters=-benchmark-test,-no_oss,-gpu,-v1only\nbuild --action_env TF_CONFIGURE_IOS=\"0\"\n\n↓\n\nbuild --action_env PYTHON_BIN_PATH=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --action_env PYTHON_LIB_PATH=\"\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\"\nbuild --python_path=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild:opt --copt=-march=native\nbuild:opt --copt=-Wno-sign-compare\nbuild:opt --host_copt=-march=native\nbuild:opt --define with_default_optimizations=true\ntest --flaky_test_attempts=3\ntest --test_size_filters=small,medium\ntest:v1 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial\ntest:v1 --build_tag_filters=-benchmark-test,-no_oss,-gpu\ntest:v2 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial,-v1only\ntest:v2 --build_tag_filters=-benchmark-test,-no_oss,-gpu,-v1only\nbuild --action_env TF_CONFIGURE_IOS=\"0\"\nbuild --action_env TF_ENABLE_XLA=\"0\"\nbuild --define with_xla_support=false\n```\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,2.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.2.0 - Ubuntu 19.10 aarch64 - Bazel 2.0.0**\n\n============================================================\n\n```bash\n$ nano tensorflow\u002Fthird_party\u002Fpy\u002Fpython_configure.bzl\n\ndef _get_python_include(repository_ctx, python_bin):\n    \"\"\"Gets the python include path.\"\"\"\n    result = execute(\n        repository_ctx,\n        [\n            python_bin,\n\n↓\n\ndef _get_python_include(repository_ctx, python_bin):\n    \"\"\"Gets the python include path.\"\"\"\n    result = execute(\n        repository_ctx,\n        [\n            \"python3\",\n\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.3.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.3.0-rc0 - Buster - Bazel 3.1.0**\n\n============================================================\n\n```bash\n$ sudo nano .tf_configure.bazelrc\n\nbuild --action_env PYTHON_BIN_PATH=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --action_env PYTHON_LIB_PATH=\"\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\"\nbuild --python_path=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --config=xla\nbuild:opt --copt=-march=native\nbuild:opt --copt=-Wno-sign-compare\nbuild:opt --host_copt=-march=native\nbuild:opt --define with_default_optimizations=true\ntest --flaky_test_attempts=3\ntest --test_size_filters=small,medium\ntest:v1 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial\ntest:v1 --build_tag_filters=-benchmark-test,-no_oss,-gpu\ntest:v2 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial,-v1only\ntest:v2 --build_tag_filters=-benchmark-test,-no_oss,-gpu,-v1only\nbuild --action_env TF_CONFIGURE_IOS=\"0\"\n\n↓\n\nbuild --action_env PYTHON_BIN_PATH=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --action_env PYTHON_LIB_PATH=\"\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\"\nbuild --python_path=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild:opt --copt=-march=native\nbuild:opt --copt=-Wno-sign-compare\nbuild:opt --host_copt=-march=native\nbuild:opt --define with_default_optimizations=true\ntest --flaky_test_attempts=3\ntest --test_size_filters=small,medium\ntest:v1 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial\ntest:v1 --build_tag_filters=-benchmark-test,-no_oss,-gpu\ntest:v2 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial,-v1only\ntest:v2 --build_tag_filters=-benchmark-test,-no_oss,-gpu,-v1only\nbuild --action_env TF_CONFIGURE_IOS=\"0\"\nbuild --action_env TF_ENABLE_XLA=\"0\"\nbuild --define with_xla_support=false\n```\n\n```bash\n$ wget https:\u002F\u002Fgitlab.com\u002Flibeigen\u002Feigen\u002F-\u002Farchive\u002F386d809bde475c65b7940f290efe80e6a05878c4\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\n$ nano tensorflow\u002Fworkspace.bzl\n\n    tf_http_archive(\n        name = \"eigen_archive\",\n        build_file = clean_dep(\"\u002F\u002Fthird_party:eigen.BUILD\"),\n        patch_file = clean_dep(\"\u002F\u002Fthird_party\u002Feigen3:gpu_packet_math.patch\"),\n        sha256 = \"f632d82e43ffc46adfac9043beace700b0265748075e7edc0701d81380258038\",  # SHARED_EIGEN_SHA\n        strip_prefix = \"eigen-386d809bde475c65b7940f290efe80e6a05878c4\",\n        urls = [\n            \"https:\u002F\u002Fstorage.googleapis.com\u002Fmirror.tensorflow.org\u002Fgitlab.com\u002Flibeigen\u002Feigen\u002F-\u002Farchive\u002F386d809bde475c65b7940f290efe80e6a05878c4\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\",\n            \"https:\u002F\u002Fgitlab.com\u002Flibeigen\u002Feigen\u002F-\u002Farchive\u002F386d809bde475c65b7940f290efe80e6a05878c4\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\",\n        ],\n    )\n↓\n    tf_http_archive(\n        name = \"eigen_archive\",\n        build_file = clean_dep(\"\u002F\u002Fthird_party:eigen.BUILD\"),\n        patch_file = clean_dep(\"\u002F\u002Fthird_party\u002Feigen3:gpu_packet_math.patch\"),\n        sha256 = \"f632d82e43ffc46adfac9043beace700b0265748075e7edc0701d81380258038\",  # SHARED_EIGEN_SHA\n        strip_prefix = \"eigen-386d809bde475c65b7940f290efe80e6a05878c4\",\n        urls = [\n\t    \"file:\u002F\u002F\u002Fhome\u002Fpi\u002Ftensorflow\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\",\n            \"https:\u002F\u002Fstorage.googleapis.com\u002Fmirror.tensorflow.org\u002Fgitlab.com\u002Flibeigen\u002Feigen\u002F-\u002Farchive\u002F386d809bde475c65b7940f290efe80e6a05878c4\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\",\n            \"https:\u002F\u002Fgitlab.com\u002Flibeigen\u002Feigen\u002F-\u002Farchive\u002F386d809bde475c65b7940f290efe80e6a05878c4\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\",\n        ],\n    )\n```\n\n```bash\n$ nano tensorflow\u002Fthird_party\u002Fruy\u002Fworkspace.bzl\n\ndef repo():\n    third_party_http_archive(\n        name = \"ruy\",\n        sha256 = \"8fd4adeeff4f29796bf7cdda64806ec0495a2435361569f02afe3fe33406f07c\",\n        strip_prefix = \"ruy-34ea9f4993955fa1ff4eb58e504421806b7f2e8f\",\n        urls = [\n            \"https:\u002F\u002Fstorage.googleapis.com\u002Fmirror.tensorflow.org\u002Fgithub.com\u002Fgoogle\u002Fruy\u002Farchive\u002F34ea9f4993955fa1ff4eb58e504421806b7f2e8f.zip\",\n            \"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fruy\u002Farchive\u002F34ea9f4993955fa1ff4eb58e504421806b7f2e8f.zip\",\n        ],\n        build_file = \"\u002F\u002Fthird_party\u002Fruy:BUILD\",\n    )\n\n↓\n\ndef repo():\n    third_party_http_archive(\n        name = \"ruy\",\n        sha256 = \"89b8b56b4e1db894e75a0abed8f69757b37c23dde6e64bfb186656197771138a\",\n        strip_prefix = \"ruy-388ffd28ba00ffb9aacbe538225165c02ea33ee3\",\n        urls = [\n            \"https:\u002F\u002Fstorage.googleapis.com\u002Fmirror.tensorflow.org\u002Fgithub.com\u002Fgoogle\u002Fruy\u002Farchive\u002F388ffd28ba00ffb9aacbe538225165c02ea33ee3.zip\",\n            \"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fruy\u002Farchive\u002F388ffd28ba00ffb9aacbe538225165c02ea33ee3.zip\",\n        ],\n        build_file = \"\u002F\u002Fthird_party\u002Fruy:BUILD\",\n    )\n```\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_ram_resources=4096 \\\n--local_cpu_resources=2 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n--linkopt=-Wl,-latomic \\\n--host_linkopt=-Wl,-latomic \\\n--define=tensorflow_mkldnn_contraction_kernel=0 \\\n--define=raspberry_pi_with_neon=true \\\n--define=tflite_pip_with_flex=true \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.3.0-rc0 - Debian Buster aarch64 - Bazel 3.1.0**\n\n============================================================\n\n```bash\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--local_ram_resources=30720 \\\n--local_cpu_resources=10 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.4.0\u003C\u002Fsummary>\u003Cdiv>\n\n- **tensorflow\u002Ftensorflow\u002Flite\u002Fkernels\u002FBUILD**\n```bash\ncc_library(\n    name = \"builtin_op_kernels\",\n    srcs = BUILTIN_KERNEL_SRCS + [\n        \"max_pool_argmax.cc\",\n        \"max_unpooling.cc\",\n        \"transpose_conv_bias.cc\",\n    ],\n    hdrs = [\n        \"dequantize.h\",\n        \"max_pool_argmax.h\",\n        \"max_unpooling.h\",\n        \"transpose_conv_bias.h\",\n    ],\n    compatible_with = get_compatible_with_portable(),\n    copts = tflite_copts() + tf_opts_nortti_if_android() + EXTRA_EIGEN_COPTS,\n    visibility = [\"\u002F\u002Fvisibility:private\"],\n    deps = BUILTIN_KERNEL_DEPS + [\n        \"@ruy\u002F\u002Fruy\u002Fprofiler:instrumentation\",\n        \"\u002F\u002Ftensorflow\u002Flite\u002Fkernels\u002Finternal:cppmath\",\n        \"\u002F\u002Ftensorflow\u002Flite:string\",\n        \"@farmhash_archive\u002F\u002F:farmhash\",\n    ],\n)\n```\n```bash\n$ sudo pip3 install gdown\n$ cd tensorflow\u002Ftensorflow\u002Flite\u002Fkernels\n$ sudo gdown --id 17qEXPvo5l72j4O5qEcSoLcmJAthaqSws\n$ tar -zxvf kernels.tar.gz && rm kernels.tar.gz -f\n$ cd ..\u002F..\u002F..\n```\n\n============================================================\n\n**Tensorflow v2.4.0 - Buster - Bazel 3.1.0**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_ram_resources=4096 \\\n--local_cpu_resources=2 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n--linkopt=-Wl,-latomic \\\n--host_linkopt=-Wl,-latomic \\\n--define=tensorflow_mkldnn_contraction_kernel=0 \\\n--define=raspberry_pi_with_neon=true \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.4.0 - Debian Buster aarch64 - Bazel 3.1.0**\n\n============================================================\n\n```bash\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--local_ram_resources=30720 \\\n--local_cpu_resources=10 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.4.0-cp37-cp37m-linux_arm7l.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.5.0\u003C\u002Fsummary>\u003Cdiv>\n\n- **tensorflow\u002Ftensorflow\u002Flite\u002Fkernels\u002FBUILD**\nAdd a custom kernel for MediaPipe.\n```bash\ncc_library(\n    name = \"builtin_op_kernels\",\n    srcs = BUILTIN_KERNEL_SRCS + [\n        \"max_pool_argmax.cc\",\n        \"max_unpooling.cc\",\n        \"transpose_conv_bias.cc\",\n    ],\n    hdrs = [\n        \"dequantize.h\",\n        \"max_pool_argmax.h\",\n        \"max_unpooling.h\",\n        \"transpose_conv_bias.h\",\n    ],\n    compatible_with = get_compatible_with_portable(),\n    copts = tflite_copts() + tf_opts_nortti_if_android() + EXTRA_EIGEN_COPTS,\n    visibility = [\"\u002F\u002Fvisibility:private\"],\n    deps = BUILTIN_KERNEL_DEPS + [\n        \"@ruy\u002F\u002Fruy\u002Fprofiler:instrumentation\",\n        \"\u002F\u002Ftensorflow\u002Flite\u002Fkernels\u002Finternal:cppmath\",\n        \"\u002F\u002Ftensorflow\u002Flite:string\",\n        \"@farmhash_archive\u002F\u002F:farmhash\",\n    ],\n)\n```\n```bash\n$ sudo pip3 install gdown h5py==3.1.0\n$ cd tensorflow\u002Flite\u002Fkernels\n$ sudo gdown --id 1fuB2m7B_-3u7-kxuNcALUp9wkrHsfCQB\n$ tar -zxvf kernels.tar.gz && rm kernels.tar.gz -f\n$ cd ..\u002F..\u002F..\n$ sudo bazel clean --expunge\n```\n\n============================================================\n\n**Tensorflow v2.5.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**Native Build**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_ram_resources=4096 \\\n--local_cpu_resources=2 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n--linkopt=-Wl,-latomic \\\n--host_linkopt=-Wl,-latomic \\\n--define=tensorflow_mkldnn_contraction_kernel=0 \\\n--define=raspberry_pi_with_neon=true \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.5.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**Cross-compilation by x86 host**\n\n============================================================\n\n```bash\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002Ftensorflow-on-arm.git && \\\n  cd tensorflow-on-arm\u002Fbuild_tensorflow\n$ docker build -t tf-arm -f Dockerfile .\n$ docker run -it --rm \\\n  -v \u002Ftmp\u002Ftensorflow_pkg\u002F:\u002Ftmp\u002Ftensorflow_pkg\u002F \\\n  --env TF_PYTHON_VERSION=3.7 \\\n  tf-arm .\u002Fbuild_tensorflow.sh configs\u002Frpi.conf\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.5.0-cp37-none-linux_armv7l.whl .\n$ sudo chmod 777 tensorflow-2.5.0-cp37-none-linux_armv7l.whl\n```\n\n============================================================\n\n**Tensorflow v2.5.0 - Debian Buster aarch64 - Bazel 3.7.2**\n**Using EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.5.0-cp37-cp37m-linux_arm7l.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.6.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install libhdf5-dev && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.0 --no-deps && \\\nsudo pip3 install gdown h5py==3.1.0 && \\\nsudo pip3 install pybind11 && \\\npip3 install -U --user six wheel mock\n```\n- Apply customization to add custom operations for MediaPipe. (max_pool_argmax, max_unpooling, transpose_conv_bias)\n```bash\ncd tensorflow\u002Flite\u002Fkernels\nsudo gdown --id 124YrrMZjj_lZxVnpxePs-F69i0xz7Qru\ntar -zxvf kernels.tar.gz && rm kernels.tar.gz -f\ncd ..\u002F..\u002F..\n```\n- Apply multi-threading support for XNNPACK.\n```bash\n# interpreter.py\ncd tensorflow\u002Flite\u002Fpython\nsudo gdown --id 1LuEW11VLhR4gO1RPlymELDvXBFqU7WSK\ncd ..\u002F..\u002F..\n# interpreter_wrapper.cc, interpreter_wrapper.h, interpreter_wrapper_pybind11.cc\ncd tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\nsudo gdown --id 1zTO0z6Pe_a6RJxw7N_3gyqhFxGunFK-y\ntar -zxvf interpreter_wrapper.tar.gz && rm interpreter_wrapper.tar.gz -f\ncd ..\u002F..\u002F..\u002F..\n```\n\n============================================================\n\n**Tensorflow v2.6.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**Native Build**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_ram_resources=4096 \\\n--local_cpu_resources=2 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n--linkopt=-Wl,-latomic \\\n--host_linkopt=-Wl,-latomic \\\n--define=tensorflow_mkldnn_contraction_kernel=0 \\\n--define=raspberry_pi_with_neon=true \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.6.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**Cross-compilation by x86 host**\n\n============================================================\n\n```bash\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002Ftensorflow-on-arm.git && \\\n  cd tensorflow-on-arm\u002Fbuild_tensorflow\n$ docker build -t tf-arm -f Dockerfile .\n$ docker run -it --rm \\\n  -v \u002Ftmp\u002Ftensorflow_pkg\u002F:\u002Ftmp\u002Ftensorflow_pkg\u002F \\\n  --env TF_PYTHON_VERSION=3.7 \\\n  tf-arm .\u002Fbuild_tensorflow.sh configs\u002Frpi.conf\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.6.0-cp37-none-linux_armv7l.whl .\n$ sudo chmod 777 tensorflow-2.6.0-cp37-none-linux_armv7l.whl\n```\n\n============================================================\n\n**Tensorflow v2.6.0 - Debian Buster aarch64 - Bazel 3.7.2**\n**Using EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.6.0 - CUDA x86_64 - Bazel 3.7.2**\n\n============================================================\n\n`supports compute capabilities >= 3.5 [Default is: 3.5,7.0]: 5.3,6.1,6.2,7.2,7.5,8.6`\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.6.0-cp37-cp37m-linux_arm7l.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.7.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install libhdf5-dev && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.1.0 && \\\nsudo pip3 install pybind11 && \\\npip3 install -U --user six wheel mock\n```\n- Apply customization to add custom operations for MediaPipe. (max_pool_argmax, max_unpooling, transpose_conv_bias)\n```bash\ncd tensorflow\u002Flite\u002Fkernels\nsudo gdown --id 1Az4hEvLXAb71e52gBORQz87Z0FExUz2B\ntar -zxvf kernels.tar.gz && rm kernels.tar.gz -f\ncd ..\u002F..\u002F..\n```\n- Apply multi-threading support for XNNPACK (Python).\n```bash\n# interpreter_wrapper.cc\nsudo gdown --id 1iNc8qC1y5CJdMWCcTXhl6SiDQg3M1DRv\ngit apply xnnpack_python.patch\n```\n\n============================================================\n\n**Tensorflow v2.7.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**Native Build**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_ram_resources=4096 \\\n--local_cpu_resources=2 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n--linkopt=-Wl,-latomic \\\n--host_linkopt=-Wl,-latomic \\\n--define=tensorflow_mkldnn_contraction_kernel=0 \\\n--define=raspberry_pi_with_neon=true \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.7.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**Cross-compilation by x86 host**\n\n============================================================\n\n```bash\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002Ftensorflow-on-arm.git && \\\n  cd tensorflow-on-arm\u002Fbuild_tensorflow\n$ docker build -t tf-arm -f Dockerfile .\n$ docker run -it --rm \\\n  -v \u002Ftmp\u002Ftensorflow_pkg\u002F:\u002Ftmp\u002Ftensorflow_pkg\u002F \\\n  --env TF_PYTHON_VERSION=3.7 \\\n  tf-arm .\u002Fbuild_tensorflow.sh configs\u002Frpi.conf\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.7.0-cp37-none-linux_armv7l.whl .\n$ sudo chmod 777 tensorflow-2.7.0-cp37-none-linux_armv7l.whl\n```\n\n============================================================\n\n**Tensorflow v2.7.0 - Debian Buster aarch64 - Bazel 3.7.2**\n**Using EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.7.0 - CUDA11.4 - TensorRT8.2 - x86_64 - Bazel 3.7.2**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ cp tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInfer_8_0.inc tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInfer_8_2.inc \\\n&& sed -i '62a #elif NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR == 2' tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002Fnvinfer_stub.cc \\\n&& sed -i '63a #include \"tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInfer_8_2.inc\"' tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002Fnvinfer_stub.cc \\\n&& cp tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInferPlugin_8_0.inc tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInferPlugin_8_2.inc \\\n&& sed -i '62a #elif NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR == 2' tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002Fnvinfer_plugin_stub.cc \\\n&& sed -i '63a #include \"tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInferPlugin_8_2.inc\"' tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002Fnvinfer_plugin_stub.cc\n\n$ .\u002Fconfigure\n\nsupports compute capabilities >= 3.5 [Default is: 3.5,7.0]: 6.1,7.5,8.6\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.7.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.8.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install libhdf5-dev && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.1.0 && \\\nsudo pip3 install pybind11 && \\\npip3 install -U --user six wheel mock\n```\n- Apply customization to add custom operations for MediaPipe. (max_pool_argmax, max_unpooling, transpose_conv_bias)\n```bash\ncd tensorflow\u002Flite\u002Fkernels\nsudo gdown --id 1qTVQ9qnbvzxxWm-1mGGkO7NRB9Rd_Uht\ntar -zxvf kernels.tar.gz && rm kernels.tar.gz -f\ncd ..\u002F..\u002F..\n```\n\n============================================================\n\n**Tensorflow v2.8.0 - Debian Bullseye aarch64 - Bazel 4.2.1**\n**Using EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.8.0 - CUDA11.4 - TensorRT8.2 - x86_64 - Bazel 4.2.1**\n\n============================================================\n\n```bash\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F4.2.1\u002Fbazel-4.2.1-installer-linux-x86_64.sh\n$ sudo chmod +x bazel-4.2.1-installer-linux-x86_64.sh && sudo .\u002Fbazel-4.2.1-installer-linux-x86_64.sh\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n\nsupports compute capabilities >= 3.5 [Default is: 3.5,7.0]: 6.1,7.5,8.6\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.8.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.9.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y libhdf5-dev unzip pkg-config python3-pip cmake make python-is-python3 && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.6.0 && \\\nsudo pip3 install pybind11==2.9.2 && \\\nsudo pip3 install packaging && \\\npip3 install -U --user six wheel mock\n```\n- Apply customization to add custom operations for MediaPipe. (max_pool_argmax, max_unpooling, transpose_conv_bias, TransformLandmarks, TransformTensorBilinear, Landmarks2TransformMatrix)\n```bash\n$ curl -OL https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin\u002Freleases\u002Fdownload\u002Fv2.9.0\u002Fmediapipe_customop_patch.zip \\\n&& unzip -d mediapipe_customop_patch mediapipe_customop_patch.zip \\\n&& git apply mediapipe_customop_patch\u002F*\n```\n\n============================================================\n\n**Tensorflow v2.9.0 - Debian Bullseye aarch64 - Bazel 5.0.0**\n**Using EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ wget -O bazel https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.0.0\u002Fbazel-5.0.0-linux-arm64 \\\n&& sudo chmod 777 bazel \\\n&& sudo cp bazel \u002Fusr\u002Flocal\u002Fbin \\\n&& sudo bazel clean --expunge \\\n&& .\u002Fconfigure\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.9.0 - CUDA11.6 - TensorRT8.4 - x86_64 - Bazel 5.0.0**\n\n============================================================\n\n```bash\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.0.0\u002Fbazel-5.0.0-installer-linux-x86_64.sh \\\n&& sudo chmod +x bazel-5.0.0-installer-linux-x86_64.sh \\\n&& sudo .\u002Fbazel-5.0.0-installer-linux-x86_64.sh \\\n&& sudo bazel clean --expunge\n&& .\u002Fconfigure\n\nsupports compute capabilities >= 3.5 [Default is: 3.5,7.0]: 6.1,7.5,8.6\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.9.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.10.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n  libhdf5-dev unzip pkg-config python3-pip \\\n  cmake make python-is-python3 && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install numpy==1.23.2 && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.6.0 && \\\nsudo pip3 install pybind11==2.9.2 && \\\nsudo pip3 install packaging && \\\npip3 install -U --user six wheel mock\n```\n- Apply customization to add custom operations for MediaPipe. (max_pool_argmax, max_unpooling, transpose_conv_bias, TransformLandmarks, TransformTensorBilinear, Landmarks2TransformMatrix)\n```bash\n$ curl -OL https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin\u002Freleases\u002Fdownload\u002Fv2.10.0\u002Fmediapipe_customop_patch.zip \\\n&& unzip -d mediapipe_customop_patch mediapipe_customop_patch.zip \\\n&& git apply mediapipe_customop_patch\u002F*\n```\n\n============================================================\n\n**Tensorflow v2.10.0 - Debian Bullseye aarch64 - Bazel 5.1.1**\n**Using EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ wget -O bazel https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.1.1\u002Fbazel-5.1.1-linux-arm64 \\\n&& sudo chmod 777 bazel \\\n&& sudo cp bazel \u002Fusr\u002Flocal\u002Fbin \\\n&& sudo bazel clean --expunge \\\n&& .\u002Fconfigure\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.10.0 - CUDA11.7 - TensorRT8.4.3 - x86_64 - Bazel 5.1.1**\n\n============================================================\n\n```bash\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.1.1\u002Fbazel-5.1.1-installer-linux-x86_64.sh \\\n&& sudo chmod +x bazel-5.1.1-installer-linux-x86_64.sh \\\n&& sudo .\u002Fbazel-5.1.1-installer-linux-x86_64.sh \\\n&& sudo bazel clean --expunge\n&& .\u002Fconfigure\n\nsupports compute capabilities >= 3.5 [Default is: 3.5,7.0]: 6.1,7.5,8.6\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.10.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>＜INVALID＞ Tensorflow v2.11.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n  libhdf5-dev unzip pkg-config python3-pip \\\n  cmake make python-is-python3 && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install numpy==1.23.4 && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.6.0 && \\\nsudo pip3 install pybind11==2.9.2 && \\\nsudo pip3 install packaging && \\\npip3 install -U --user six wheel mock\n```\n- Apply customization to add custom operations for MediaPipe. (max_pool_argmax, max_unpooling, transpose_conv_bias, TransformLandmarks, TransformTensorBilinear, Landmarks2TransformMatrix)\n```bash\n$ curl -OL https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin\u002Freleases\u002Fdownload\u002Fv2.11.0\u002Fmediapipe_customop_patch.zip \\\n&& unzip -d mediapipe_customop_patch mediapipe_customop_patch.zip \\\n&& git apply mediapipe_customop_patch\u002F*\n```\n\n============================================================\n\n**Tensorflow v2.11.0 - Debian Bullseye aarch64 - Bazel 5.3.0**\n**Using EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ wget -O bazel https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.3.0\u002Fbazel-5.3.0-linux-arm64 \\\n&& sudo chmod 777 bazel \\\n&& sudo cp bazel \u002Fusr\u002Flocal\u002Fbin \\\n&& sudo bazel clean --expunge \\\n&& .\u002Fconfigure\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.11.0 - CUDA11.7 - TensorRT8.4.3 - x86_64 - Bazel 5.3.0**\n\n============================================================\n\n```bash\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.3.0\u002Fbazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo chmod +x bazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo .\u002Fbazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo bazel clean --expunge\n&& .\u002Fconfigure\n\nsupports compute capabilities >= 3.5 [Default is: 3.5,7.0]: 6.1,7.5,8.6\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.11.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.12.0 https:\u002F\u002Fzenn.dev\u002Fpinto0309\u002Fscraps\u002Fa735fde5301bdc\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n  libhdf5-dev unzip pkg-config python3-pip \\\n  cmake make python-is-python3 wget && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install numpy==1.24.2 && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.6.0 && \\\nsudo pip3 install pybind11==2.9.2 && \\\nsudo pip3 install packaging && \\\nsudo pip3 install protobuf==3.20.3 && \\\npip3 install -U --user six wheel mock\n\n$ sed -i '15a #include \u003Cassert.h>' tensorflow\u002Ftsl\u002Fframework\u002Ffixedpoint\u002FMatMatProductAVX2.h\n```\n\n============================================================\n\n**Tensorflow v2.12.0 - Debian 11\u002FDebian 12\u002FUbuntu 20.04\u002F22.04 aarch64 - Bazel 5.3.0**\n**Using EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ wget -O bazel https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.3.0\u002Fbazel-5.3.0-linux-arm64 \\\n&& sudo chmod 777 bazel \\\n&& sudo cp bazel \u002Fusr\u002Flocal\u002Fbin \\\n&& sudo bazel clean --expunge \\\n&& .\u002Fconfigure\n\n$ sudo bazel build \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_with_xnnpack=true \\\n--copt=\"-Wno-stringop-overflow\" \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**＜INVALID＞ Tensorflow v2.12.0 - CUDA11.7 - TensorRT8.4.3 - x86_64 - Bazel 5.3.0**\n\n============================================================\n\n```bash\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.3.0\u002Fbazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo chmod +x bazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo .\u002Fbazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo bazel clean --expunge\n&& .\u002Fconfigure\n\n# https:\u002F\u002Fdeveloper.nvidia.com\u002Fcuda-gpus\nsupports compute capabilities >= 3.5 [Default is: 3.5,7.0]: 8.6\n\n$ sudo bazel build \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_with_xnnpack=true \\\n--define=with_xla_support=false \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.12.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.15.0\u003C\u002Fsummary>\u003Cdiv>\n\n```bash\n# Bullseye, Ubuntu22.04\nsudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n    libhdf5-dev \\\n    unzip \\\n    pkg-config \\\n    python3-pip \\\n    cmake \\\n    make \\\n    git \\\n    python-is-python3 \\\n    wget \\\n    patchelf && \\\npip install -U pip && \\\npip install numpy==1.26.2 && \\\npip install keras_applications==1.0.8 --no-deps && \\\npip install keras_preprocessing==1.1.2 --no-deps && \\\npip install h5py==3.6.0 && \\\npip install pybind11==2.9.2 && \\\npip install packaging && \\\npip install protobuf==3.20.3 && \\\npip install six wheel mock gdown\n\n# Bookworm\nsudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n    libhdf5-dev \\\n    unzip \\\n    pkg-config \\\n    python3-pip \\\n    cmake \\\n    make \\\n    git \\\n    python-is-python3 \\\n    wget \\\n    patchelf && \\\npip install -U pip --break-system-packages && \\\npip install numpy==1.26.2 --break-system-packages && \\\npip install keras_applications==1.0.8 --no-deps --break-system-packages && \\\npip install keras_preprocessing==1.1.2 --no-deps --break-system-packages && \\\npip install h5py==3.10.0 --break-system-packages && \\\npip install pybind11==2.9.2 --break-system-packages && \\\npip install packaging --break-system-packages && \\\npip install protobuf==3.20.3 --break-system-packages && \\\npip install six wheel mock gdown --break-system-packages\n\n\ngit clone -b r2.15-tflite-build https:\u002F\u002Fgithub.com\u002FPINTO0309\u002Ftensorflow.git\ncd tensorflow\n\nexport TF_PYTHON_VERSION=3.xx\n\nwget -O bazel https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F6.1.0\u002Fbazel-6.1.0-linux-arm64 \\\n&& sudo chmod 777 bazel \\\n&& sudo cp bazel \u002Fusr\u002Flocal\u002Fbin \\\n&& sudo bazel clean --expunge \\\n&& .\u002Fconfigure\n\nbazel build \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_with_xnnpack=true \\\n--define=xnnpack_force_float_precision=fp16 \\\n--copt=\"-Wno-stringop-overflow\" \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n```bash\nsudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\nsudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.15.0*.whl ~\n```\n\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n## Reference articles\n- **[64-bit OS image creation repository for RaspberryPi3\u002F4](https:\u002F\u002Fgithub.com\u002Fdrtyhlpr\u002Frpi23-gen-image.git)**\n\n- **[How to install Ubuntu 18.04 aarch64 (64bit) on RaspberryPi3](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F4f3bca0629bc41f22b83)**\n\n- **[[Japanese ver.] [Tensorflow Lite] Various Neural Network Model quantization methods for Tensorflow Lite (Weight Quantization, Integer Quantization, Full Integer Quantization, Float16 Quantization, EdgeTPU). As of May 05, 2020.](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F008c54536fca690e0572)**\n\n- **[[English ver.] [Tensorflow Lite] Various Neural Network Model quantization methods for Tensorflow Lite (Weight Quantization, Integer Quantization, Full Integer Quantization, Float16 Quantization, EdgeTPU). As of May 05, 2020.](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F865250ee23a15339d556)**\n\n- Prebuilt binary for Jetson Nano by **`Michael`**. **https:\u002F\u002Fdl.photoprism.org\u002Ftensorflow\u002F**\n\n- **[Add a custom OP to the TFLite runtime to build the whl installer (for Python)](https:\u002F\u002Fzenn.dev\u002Fpinto0309\u002Farticles\u002Fa0e40c2817f2ee)**, **`MaxPoolingWithArgmax2D`**, **`MaxUnpooling2D`**, **`Convolution2DTransposeBias`**\n","# Tensorflow二进制\n\n**较旧版本的Wheel文件可以从[历史版本下载脚本（GoogleDrive）](previous_versions)获取。**\n\n已预编译的二进制文件，启用了TensorFlow Lite支持。适用于树莓派。由于树莓派的64位操作系统已正式发布，我已停止在armhf架构上构建Wheel文件。如果您需要armhf架构的Wheel文件，请使用此仓库：**[TensorflowLite-bin](https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin)**。\n\n- 支持Flex Delegate。\n- 支持XNNPACK。\n- XNNPACK支持“半精度推理，显著提升设备端推理性能”。\n\n**Python API包**\n\n|设备|操作系统|发行版|架构|Python版本|备注|\n|:--|:--|:--|:--|:--|:--|\n|树莓派3\u002F4|Raspbian\u002FDebian|Stretch|armhf \u002F armv7l|3.5.3|32位，glibc2.24|\n|树莓派3\u002F4|Raspbian\u002FDebian|Buster|armhf \u002F armv7l|3.7.3 \u002F 2.7.16|32位，glibc2.28|\n|树莓派3\u002F4|RaspberryPiOS\u002FDebian|Buster|aarch64 \u002F armv8|3.7.3|64位，glibc2.28|\n|树莓派3\u002F4|Ubuntu 18.04|Bionic|aarch64 \u002F armv8|3.6.9|64位，glibc2.27|\n|树莓派3\u002F4|Ubuntu 20.04|Focal|aarch64 \u002F armv8|3.8.2|64位，glibc2.31|\n|树莓派3\u002F4、PiZero|Ubuntu 21.04\u002FDebian\u002FRaspberryPiOS|Hirsute\u002FBullseye|aarch64 \u002F armv8|3.9.x|64位，glibc2.33\u002Fglibc2.31|\n|树莓派3\u002F4|Ubuntu 22.04|Jammy|aarch64 \u002F armv8|3.10.x|64位，glibc2.35|\n|树莓派4\u002F5、PiZero|Debian\u002FRaspberryPiOS|Bookworm|aarch64 \u002F armv8|3.11.x|64位，glibc2.36|\n\nTensorFlow Lite的最小化配置独立安装程序。\n**https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin.git**\n\n## 二进制类型\n\n**\u003Cdetails>\u003Csummary>Python 2.x \u002F 3.x + TensorFlow v1.15.0\u003C\u002Fsummary>\u003Cdiv>**\n\n|.whl|4线程|备注|\n|:--|:--:|:--|\n|tensorflow-1.15.0-cp35-cp35m-linux_armv7l.whl|○|Raspbian\u002FDebian Stretch，glibc 2.24|\n|tensorflow-1.15.0-cp27-cp27mu-linux_armv7l.whl|○|Raspbian\u002FDebian Buster，glibc 2.28|\n|tensorflow-1.15.0-cp37-cp37m-linux_armv7l.whl|○|Raspbian\u002FDebian Buster，glibc 2.28|\n|tensorflow-1.15.0-cp37-cp37m-linux_aarch64.whl|○|Debian Buster，glibc 2.28|\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n**Python 3.x + TensorFlow v2**\n\n\\*FD = FlexDelegate, \\*\\*XP = XNNPACK Float16加速，\\*\\*\\*MP = MediaPipe自定义OP，\\*\\*\\*\\*NP = Numpy\n\n|.whl|FD|XP|MP|NP|备注|\n|:--|:--:|:--:|:--:|:--:|:--|\n|tensorflow-2.15.0.post1-cp39-none-linux_aarch64.whl||○||1.26|Ubuntu 21.04 glibc 2.33，Debian Bullseye glibc 2.31|\n|tensorflow-2.15.0.post1-cp310-none-linux_aarch64.whl||○||1.26|Ubuntu 22.04 glibc 2.35|\n|tensorflow-2.15.0.post1-cp311-none-linux_aarch64.whl||○||1.26|Debian Bookworm glibc 2.36|\n\n**\u003Cdetails>\u003Csummary>【附录】 C库 + TensorFlow v1.x.x \u002F v2.x.x\u003C\u002Fsummary>\u003Cdiv>**\n\n由于本人不具备C语言实现能力，该部分行为尚未确认。\n**[TensorFlow C绑定生成官方教程](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fblob\u002Fmaster\u002Ftensorflow\u002Ftools\u002Flib_package\u002FREADME.md)**\n\n**附录1. C-API构建流程**\n**[树莓派\u002Farm64设备（armhf\u002Faarch64）TensorFlow v2.0.0 C API原生构建流程](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F4f26f63bf40014bec146)**\n\n**附录2. C-API使用方法**\n```sh\n$ wget https:\u002F\u002Fraw.githubusercontent.com\u002FPINTO0309\u002FTensorflow-bin\u002Fmain\u002FC-library\u002F2.2.0-armhf\u002Finstall-buster.sh\n$ .\u002Finstall-buster.sh\n```\n|版本|二进制|备注|\n|:--:|:--|:--|\n|v1.15.0|C-library\u002F1.15.0-armhf\u002Finstall-buster.sh|Raspbian\u002FDebian Buster，glibc 2.28|\n|v1.15.0|C-library\u002F1.15.0-aarch64\u002Finstall-buster.sh|Raspbian\u002FDebian Buster，glibc 2.28|\n|v2.2.0|C-library\u002F2.2.0-armhf\u002Finstall-buster.sh|Raspbian\u002FDebian Buster，glibc 2.28|\n|v2.3.0|C-library\u002F2.3.0-aarch64\u002Finstall-buster.sh|RaspberryPiOS\u002FRaspbian\u002FDebian Buster，glibc 2.28|\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n## 使用方法\n**\u003Cdetails>\u003Csummary>Python 3.x + TensorFlow v1系列示例\u003C\u002Fsummary>\u003Cdiv>**\n\n```bash\n$ sudo apt-get install -y \\\n    libhdf5-dev libc-ares-dev libeigen3-dev gcc gfortran \\\n    libgfortran5 libatlas3-base libatlas-base-dev \\\n    libopenblas-dev libopenblas-base libblas-dev \\\n    liblapack-dev cython3 openmpi-bin libopenmpi-dev \\\n    libatlas-base-dev python3-dev\n$ sudo pip3 install pip --upgrade\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo pip3 install pybind11\n$ pip3 install -U --user six wheel mock\n$ sudo pip3 uninstall tensorflow\n$ wget \"https:\u002F\u002Fraw.githubusercontent.com\u002FPINTO0309\u002FTensorflow-bin\u002Fmaster\u002Fprevious_versions\u002Fdownload_tensorflow-1.15.0-cp37-cp37m-linux_armv7l.sh\"\n$ .\u002Fdownload_tensorflow-1.15.0-cp37-cp37m-linux_armv7l.sh\n$ sudo pip3 install tensorflow-1.15.0-cp37-cp37m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n**Python 3.x + TensorFlow v2系列示例**\n```bash\n##### Bullseye、Ubuntu22.04\nsudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n    libhdf5-dev \\\n    unzip \\\n    pkg-config \\\n    python3-pip \\\n    cmake \\\n    make \\\n    git \\\n    python-is-python3 \\\n    wget \\\n    patchelf && \\\npip install -U pip && \\\npip install numpy==1.26.2 && \\\npip install keras_applications==1.0.8 --no-deps && \\\npip install keras_preprocessing==1.1.2 --no-deps && \\\npip install h5py==3.6.0 && \\\npip install pybind11==2.9.2 && \\\npip install packaging && \\\npip install protobuf==3.20.3 && \\\npip install six wheel mock gdown\n```\n```bash\n##### Bookworm\nsudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n    libhdf5-dev \\\n    unzip \\\n    pkg-config \\\n    python3-pip \\\n    cmake \\\n    make \\\n    git \\\n    python-is-python3 \\\n    wget \\\n    patchelf && \\\npip install -U pip --打破系统包限制 && \\\npip install numpy==1.26.2 --打破系统包限制 && \\\npip install keras_applications==1.0.8 --no-deps --打破系统包限制 && \\\npip install keras_preprocessing==1.1.2 --no-deps --打破系统包限制 && \\\npip install h5py==3.10.0 --打破系统包限制 && \\\npip install pybind11==2.9.2 --打破系统包限制 && \\\npip install packaging --打破系统包限制 && \\\npip install protobuf==3.20.3 --打破系统包限制 && \\\npip install six wheel mock gdown --打破系统包限制\n```\n```bash\npip卸载tensorflow\n\nTFVER=2.15.0.post1\n\nPYVER=39\n或\nPYVER=310\n或\nPYVER=311\n\nARCH=`python -c 'import platform; print(platform.machine())'`\necho CPU架构: ${ARCH}\n\npip安装\\\n--no-cache-dir\\\nhttps:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Freleases\u002Fdownload\u002Fv${TFVER}\u002Ftensorflow-${TFVER}-cp${PYVER}-none-linux_${ARCH}.whl\n```\n\n## 操作检查\n**Python 3.x 系列示例**\n```bash\n$ python -c 'import tensorflow as tf;print(tf.__version__)'\n2.15.0.post1\n```\n\n**多线程 x4 示例**\n- 测试环境准备\n```bash\n$ cd ~;mkdir test\n$ curl https:\u002F\u002Fraw.githubusercontent.com\u002Ftensorflow\u002Ftensorflow\u002Fmaster\u002Ftensorflow\u002Flite\u002Fexamples\u002Flabel_image\u002Ftestdata\u002Fgrace_hopper.bmp > ~\u002Ftest\u002Fgrace_hopper.bmp\n$ curl https:\u002F\u002Fstorage.googleapis.com\u002Fdownload.tensorflow.org\u002Fmodels\u002Fmobilenet_v1_1.0_224_frozen.tgz | tar xzv -C ~\u002Ftest mobilenet_v1_1.0_224\u002Flabels.txt\n$ mv ~\u002Ftest\u002Fmobilenet_v1_1.0_224\u002Flabels.txt ~\u002Ftest\u002F\n$ curl http:\u002F\u002Fdownload.tensorflow.org\u002Fmodels\u002Fmobilenet_v1_2018_02_22\u002Fmobilenet_v1_1.0_224_quant.tgz | tar xzv -C ~\u002Ftest\n$ cp tensorflow\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fexamples\u002Fpython\u002Flabel_image.py ~\u002Ftest\n```\n\u003Cdetails>\u003Csummary>[示例代码] label_image.py\u003C\u002Fsummary>\u003Cdiv>\n\n```python\nimport argparse\nimport numpy as np\nimport time\n\nfrom PIL import Image\n\n# Tensorflow -v1.12.0\n#from tensorflow.contrib.lite.python import interpreter as interpreter_wrapper\n\n# Tensorflow v1.13.0+, v2.x.x\nfrom tensorflow.lite.python import interpreter as interpreter_wrapper\n\ndef load_labels(filename):\n  my_labels = []\n  input_file = open(filename, 'r')\n  for l in input_file:\n    my_labels.append(l.strip())\n  return my_labels\nif __name__ == \"__main__\":\n  floating_model = False\n  parser = argparse.ArgumentParser()\n  parser.add_argument(\"-i\", \"--image\", default=\"\u002Ftmp\u002Fgrace_hopper.bmp\", \\\n    help=\"待分类的图像\")\n  parser.add_argument(\"-m\", \"--model_file\", \\\n    default=\"\u002Ftmp\u002Fmobilenet_v1_1.0_224_quant.tflite\", \\\n    help=\".tflite 模型文件\")\n  parser.add_argument(\"-l\", \"--label_file\", default=\"\u002Ftmp\u002Flabels.txt\", \\\n    help=\"包含标签的文件名\")\n  parser.add_argument(\"--input_mean\", default=127.5, help=\"输入均值\")\n  parser.add_argument(\"--input_std\", default=127.5, \\\n    help=\"输入标准差\")\n  parser.add_argument(\"--num_threads\", default=1, help=\"线程数\")\n  args = parser.parse_args()\n\n  ### Tensorflow -v2.2.0\n  #interpreter = interpreter_wrapper.Interpreter(model_path=args.model_file)\n  ### Tensorflow v2.3.0+\n  interpreter = interpreter_wrapper.Interpreter(model_path=args.model_file, num_threads=int(args.num_threads))\n\n  interpreter.allocate_tensors()\n  input_details = interpreter.get_input_details()\n  output_details = interpreter.get_output_details()\n  # 检查输入张量的类型\n  if input_details[0]['dtype'] == np.float32:\n    floating_model = True\n  # NxHxWxC, H:1, W:2\n  height = input_details[0]['shape'][1]\n  width = input_details[0]['shape'][2]\n  img = Image.open(args.image)\n  img = img.resize((width, height))\n  # 添加 N 维\n  input_data = np.expand_dims(img, axis=0)\n  if floating_model:\n    input_data = (np.float32(input_data) - args.input_mean) \u002F args.input_std\n\n  ### Tensorflow -v2.2.0\n  #interpreter.set_num_threads(int(args.num_threads))\n  interpreter.set_tensor(input_details[0]['index'], input_data)\n\n  start_time = time.time()\n  interpreter.invoke()\n  stop_time = time.time()\n\n  output_data = interpreter.get_tensor(output_details[0]['index'])\n  results = np.squeeze(output_data)\n  top_k = results.argsort()[-5:][::-1]\n  labels = load_labels(args.label_file)\n  for i in top_k:\n    if floating_model:\n      print('{0:08.6f}'.format(float(results[i]))+\":\", labels[i])\n    else:\n      print('{0:08.6f}'.format(float(results[i]\u002F255.0))+\":\", labels[i])\n\n  print(\"时间: \", stop_time - start_time)\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\u003Cbr>\n\n- 运行测试\n```bash\n$ cd ~\u002Ftest\n$ python3 label_image.py \\\n--num_threads 1 \\\n--image grace_hopper.bmp \\\n--model_file mobilenet_v1_1.0_224_quant.tflite \\\n--label_file labels.txt\n\n0.415686: 653:军装\n0.352941: 907:温莎领结\n0.058824: 668:学士帽\n0.035294: 458:蝴蝶结领带、领结\n0.035294: 835:西装、套装\n时间:  0.4152982234954834\n```\n```bash\n$ cd ~\u002Ftest\n$ python3 label_image.py \\\n--num_threads 4 \\\n--image grace_hopper.bmp \\\n--model_file mobilenet_v1_1.0_224_quant.tflite \\\n--label_file labels.txt\n\n0.415686: 653:军装\n0.352941: 907:温莎领结\n0.058824: 668:学士帽\n0.035294: 458:蝴蝶结领带、领结\n0.035294: 835:西装、套装\n时间:  0.1647195816040039\n```\n\n**多线程 x4 示例 - 使用 USB 摄像头进行实时推理**\n- RaspberryPi4（仅 CPU）\n- Ubuntu 19.10 aarch64\n- 高分辨率 IPS 1080p 显示屏\n- USB 摄像头分辨率为 640x480\n- Tensorflow Lite\n- **[MobileNetV2-SSDLite（Pascal-VOC，整数量化）](https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FPINTO_model_zoo\u002Ftree\u002Fmaster\u002F06_mobilenetv2-ssdlite\u002F02_voc)**\n\n![002](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPINTO0309_Tensorflow-bin_readme_0d2875873a3a.gif)\n\n## 构建参数\n\n\u003Cdetails>\u003Csummary>Tensorflow v1.11.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v1.11.0**\n\n============================================================\n\n**Python2.x - Bazel 0.17.2**\n```bash\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev libhdf5-dev\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.11.0\n$ .\u002Fconfigure\n\n请指定 Python 的安装路径。[默认为 \u002Fusr\u002Fbin\u002Fpython]:\n\n\n找到了可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython2.7\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fhome\u002Fpi\u002Ftensorflow\u002Ftensorflow\u002Fcontrib\u002Flite\u002Ftools\u002Fmake\u002Fgen\u002Frpi_armv7l\u002Flib\n  \u002Fusr\u002Flib\u002Fpython2.7\u002Fdist-packages\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\n请输入您希望使用的 Python 库路径。默认路径为 [\u002Fusr\u002Flocal\u002Flib\u002Fpython2.7\u002Fdist-packages]\n\n您是否希望构建支持 jemalloc 作为内存分配器的 TensorFlow？[Y\u002Fn]: y\n将启用不使用 jemalloc 作为内存分配器的 TensorFlow。\n\n您是否希望构建支持 Google Cloud Platform 的 TensorFlow？[Y\u002Fn]: n\n将不启用 Google Cloud Platform 支持。\n\n您是否希望构建支持 Hadoop 文件系统的 TensorFlow？[Y\u002Fn]: n\n将不启用 Hadoop 文件系统支持。\n\n您是否希望构建支持 Amazon AWS 平台的 TensorFlow？[Y\u002Fn]: n\n将不启用 Amazon AWS 平台支持。\n\n您是否希望构建支持 Apache Kafka 平台的 TensorFlow？[Y\u002Fn]: n\n将不启用 Apache Kafka 平台支持。\n\n您是否希望构建支持 XLA JIT 的 TensorFlow？[y\u002FN]: n\n将不启用 XLA JIT 支持。\n\n您是否希望构建支持 GDR 的 TensorFlow？[y\u002FN]: n\n将不启用 GDR 支持。\n\n您是否希望构建支持 VERBS 的 TensorFlow？[y\u002FN]: n\n将不启用 VERBS 支持。\n\n您是否希望构建支持 nGraph 的 TensorFlow？[y\u002FN]: n\n将不启用 nGraph 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]: n\n将不启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]: n\n将不启用 CUDA 支持。\n\n您是否希望下载最新版本的 clang？（实验性功能）[y\u002FN]: n\n不会下载 Clang。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不会启用 MPI 支持。\n\n当指定 Bazel 选项 \"--config=opt\" 时，请指定编译期间要使用的优化标志 [默认值为 -march=native]:\n\n\n您是否希望以交互方式配置用于 Android 构建的 .\u002FWORKSPACE 文件？[y\u002FN]: n\n```\n```bash\n$ sudo bazel build --config opt --local_resources 1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo pip2 install \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.11.0-cp27-cp27mu-linux_armv7l.whl\n```\n\n**Python3.x- Bazel 0.17.2 + ZRAM + PythonAPI(多线程) 2019年2月23日，编译工作已完成**\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.11.0\n```\n请参考以下内容修改程序。\n\u003Cdetails>\u003Csummary>tensorflow\u002Fcontrib\u002Flite\u002Fexamples\u002Fpython\u002Flabel_image.py\u003C\u002Fsummary>\u003Cdiv>\n\n```python\nimport argparse\nimport numpy as np\nimport time\n\nfrom PIL import Image\n\nfrom tensorflow.contrib.lite.python import interpreter as interpreter_wrapper\ndef load_labels(filename):\n  my_labels = []\n  input_file = open(filename, 'r')\n  for l in input_file:\n    my_labels.append(l.strip())\n  return my_labels\nif __name__ == \"__main__\":\n  floating_model = False\n  parser = argparse.ArgumentParser()\n  parser.add_argument(\"-i\", \"--image\", default=\"\u002Ftmp\u002Fgrace_hopper.bmp\", \\\n    help=\"待分类的图像\")\n  parser.add_argument(\"-m\", \"--model_file\", \\\n    default=\"\u002Ftmp\u002Fmobilenet_v1_1.0_224_quant.tflite\", \\\n    help=\".tflite 模型文件\")\n  parser.add_argument(\"-l\", \"--label_file\", default=\"\u002Ftmp\u002Flabels.txt\", \\\n    help=\"包含标签的文件名\")\n  parser.add_argument(\"--input_mean\", default=127.5, help=\"输入均值\")\n  parser.add_argument(\"--input_std\", default=127.5, \\\n    help=\"输入标准差\")\n  parser.add_argument(\"--num_threads\", default=1, help=\"线程数\")\n  args = parser.parse_args()\n\n  interpreter = interpreter_wrapper.Interpreter(model_path=args.model_file)\n  interpreter.allocate_tensors()\n  input_details = interpreter.get_input_details()\n  output_details = interpreter.get_output_details()\n  # 检查输入张量的类型\n  if input_details[0]['dtype'] == np.float32:\n    floating_model = True\n  # NxHxWxC, H:1, W:2\n  height = input_details[0]['shape'][1]\n  width = input_details[0]['shape'][2]\n  img = Image.open(args.image)\n  img = img.resize((width, height))\n  # 添加 N 维\n  input_data = np.expand_dims(img, axis=0)\n  if floating_model:\n    input_data = (np.float32(input_data) - args.input_mean) \u002F args.input_std\n\n  interpreter.set_num_threads(int(args.num_threads))\n  interpreter.set_tensor(input_details[0]['index'], input_data)\n\n  start_time = time.time()\n  interpreter.invoke()\n  stop_time = time.time()\n\n  output_data = interpreter.get_tensor(output_details[0]['index'])\n  results = np.squeeze(output_data)\n  top_k = results.argsort()[-5:][::-1]\n  labels = load_labels(args.label_file)\n  for i in top_k:\n    if floating_model:\n      print('{0:08.6f}'.format(float(results[i]))+\":\", labels[i])\n    else:\n      print('{0:08.6f}'.format(float(results[i]\u002F255.0))+\":\", labels[i])\n\n  print(\"时间: \", stop_time - start_time)\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>tensorflow\u002Fcontrib\u002Flite\u002Fpython\u002Finterpreter.py\u003C\u002Fsummary>\u003Cdiv>\n\n```python\n#在最后一行添加以下两行\n\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>tensorflow\u002Fcontrib\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\u003C\u002Fsummary>\u003Cdiv>\n\n```cpp\n\u002F\u002F修正了最后一行附近的代码如下\n\n  PyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>tensorflow\u002Fcontrib\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\u003C\u002Fsummary>\u003Cdiv>\n\n```cpp\n\u002F\u002F修改了中间部分的逻辑如下\n\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构造 `Interpreter` 时返回 InterpreterWrapper。\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\u003Cbr>\n\n```bash\n$ .\u002Fconfigure\n\n请指定 Python 的安装路径。[默认值为 \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\n找到可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib] \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n\n您是否希望构建支持 jemalloc 作为内存分配器的 TensorFlow？[Y\u002Fn]: y\nTensorFlow 将不会启用 jemalloc 作为内存分配器的支持。\n\n您是否希望构建支持 Google Cloud Platform 的 TensorFlow？[Y\u002Fn]: n\nTensorFlow 将不会启用 Google Cloud Platform 支持。\n\n您是否希望构建支持 Hadoop 文件系统的 TensorFlow？[Y\u002Fn]: n\nTensorFlow 将不会启用 Hadoop 文件系统支持。\n\n您是否希望构建支持 Amazon AWS 平台的 TensorFlow？[Y\u002Fn]: n\nTensorFlow 将不会启用 Amazon AWS 平台支持。\n\n您是否希望构建支持 Apache Kafka 平台的 TensorFlow？[Y\u002Fn]: n\nTensorflow 将不会启用 Apache Kafka 平台支持。\n\n您是否希望构建支持 XLA JIT 的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不会启用 XLA JIT 支持。\n\n您是否希望构建支持 GDR 的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不会启用 GDR 支持。\n\n您是否希望构建支持 VERBS 的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不会启用 VERBS 支持。\n\n您是否希望构建支持 nGraph 的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不会启用 nGraph 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不会启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不会启用 CUDA 支持。\n\n您是否希望下载最新版本的 Clang？（实验性）[y\u002FN]: n\nClang 不会被下载。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]: n\nTensorflow 将不会启用 MPI 支持。\n\n请指定在使用 Bazel 选项 `--config=opt` 时编译过程中要使用的优化标志 [默认为 -march=native]:\n\n\n您是否希望以交互方式配置用于 Android 构建的 WORKSPACE 文件？[y\u002FN]: n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置。您可以通过在构建命令中添加 `--config=\u003C>` 来使用以下任一配置。更多详情请参阅 tools\u002Fbazel.rc。\n    --config=mkl            # 使用 MKL 支持进行构建。\n    --config=monolithic     # 主要采用静态单体式构建的配置。\n配置已完成。\n```\n```bash\n$ sudo bazel build --config opt --local_resources 1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ sudo -s\n\n\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo pip3 install \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.11.0-cp35-cp35m-linux_armv7l.whl\n```\n\n**Python3.x + jemalloc + MPI + 多线程 [仅 C++]**\n\n编辑 **`tensorflow\u002Ftensorflow\u002Fcontrib\u002Fmpi\u002Fmpi_rendezvous_mgr.cc`** 第139行\u002F第140行、第261行。\n```cxx\n  MPIRendezvousMgr* mgr =\n      reinterpret_cast\u003CMPIRendezvousMgr*>(this->rendezvous_mgr_);\n- mgr->QueueRequest(parsed.FullKey().ToString(), step_id_,\n-                   std::move(request_call), rendezvous_call);\n+ mgr->QueueRequest(string(parsed.FullKey()), step_id_, std::move(request_call),\n+                   rendezvous_call);\n}\n MPIRemoteRendezvous::~MPIRemoteRendezvous() {}\n\n\n        std::function\u003CMPISendTensorCall*()> res = std::bind(\n            send_cb, status, send_args, recv_args, val, is_dead, mpi_send_call);\n-       SendQueueEntry req(parsed.FullKey().ToString().c_str(), std::move(res));\n+       SendQueueEntry req(string(parsed.FullKey()), std::move(res));\n         this->QueueSendRequest(req);\n```\n编辑 **`tensorflow\u002Ftensorflow\u002Fcontrib\u002Fmpi\u002Fmpi_rendezvous_mgr.h`** 第74行。\n```cxx\n  void Init(const Rendezvous::ParsedKey& parsed, const int64 step_id,\n            const bool is_dead) {\n-   mRes_.set_key(parsed.FullKey().ToString());\n+   mRes_.set_key(string(parsed.FullKey()));\n    mRes_.set_step_id(step_id；\n    mRes_.mutable_response()->set_is_dead(is_dead；\n    mRes_.mutable_response()->set_send_start_micros(\n```\n编辑 **`tensorflow\u002Ftensorflow\u002Fcontrib\u002Flite\u002Finterpreter.cc`** 第127行。\n```cxx\n-  context_.recommended_num_threads = -1;\n+  context_.recommended_num_threads = 4；\n```\n```bash\n$ sudo apt-get install -y libhdf5-dev\n$ sudo pip3 install keras_applications==1.0.4 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.2 --no-deps\n$ sudo pip3 install h5py==2.8.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.11.0\n$ .\u002Fconfigure\n\n请指定 Python 的安装路径。[默认为 \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\n找到了可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib] \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n\n您是否希望构建使用 jemalloc 作为内存分配器的 TensorFlow？[Y\u002Fn]: y\nTensorflow 将启用 jemalloc 作为内存分配器的支持。\n\n您是否希望构建支持 Google Cloud Platform 的 TensorFlow？[Y\u002Fn]: n\nTensorflow 将不会启用 Google Cloud Platform 支持。\n\n您是否希望构建支持 Hadoop 文件系统的 TensorFlow？[Y\u002Fn]: n\nTensorflow 将不会启用 Hadoop 文件系统支持。\n\n您是否希望构建支持 Amazon AWS 平台的 TensorFlow？[Y\u002Fn]: n\nTensorflow 将不会启用 Amazon AWS 平台支持。\n\n您是否希望构建支持 Apache Kafka 平台的 TensorFlow？[Y\u002Fn]: n\nTensorflow 将不会启用 Apache Kafka 平台支持。\n\n您是否希望构建支持 XLA JIT 的 TensorFlow？[y\u002FN]: n\nTensorflow 将不会启用 XLA JIT 支持。\n\n您是否希望构建支持 GDR 的 TensorFlow？[y\u002FN]: n\nTensorflow 将不会启用 GDR 支持。\n\n您是否希望构建支持 VERBS 的 TensorFlow？[y\u002FN]: n\nTensorflow 将不会启用 VERBS 支持。\n\n您是否希望构建支持 nGraph 的 TensorFlow？[y\u002FN]: n\nTensorflow 将不会启用 nGraph 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]: n\nTensorflow 将不会启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]: n\nTensorflow 将不会启用 CUDA 支持。\n\n您是否希望下载最新版本的 Clang？（实验性）[y\u002FN]: n\nClang 不会被下载。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]: y\nTensorflow 将启用 MPI 支持。\n\n请指定 MPI 工具包的安装目录。[默认为 \u002Fusr]: \u002Fusr\u002Flib\u002Farm-linux-gnueabihf\u002Fopenmpi\n\n请指定在使用 Bazel 选项 `--config=opt` 时编译过程中要使用的优化标志 [默认为 -march=native]:\n\n\n您是否希望以交互方式配置用于 Android 构建的 WORKSPACE 文件？[y\u002FN]: n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置。您可以通过在构建命令中添加 `--config=\u003C>` 来使用以下任一配置。更多详情请参阅 tools\u002Fbazel.rc。\n    --config=mkl            # 使用 MKL 支持进行构建。\n    --config=monolithic     # 主要采用静态单体式构建的配置。\n配置已完成。\n```\n```bash\n$ sudo bazel build --config opt --local_resources 1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n**Python3.x + jemalloc + XLA JIT（无法构建）**\n\n```bash\n$ sudo apt-get install -y libhdf5-dev\n$ sudo pip3 install keras_applications==1.0.4 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.2 --no-deps\n$ sudo pip3 install h5py==2.8.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ JAVA_OPTIONS=-Xmx256M\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.11.0\n$ .\u002Fconfigure\n\n请指定 Python 的安装路径。[默认为 \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n找到可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\n\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib] \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n\n您是否希望使用 jemalloc 作为 TensorFlow 的内存分配支持？[Y\u002Fn]: y\nTensorFlow 将启用 jemalloc 作为内存分配支持。\n\n您是否希望构建具有 Google Cloud Platform 支持的 TensorFlow？[Y\u002Fn]: n\nTensorFlow 将不启用 Google Cloud Platform 支持。\n\n您是否希望构建具有 Hadoop 文件系统支持的 TensorFlow？[Y\u002Fn]: n\nTensorFlow 将不启用 Hadoop 文件系统支持。\n\n您是否希望构建具有 Amazon AWS 平台支持的 TensorFlow？[Y\u002Fn]: n\nTensorFlow 将不启用 Amazon AWS 平台支持。\n\n您是否希望构建具有 Apache Kafka 平台支持的 TensorFlow？[Y\u002Fn]: n\nTensorFlow 将不启用 Apache Kafka 平台支持。\n\n您是否希望构建具有 XLA JIT 支持的 TensorFlow？[y\u002FN]: y\nTensorFlow 将不启用 XLA JIT 支持。\n\n您是否希望构建具有 GDR 支持的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不启用 GDR 支持。\n\n您是否希望构建具有 VERBS 支持的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不启用 VERBS 支持。\n\n您是否希望构建具有 nGraph 支持的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不启用 nGraph 支持。\n\n您是否希望构建具有 OpenCL SYCL 支持的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不启用 OpenCL SYCL 支持。\n\n您是否希望构建具有 CUDA 支持的 TensorFlow？[y\u002FN]: n\nTensorFlow 将不启用 CUDA 支持。\n\n您是否希望下载最新版本的 Clang（实验性）？[y\u002FN]: n\n不会下载 Clang。\n\n您是否希望构建具有 MPI 支持的 TensorFlow？[y\u002FN]: n\nMPI 支持将被启用用于 TensorFlow。\n\n请指定在使用 Bazel 选项 \"--config=opt\" 时编译过程中要使用的优化标志 [默认值为 -march=native]:\n\n\n您是否希望交互式配置用于 Android 构建的 WORKSPACE 文件？[y\u002FN]: n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置如下。您可以通过在构建命令中添加 \"--config=\u003C>\" 来使用以下任一配置。更多详情请参阅 tools\u002Fbazel.rc。\n    --config=mkl            # 启用 MKL 支持的构建。\n    --config=monolithic     # 主要采用静态单体式构建的配置。\n配置已完成\n```\n```bash\n$ sudo bazel build --config opt --local_resources 1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n**Python3.x + TX2 aarch64 - Bazel 0.18.1 (JetPack-L4T-3.3-linux-x64_b39)**\n\n```\n- L4T R28.2.1（TX2 \u002F TX2i）\n- L4T R28.2（TX1）\n- CUDA 9.0\n- cuDNN 7.1.5\n- TensorRT 4.0\n- VisionWorks 1.6\n```\n\n**https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F21574#issuecomment-429758923**\n**https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fserving\u002Fissues\u002F832**\n**https:\u002F\u002Fdocs.nvidia.com\u002Fdeeplearning\u002Fsdk\u002Fnccl-archived\u002Fnccl_2213\u002Fnccl-install-guide\u002Findex.html**\n\n```\n构建 --action_env PYTHON_BIN_PATH=\"\u002Fusr\u002Fbin\u002Fpython3\"\n构建 --action_env PYTHON_LIB_PATH=\"\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\"\n构建 --python_path=\"\u002Fusr\u002Fbin\u002Fpython3\"\n构建 --define with_jemalloc=true\n构建:gcp --define with_gcp_support=true\n构建:hdfs --define with_hdfs_support=true\n构建:aws --define with_aws_support=true\n构建:kafka --define with_kafka_support=true\n构建:xla --define with_xla_support=true\n构建:gdr --define with_gdr_support=true\n构建:verbs --define with_verbs_support=true\n构建:ngraph --define with_ngraph_support=true\n构建 --action_env TF_NEED_OPENCL_SYCL=\"0\"\n构建 --action_env TF_NEED_CUDA=\"1\"\n构建 --action_env CUDA_TOOLKIT_PATH=\"\u002Fusr\u002Flocal\u002Fcuda-9.0\"\n构建 --action_env TF_CUDA_VERSION=\"9.0\"\n构建 --action_env CUDNN_INSTALL_PATH=\"\u002Fusr\u002Flib\u002Faarch64-linux-gnu\"\n构建 --action_env TF_CUDNN_VERSION=\"7\"\n构建 --action_env NCCL_INSTALL_PATH=\"\u002Fusr\u002Flocal\"\n构建 --action_env TF_NCCL_VERSION=\"2\"\n构建 --action_env TF_CUDA_COMPUTE_CAPABILITIES=\"3.5,7.0\"\n构建 --action_env LD_LIBRARY_PATH=\"\u002Fusr\u002Flocal\u002Fcuda-9.0\u002Flib64:..\u002Fsrc\u002F.libs\"\n构建 --action_env TF_CUDA_CLANG=\"0\"\n构建 --action_env GCC_HOST_COMPILER_PATH=\"\u002Fusr\u002Fbin\u002Fgcc\"\n构建 --config=cuda\n测试 --config=cuda\n构建 --define grpc_no_ares=true\n构建:opt --copt=-march=native\n构建:opt --host_copt=-march=native\n构建:opt --define with_default_optimizations=true\n```\n\n```bash\n$ sudo apt-get install -y libhdf5-dev\n$ sudo pip3 install keras_applications==1.0.4 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.2 --no-deps\n$ sudo pip3 install h5py==2.8.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ bazel build -c opt --config=cuda --local_resources 3072.0,4.0,1.0 --verbose_failures \u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v1.12.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v1.12.0 - Bazel 0.18.1**\n\n============================================================\n\n**Python3.x (Nov 15, 2018 正在建设中)**\n\n- tensorflow\u002FBUILD\n```config\nconfig_setting(\n    name = \"no_aws_support\",\n    define_values = {\"no_aws_support\": \"false\"},\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n\nconfig_setting(\n    name = \"no_gcp_support\",\n    define_values = {\"no_gcp_support\": \"false\"},\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n\nconfig_setting(\n    name = \"no_hdfs_support\",\n    define_values = {\"no_hdfs_support\": \"false\"},\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n\nconfig_setting(\n    name = \"no_ignite_support\",\n    define_values = {\"no_ignite_support\": \"false\"},\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n\nconfig_setting(\n    name = \"no_kafka_support\",\n    define_values = {\"no_kafka_support\": \"false\"},\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n```\n- bazel.rc\n```rc\n\n# 用于禁用默认功能的选项\nbuild:noaws --define=no_aws_support=true\nbuild:nogcp --define=no_gcp_support=true\nbuild:nohdfs --define=no_hdfs_support=true\nbuild:nokafka --define=no_kafka_support=true\nbuild:noignite --define=no_ignite_support=true\n```\n- configure.py\n```python:configure.py\n  #set_build_var(environ_cp, 'TF_NEED_IGNITE', 'Apache Ignite',\n  #              'with_ignite_support', True, 'ignite')\n\n\n  ## 在 Windows 上，我们没有 MKL 支持，并且构建始终是单体式的。\n  ## 因此无需打印以下消息。\n  ## TODO(pcloudy): 当这些选项在 Windows 上有意义时，移除下面的 if 检查\n  #if not is_windows():\n  #  print('预配置的 Bazel 构建配置。您可以通过在构建命令中添加 \"--config=\u003C>\" 来使用以下任一配置。有关详细信息，请参阅 tools\u002Fbazel.rc 文件。')\n  #  config_info_line('mkl', '启用 MKL 支持的构建。')\n  #  config_info_line('monolithic', '主要用于静态单体式构建的配置。')\n  #  config_info_line('gdr', '启用 GDR 支持的构建。')\n  #  config_info_line('verbs', '启用 libverbs 支持的构建。')\n  #  config_info_line('ngraph', '启用 Intel nGraph 支持的构建。')\n  print('预配置的 Bazel 构建配置。您可以通过在构建命令中添加 \"--config=\u003C>\" 来使用以下任一配置。有关详细信息，请参阅 .bazelrc 文件。')\n  config_info_line('mkl', '启用 MKL 支持的构建。')\n  config_info_line('monolithic', '主要用于静态单体式构建的配置。')\n  config_info_line('gdr', '启用 GDR 支持的构建。')\n  config_info_line('verbs', '启用 libverbs 支持的构建。')\n  config_info_line('ngraph', '启用 Intel nGraph 支持的构建。')\n\n  print('用于禁用默认功能的预配置 Bazel 构建配置：')\n  config_info_line('noaws', '禁用 AWS S3 文件系统支持。')\n  config_info_line('nogcp', '禁用 GCP 支持。')\n  config_info_line('nohdfs', '禁用 HDFS 支持。')\n  config_info_line('noignite', '禁用 Apache Ignite 支持。')\n  config_info_line('nokafka', '禁用 Apache Kafka 支持。')\n```\n\n```tensorflow\u002Fcontrib\u002FBUILD\n# 描述：\n#   包含 TensorFlow 中实验性或不稳定的、不受支持的部分。\n\nlicenses([\"notice\"])  # Apache 2.0\n\npackage(default_visibility = [\"\u002F\u002Ftensorflow:__subpackages__\"])\n\nload(\"\u002F\u002Fthird_party\u002Fmpi:mpi.bzl\", \"if_mpi\")\nload(\"@local_config_cuda\u002F\u002Fcuda:build_defs.bzl\", \"if_cuda\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_not_windows\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_not_windows_cuda\")\n\npy_library(\n    name = \"contrib_py\",\n    srcs = glob(\n        [\"**\u002F*.py\"],\n        exclude = [\n            \"**\u002F*_test.py\",\n        ],\n    ),\n    srcs_version = \"PY2AND3\",\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n    deps = [\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fall_reduce\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fbatching:batch_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fbayesflow:bayesflow_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fboosted_trees:init_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcheckpoint\u002Fpython:checkpoint\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcluster_resolver:cluster_resolver_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcoder:coder_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcompiler:compiler_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcompiler:xla\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fautograph\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fconstrained_optimization\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcopy_graph:copy_graph_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcrf:crf_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcudnn_rnn:cudnn_rnn_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fdata\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fdeprecated:deprecated_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fdistribute:distribute\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fdistributions:distributions_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Feager\u002Fpython:tfe\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Festimator:estimator_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ffactorization:factorization_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ffeature_column:feature_column_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fframework:framework_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fgan\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fgraph_editor:graph_editor_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fgrid_rnn:grid_rnn_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fhadoop\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fhooks\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fimage:distort_image_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fimage:image_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fimage:single_image_random_dot_stereograms_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Finput_pipeline:input_pipeline_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fintegrate:integrate_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkeras\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkernel_methods\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flabeled_tensor\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flayers:layers_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flearn\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flegacy_seq2seq:seq2seq_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flibsvm\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flinear_optimizer:sdca_estimator_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flinear_optimizer:sdca_ops_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fpython:lite\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flookup:lookup_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flosses:losses_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flosses:metric_learning_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmemory_stats:memory_stats_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmeta_graph_transform\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmetrics:metrics_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmixed_precision:mixed_precision\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmodel_pruning\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnccl:nccl_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnearest_neighbor:nearest_neighbor_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnn:nn_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fopt:opt_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Foptimizer_v2:optimizer_v2_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fperiodic_resample:init_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fpredictor\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fproto\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fquantization:quantization_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fquantize:quantize_graph\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Freceptive_field:receptive_field_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frecurrent:recurrent_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Freduce_slice_ops:reduce_slice_ops_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fremote_fused_graph\u002Fpylib:remote_fused_graph_ops_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fresampler:resampler_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frnn:rnn_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frpc\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsaved_model:saved_model_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fseq2seq:seq2seq_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsignal:signal_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fslim\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fslim:nets\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsolvers:solvers_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsparsemax:sparsemax_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fspecs\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fstaging\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fstat_summarizer:stat_summarizer_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fstateless\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsummary:summary\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:init_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensorboard\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftesting:testing_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftext:text_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftfprof\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftimeseries\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftpu\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftraining:training_py\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Futil:util_py\",\n        \"\u002F\u002Ftensorflow\u002Fpython:util\",\n        \"\u002F\u002Ftensorflow\u002Fpython\u002Festimator:estimator_py\",\n    ] + if_mpi([\"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmpi_collectives:mpi_collectives_py\"]) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_kafka_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkafka\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkinesis\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ffused_conv:fused_conv_py\",\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensorrt:init_py\",\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fffmpeg:ffmpeg_ops_py\",\n         ],\n     }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fbigtable\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcloud:cloud_py\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_ignite_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fignite\",\n         ],\n     }),\n )\n\ncc_library(\n    name = \"contrib_kernels\",\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n    deps = [\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fboosted_trees:boosted_trees_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcoder:all_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ffactorization\u002Fkernels:all_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fhadoop:dataset_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Finput_pipeline:input_pipeline_ops_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flayers:sparse_feature_cross_op_kernel\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnearest_neighbor:nearest_neighbor_ops_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frnn:all_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fseq2seq:beam_search_ops_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:model_ops_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:stats_ops_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:tensor_forest_kernels\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftext:all_kernels\",\n     ] + if_mpi([\"\u002F\u002Ftensorflow\u002Fcontrib\u002Fmpi_collectives:mpi_collectives_py\"]) + if_cuda([\n         \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnccl:nccl_kernels\",\n     ]) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n         \"\u002F\u002Ftensorflow:linux_s390x\": [],\n         \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_kafka_support\": [],\n         \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkafka:dataset_kernels\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkinesis:dataset_kernels\",\n        ],\n    }) + if_not_windows([\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensorrt:trt_engine_op_kernel\",\n    ]),\n )\n\ncc_library(\n    name = \"contrib_ops_op_lib\",\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n    deps = [\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fboosted_trees:boosted_trees_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcoder:all_ops\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ffactorization:all_ops\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fframework:all_ops\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fhadoop:dataset_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Finput_pipeline:input_pipeline_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flayers:sparse_feature_cross_op_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnccl:nccl_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnearest_neighbor:nearest_neighbor_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frnn:all_ops\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fseq2seq:beam_search_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:model_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:stats_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:tensor_forest_ops_op_lib\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftext:all_ops\",\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftpu:all_ops\",\n    ] + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n         \"\u002F\u002Ftensorflow:linux_s390x\": [],\n         \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_kafka_support\": [],\n         \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkafka:dataset_ops_op_lib\",\n         ],\n     }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkinesis:dataset_ops_op_lib\",\n        ],\n    }) + if_not_windows([\n        \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensorrt:trt_engine_op_op_lib\",\n    ]) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_ignite_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fignite:dataset_ops_op_lib\",\n         ],\n     }),\n )\n```\n- tensorflow\u002Fcore\u002Fplatform\u002Fdefault\u002Fbuild_config.bzl\n```\n\n\n# 平台特定的构建配置。\n\nload(\"@protobuf_archive\u002F\u002F:protobuf.bzl\", \"proto_gen\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_not_mobile\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_windows\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_not_windows\")\nload(\"\u002F\u002Ftensorflow\u002Fcore:platform\u002Fdefault\u002Fbuild_config_root.bzl\", \"if_static\")\nload(\"@local_config_cuda\u002F\u002Fcuda:build_defs.bzl\", \"if_cuda\")\nload(\n    \"\u002F\u002Fthird_party\u002Fmkl:build_defs.bzl\",\n    \"if_mkl_ml\",\n)\n\n# 向依赖列表添加后缀。\ndef tf_deps(deps, suffix):\n    tf_deps = []\n\n    # 如果包名是简写形式（即不包含“:”），\n    # 则将其扩展为完整名称。\n    for dep in deps:\n        tf_dep = dep\n\n        if not \":\" in dep:\n            dep_pieces = dep.split(\"\u002F\")\n            tf_dep += \":\" + dep_pieces[len(dep_pieces) - 1]\n\n        tf_deps += [tf_dep + suffix]\n\n    return tf_deps\n\n# 修改自 @cython\u002F\u002F:Tools\u002Frules.bzl\ndef pyx_library(\n        name,\n        deps = [],\n        py_deps = [],\n        srcs = [],\n        **kwargs):\n    \"\"\"编译一组 .pyx \u002F .pxd \u002F .py 文件。\n\n    首先运行 Cython，为每个输入的 .pyx 或 .py + .pxd 对生成 .cpp 文件。然后为每个文件构建一个共享对象，并将 \"deps\" 传递给每个 cc_binary 规则（默认包含 Python 头文件）。最后，使用这些共享对象以及任何纯 Python 的 \"srcs\" 创建一个 py_library 规则，其依赖项为 py_deps；这些共享对象可以像普通 Python 文件一样被导入。\n\n    参数：\n      name: 规则的名称。\n      deps: Cython 的 C\u002FC++ 依赖项（例如 NumPy 头文件）。\n      py_deps: 最终库的纯 Python 依赖项。\n      srcs: 要编译或直接传递的 .py、.pyx 或 .pxd 文件。\n      **kwargs: 传递给 py_library 的额外关键字参数。\n    \"\"\"\n\n    # 首先过滤出需要编译和直接传递的文件。\n    py_srcs = []\n    pyx_srcs = []\n    pxd_srcs = []\n    for src in srcs:\n        if src.endswith(\".pyx\") 或 (src.endswith(\".py\") 并且 src[:-3] + \".pxd\" 在 srcs 中)：\n            pyx_srcs.append(src)\n        elif src.endswith(\".py\"):\n            py_srcs.append(src)\n        else:\n            pxd_srcs.append(src)\n        如果 src.endswith(\"__init__.py\"):\n            pxd_srcs.append(src)\n\n    # 调用 cython 生成共享对象库。\n    for filename in pyx_srcs:\n        native.genrule(\n            name = filename + \"_cython_translation\",\n            srcs = [filename],\n            outs = [filename.split(\".\")[0] + \".cpp\"],\n            # 在 Linux 平台上可以选择使用 PYTHON_BIN_PATH，以便使用 Python 3。Windows 上使用 cython_binary 会有问题，因此跳过 PYTHON_BIN_PATH。\n            cmd = \"PYTHONHASHSEED=0 $(location @cython\u002F\u002F:cython_binary) --cplus $(SRCS) --output-file $(OUTS)\",\n            tools = [\"@cython\u002F\u002F:cython_binary\"] + pxd_srcs,\n        )\n\n    shared_objects = []\n    for src in pyx_srcs:\n        stem = src.split(\".\")[0]\n        shared_object_name = stem + \".so\"\n        native.cc_binary(\n            name = shared_object_name,\n            srcs = [stem + \".cpp\"],\n            deps = deps + [\"\u002F\u002Fthird_party\u002Fpython_runtime:headers\"],\n            linkshared = 1,\n        )\n        shared_objects.append(shared_object_name)\n\n    # 现在创建一个 py_library，将这些共享对象作为 data。\n    native.py_library(\n        name = name,\n        srcs = py_srcs,\n        deps = py_deps,\n        srcs_version = \"PY2AND3\",\n        data = shared_objects，\n        **kwargs\n    )\n\ndef _proto_cc_hdrs(srcs, use_grpc_plugin = False):\n    ret = [s[:-len(\".proto\")] + \".pb.h\" for s in srcs]\n    如果 use_grpc_plugin：\n        ret += [s[:-len(\".proto\")] + \".grpc.pb.h\" for s in srcs]\n    返回 ret\n\ndef _proto_cc_srcs(srcs, use_grpc_plugin = False):\n    ret = [s[:-len(\".proto\")] + \".pb.cc\" for s in srcs]\n    如果 use_grpc_plugin：\n        ret += [s[:-len(\".proto\")] + \".grpc.pb.cc\" for s in srcs]\n    返回 ret\n\ndef _proto_py_outs(srcs, use_grpc_plugin = False):\n    ret = [s[:-len(\".proto\")] + \"_pb2.py\" for s in srcs]\n    如果 use_grpc_plugin：\n        ret += [s[:-len(\".proto\")] + \"_pb2_grpc.py\" for s in srcs]\n    返回 ret\n\n# 重新定义协议缓冲规则，以允许构建“仅头文件”协议缓冲区，从而避免重复注册。同时也支持非可迭代的 cc_libs。\n\n# 包含 select() 语句。\ndef cc_proto_library(\n        name,\n        srcs = [],\n        deps = [],\n        cc_libs = [],\n        include = None,\n        protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n        internal_bootstrap_hack = False,\n        use_grpc_plugin = False,\n        use_grpc_namespace = False,\n        default_header = False,\n        **kargs):\n    \"\"\"用于从 proto 源文件创建 C++ protobuf 库的 Bazel 规则。\n\n    Args:\n      name: cc_proto_library 的名称。\n      srcs: cc_proto_library 的 .proto 文件。\n      deps: 依赖标签列表；必须是 cc_proto_library。\n      cc_libs: 由生成的 cc_library 所依赖的其他 cc_library 目标列表。\n      include: 指示 .proto 文件包含路径的字符串。\n      protoc: 用于生成源代码的协议编译器标签。\n      internal_bootstrap_hack: 标志，表示该 cc_proto_library 仅用于引导加载。当设置为 True 时，不会生成任何文件。该规则将简单地作为 .proto 文件的提供者，以便其他 cc_proto_library 可以依赖它。\n      use_grpc_plugin: 标志，用于指示在处理 proto 文件时是否调用 grpc C++ 插件。\n      default_header: 控制生成规则的命名。如果为 True，则 `name` 规则将是纯头文件规则，而 _impl 规则将包含实现。否则，必须显式引用纯头文件规则（name + \"_headers_only\"）。\n      **kargs: 传递给 cc_library 的其他关键字参数。\n    \"\"\"\n\n    includes = []\n    if include != None:\n        includes = [include]\n\n    if internal_bootstrap_hack:\n        # 对于预先检入的生成文件，我们添加 internal_bootstrap_hack 标志，这将跳过代码生成操作。\n        proto_gen(\n            name = name + \"_genproto\",\n            srcs = srcs,\n            includes = includes，\n            protoc = protoc，\n            visibility = [\"\u002F\u002Fvisibility:public\"]，\n            deps = [s + \"_genproto\" for s in deps]，\n        )\n\n        # 一个空的 cc_library，以使规则依赖关系一致。\n        native.cc_library(\n            name = name，\n            **kargs\n        )\n        return\n\n    grpc_cpp_plugin = None\n    plugin_options = []\n    if use_grpc_plugin:\n        grpc_cpp_plugin = \"\u002F\u002Fexternal:grpc_cpp_plugin\"\n        if use_grpc_namespace:\n            plugin_options = [\"services_namespace=grpc\"]\n\n    gen_srcs = _proto_cc_srcs(srcs, use_grpc_plugin)\n    gen_hdrs = _proto_cc_hdrs(srcs, use_grpc_plugin)\n    outs = gen_srcs + gen_hdrs\n\n    proto_gen(\n        name = name + \"_genproto\",\n        srcs = srcs,\n        outs = outs,\n        gen_cc = 1,\n        includes = includes,\n        plugin = grpc_cpp_plugin,\n        plugin_language = \"grpc\",\n        plugin_options = plugin_options,\n        protoc = protoc,\n        visibility = [\"\u002F\u002Fvisibility:public\"],\n        deps = [s + \"_genproto\" for s in deps],\n    )\n\n    if use_grpc_plugin:\n        cc_libs += select({\n            \"\u002F\u002Ftensorflow:linux_s390x\": [\"\u002F\u002Fexternal:grpc_lib_unsecure\"],\n            \"\u002F\u002Fconditions:default\": [\"\u002F\u002Fexternal:grpc_lib\"],\n        })\n\n    if default_header:\n        header_only_name = name\n        impl_name = name + \"_impl\"\n    else:\n        header_only_name = name + \"_headers_only\"\n        impl_name = name\n\n    native.cc_library(\n        name = impl_name,\n        srcs = gen_srcs,\n        hdrs = gen_hdrs,\n        deps = cc_libs + deps,\n        includes = includes,\n        **kargs\n    )\n    native.cc_library(\n        name = header_only_name,\n        deps = [\"@protobuf_archive\u002F\u002F:protobuf_headers\"] + if_static([impl_name]),\n        hdrs = gen_hdrs,\n        **kargs\n    )\n\n# 重新定义协议缓冲区规则，以引入 commit https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fprotobuf\u002Fcommit\u002F294b5758c373cbab4b72f35f4cb62dc1d8332b68 中引入的更改，\n# 该更改并未包含在 2018 年 4 月的稳定版 protobuf 发布中。\n# TODO(jsimsa): 一旦 protobuf 依赖版本更新到包含上述 commit，就移除此规则。\ndef py_proto_library(\n        name,\n        srcs = [],\n        deps = [],\n        py_libs = [],\n        py_extra_srcs = [],\n        include = None,\n        default_runtime = \"@protobuf_archive\u002F\u002F:protobuf_python\",\n        protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n        use_grpc_plugin = False,\n        **kargs):\n    \"\"\"用于从 proto 源文件创建 Python protobuf 库的 Bazel 规则\n\n    注意：该规则仅为内部 workaround，用于生成 proto。接口可能会发生变化，并且当 Bazel 引入原生规则时，该规则可能会被移除。\n\n    Args:\n      name: py_proto_library 的名称。\n      srcs: py_proto_library 的 .proto 文件。\n      deps: 依赖标签列表；必须是 py_proto_library。\n      py_libs: 由生成的 py_library 所依赖的其他 py_library 目标列表。\n      py_extra_srcs: 将添加到输出 py_library 中的额外源文件。此属性用于内部引导加载。\n      include: 指示 .proto 文件包含路径的字符串。\n      default_runtime: 默认运行时，生成的 py_library 目标将依赖于此。\n      protoc: 用于生成源代码的协议编译器标签。\n      use_grpc_plugin: 标志，用于指示在处理 proto 文件时是否调用 Python C++ 插件。\n      **kargs: 传递给 cc_library 的其他关键字参数。\n    \"\"\"\n    outs = _proto_py_outs(srcs, use_grpc_plugin)\n\n    includes = []\n    if include != None:\n        includes = [include]\n\n    grpc_python_plugin = None\n    if use_grpc_plugin:\n        grpc_python_plugin = \"\u002F\u002Fexternal:grpc_python_plugin\"\n        # 注意：生成的 grpc 代码依赖于 Python grpc 模块。此依赖项并未明确列在 py_libs 中，而是假定主机系统已安装 grpc。\n\n    proto_gen(\n        name = name + \"_genproto\",\n        srcs = srcs,\n        outs = outs,\n        gen_py = 1,\n        includes = includes,\n        plugin = grpc_python_plugin,\n        plugin_language = \"grpc\",\n        protoc = protoc,\n        visibility = [\"\u002F\u002Fvisibility:public\"],\n        deps = [s + \"_genproto\" for s in deps],\n    )\n\n    if default_runtime 和 default_runtime 不在 py_libs + deps 中：\n        py_libs = py_libs + [default_runtime]\n\n    native.py_library(\n        name = name,\n        srcs = outs + py_extra_srcs,\n        deps = py_libs + deps,\n        imports = includes,\n        **kargs\n    )\n\ndef tf_proto_library_cc(\n        name,\n        srcs = [],\n        has_services = None,\n        protodeps = [],\n        visibility = [],\n        testonly = 0,\n        cc_libs = [],\n        cc_stubby_versions = None,\n        cc_grpc_version = None,\n        j2objc_api_version = 1,\n        cc_api_version = 2,\n        dart_api_version = 2,\n        java_api_version = 2,\n        py_api_version = 2,\n        js_api_version = 2,\n        js_codegen = \"jspb\",\n        default_header = False):\n    js_codegen = js_codegen  # 未使用的参数\n    js_api_version = js_api_version  # 未使用的参数\n    native.filegroup(\n        name = name + \"_proto_srcs\",\n        srcs = srcs + tf_deps(protodeps, \"_proto_srcs\"),\n        testonly = testonly,\n        visibility = visibility,\n    )\n\n    use_grpc_plugin = None\n    if cc_grpc_version:\n        use_grpc_plugin = True\n\n    cc_deps = tf_deps(protodeps, \"_cc\")\n    cc_name = name + \"_cc\"\n    if not srcs:\n        # 这是一个子库的集合。构建仅包含头文件和实现的库，其中包含所有源文件。\n        proto_gen(\n            name = cc_name + \"_genproto\",\n            protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n            visibility = [\"\u002F\u002Fvisibility:public\"],\n            deps = [s + \"_genproto\" for s in cc_deps],\n        )\n        native.cc_library(\n            name = cc_name,\n            deps = cc_deps + [\"@protobuf_archive\u002F\u002F:protobuf_headers\"] + if_static([name + \"_cc_impl\"]),\n            testonly = testonly,\n            visibility = visibility,\n        )\n        native.cc_library(\n            name = cc_name + \"_impl\",\n            deps = [s + \"_impl\" for s in cc_deps] + [\"@protobuf_archive\u002F\u002F:cc_wkt_protos\"],\n        )\n\n        return\n\n    cc_proto_library(\n        name = cc_name,\n        testonly = testonly,\n        srcs = srcs,\n        cc_libs = cc_libs + if_static(\n            [\"@protobuf_archive\u002F\u002F:protobuf\"],\n            [\"@protobuf_archive\u002F\u002F:protobuf_headers\"],\n        ),\n        copts = if_not_windows([\n            \"-Wno-unknown-warning-option\",\n            \"-Wno-unused-but-set-variable\",\n            \"-Wno-sign-compare\",\n        ]),\n        default_header = default_header,\n        protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n        use_grpc_plugin = use_grpc_plugin,\n        visibility = visibility,\n        deps = cc_deps + [\"@protobuf_archive\u002F\u002F:cc_wkt_protos\"],\n    )\n\ndef tf_proto_library_py(\n        name,\n        srcs = [],\n        protodeps = [],\n        deps = [],\n        visibility = [],\n        testonly = 0,\n        srcs_version = \"PY2AND3\",\n        use_grpc_plugin = False):\n    py_deps = tf_deps(protodeps, \"_py\")\n    py_name = name + \"_py\"\n    if not srcs:\n        # 这是一个子库的集合。构建仅包含头文件和实现的库，其中包含所有源文件。\n        proto_gen(\n            name = py_name + \"_genproto\",\n            protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n            visibility = [\"\u002F\u002Fvisibility:public\"],\n            deps = [s + \"_genproto\" for s in py_deps],\n        )\n        native.py_library(\n            name = py_name,\n            deps = py_deps + [\"@protobuf_archive\u002F\u002F:protobuf_python\"],\n            testonly = testonly,\n            visibility = visibility,\n        )\n        return\n\n    py_proto_library(\n        name = py_name,\n        testonly = testonly,\n        srcs = srcs,\n        default_runtime = \"@protobuf_archive\u002F\u002F:protobuf_python\",\n        protoc = \"@protobuf_archive\u002F\u002F:protoc\",\n        srcs_version = srcs_version,\n        use_grpc_plugin = use_grpc_plugin,\n        visibility = visibility,\n        deps = deps + py_deps + [\"@protobuf_archive\u002F\u002F:protobuf_python\"],\n    )\n\ndef tf_jspb_proto_library(**kwargs):\n    pass\n\ndef tf_nano_proto_library(**kwargs):\n    pass\n\ndef tf_proto_library(\n        name,\n        srcs = [],\n        has_services = None,\n        protodeps = [],\n        visibility = [],\n        testonly = 0,\n        cc_libs = [],\n        cc_api_version = 2,\n        cc_grpc_version = None,\n        dart_api_version = 2,\n        j2objc_api_version = 1,\n        java_api_version = 2,\n        py_api_version = 2,\n        js_api_version = 2,\n        js_codegen = \"jspb\",\n        provide_cc_alias = False,\n        default_header = False):\n    \"\"\"创建一个协议缓冲区库，可能依赖于其他协议缓冲区库。\"\"\"\n    _ignore = (js_api_version, js_codegen, provide_cc_alias)\n\n    tf_proto_library_cc(\n        name = name,\n        testonly = testonly,\n        srcs = srcs,\n        cc_grpc_version = cc_grpc_version,\n        cc_libs = cc_libs,\n        default_header = default_header,\n        protodeps = protodeps,\n        visibility = visibility,\n    )\n\n    tf_proto_library_py(\n        name = name,\n        testonly = testonly,\n        srcs = srcs,\n        protodeps = protodeps,\n        srcs_version = \"PY2AND3\",\n        use_grpc_plugin = has_services,\n        visibility = visibility,\n    )\n\n\n\n# 平台下所有符合‘files’中模式的文件列表。与下面的‘tf_platform_srcs’不同，后者有选择性地收集必须在‘default’平台上编译的文件，而这是一个包含所有头文件的列表。\n\n# 在 platform\u002F* 文件中提及。\ndef tf_platform_hdrs(files):\n    return native.glob([\"platform\u002F*\u002F\" + f for f in files])\n\ndef tf_platform_srcs(files):\n    base_set = [\"platform\u002Fdefault\u002F\" + f for f in files]\n    windows_set = base_set + [\"platform\u002Fwindows\u002F\" + f for f in files]\n    posix_set = base_set + [\"platform\u002Fposix\u002F\" + f for f in files]\n\n    # 处理必须同时引入 POSIX 文件的情况。通常，在 Windows 构建中要编译的文件列表只是 windows_set 中的所有内容。然而，在某些情况下，'posix\u002F' 中的实现正是所需的，从历史上看，我们选择直接使用 POSIX 文件，而不是在 'windows\u002F' 中复制一份。\n    for f in files:\n        if f == \"error.cc\":\n            windows_set.append(\"platform\u002Fposix\u002F\" + f)\n\n    return select({\n        \"\u002F\u002Ftensorflow:windows\": native.glob(windows_set),\n        \"\u002F\u002Fconditions:default\": native.glob(posix_set),\n    })\n\ndef tf_additional_lib_hdrs(exclude = []):\n    windows_hdrs = native.glob([\n        \"platform\u002Fdefault\u002F*.h\",\n        \"platform\u002Fwindows\u002F*.h\",\n        \"platform\u002Fposix\u002Ferror.h\",\n    ], exclude = exclude)\n    return select({\n        \"\u002F\u002Ftensorflow:windows\": windows_hdrs,\n        \"\u002F\u002Fconditions:default\": native.glob([\n            \"platform\u002Fdefault\u002F*.h\",\n            \"platform\u002Fposix\u002F*.h\",\n        ], exclude = exclude),\n    })\n\ndef tf_additional_lib_srcs(exclude = []):\n    windows_srcs = native.glob([\n        \"platform\u002Fdefault\u002F*.cc\",\n        \"platform\u002Fwindows\u002F*.cc\",\n        \"platform\u002Fposix\u002Ferror.cc\",\n    ], exclude = exclude)\n    return select({\n        \"\u002F\u002Ftensorflow:windows\": windows_srcs,\n        \"\u002F\u002Fconditions:default\": native.glob([\n            \"platform\u002Fdefault\u002F*.cc\",\n            \"platform\u002Fposix\u002F*.cc\",\n        ], exclude = exclude),\n    })\n\ndef tf_additional_minimal_lib_srcs():\n    return [\n        \"platform\u002Fdefault\u002Fintegral_types.h\",\n        \"platform\u002Fdefault\u002Fmutex.h\",\n    ]\n\ndef tf_additional_proto_hdrs():\n    return [\n        \"platform\u002Fdefault\u002Fintegral_types.h\",\n        \"platform\u002Fdefault\u002Flogging.h\",\n        \"platform\u002Fdefault\u002Fprotobuf.h\",\n    ] + if_windows([\n        \"platform\u002Fwindows\u002Fintegral_types.h\",\n    ])\n\ndef tf_additional_proto_compiler_hdrs():\n    return [\n        \"platform\u002Fdefault\u002Fprotobuf_compiler.h\",\n    ]\n\ndef tf_additional_proto_srcs():\n    return [\n        \"platform\u002Fdefault\u002Fprotobuf.cc\",\n    ]\n\ndef tf_additional_human_readable_json_deps():\n    return []\n\ndef tf_additional_all_protos():\n    return [\"\u002F\u002Ftensorflow\u002Fcore:protos_all\"]\n\ndef tf_protos_all_impl():\n    return [\"\u002F\u002Ftensorflow\u002Fcore:protos_all_cc_impl\"]\n\ndef tf_protos_all():\n    return if_static(\n        extra_deps = tf_protos_all_impl(),\n        otherwise = [\"\u002F\u002Ftensorflow\u002Fcore:protos_all_cc\"],\n    )\n\ndef tf_protos_grappler_impl():\n    return [\"\u002F\u002Ftensorflow\u002Fcore\u002Fgrappler\u002Fcosts:op_performance_data_cc_impl\"]\n\ndef tf_protos_grappler():\n    return if_static(\n        extra deps = tf_protos_grappler_impl(),\n        otherwise = [\"\u002F\u002Ftensorflow\u002Fcore\u002Fgrappler\u002Fcosts:op_performance_data_cc\"],\n    )\n\ndef tf_additional_cupti_wrapper_deps():\n    return [\"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fdefault\u002Fgpu:cupti_wrapper\"]\n\ndef tf_additional_device_tracer_srcs():\n    return [\"platform\u002Fdefault\u002Fdevice_tracer.cc\"]\n\ndef tf_additional_device_tracer_cuda_deps():\n    return []\n\ndef tf_additional_device_tracer_deps():\n    return []\n\ndef tf_additional_libdevice_data():\n    return []\n\ndef tf_additional_libdevice_deps():\n    return [\"@local_config_cuda\u002F\u002Fcuda:cuda_headers\"]\n\ndef tf_additional_libdevice_srcs():\n    return [\"platform\u002Fdefault\u002Fcuda_libdevice_path.cc\"]\n\ndef tf_additional_test_deps():\n    return []\n\ndef tf additional_test srcs():\n    return [\n        \"platform\u002Fdefault\u002Ftest_benchmark.cc\",\n    ] + select({\n        \"\u002F\u002Ftensorflow:windows\": [\n            \"platform\u002Fwindows\u002Ftest.cc\",\n        ],\n        \"\u002F\u002Fconditions:default\": [\n            \"platform\u002Fposix\u002Ftest.cc\",\n        ],\n    })\n\ndef tf_kernel_tests_linkstatic():\n    return 0\n\ndef tf_additional_lib_defines():\n    \"\"\"构建 TF 库所需的额外宏定义\"\"\"\n    return []\n\ndef tf_additional_lib_deps():\n    \"\"\"构建 TF 库所需的额外依赖\"\"\"\n    return [\n        \"@com_google_absl\u002F\u002Fabsl\u002Fbase:base\",\n        \"@com_google_absl\u002F\u002Fabsl\u002Fcontainer:inlined_vector\",\n        \"@com_google_absl\u002F\u002Fabsl\u002Ftypes:span\",\n        \"@com_google_absl\u002F\u002Fabsl\u002Ftypes:optional\",\n    ] + if_static(\n        [\"@nsync\u002F\u002F:nsync_cpp\"],\n        [\"@nsync\u002F\u002F:nsync_headers\"],\n    )\n\ndef tf_additional_core_deps():\n     return select({\n         \"\u002F\u002Ftensorflow:android\": [],\n         \"\u002F\u002Ftensorflow:ios\": [],\n         \"\u002F\u002Ftensorflow:linux_s390x\": [],\n         \"\u002F\u002Ftensorflow:windows\": [],\n         \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n         \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fcloud:gcs_file_system\",\n         ],\n     }) + select({\n         \"\u002F\u002Ftensorflow:android\": [],\n         \"\u002F\u002Ftensorflow:ios\": [],\n         \"\u002F\u002Ftensorflow:linux_s390x\": [],\n         \"\u002F\u002Ftensorflow:windows\": [],\n         \"\u002F\u002Ftensorflow:no_hdfs_support\": [],\n         \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fhadoop:hadoop_file_system\",\n         ],\n     }) + select({\n         \"\u002F\u002Ftensorflow:android\": [],\n         \"\u002F\u002Ftensorflow:ios\": [],\n         \"\u002F\u002Ftensorflow:linux_s390x\": [],\n         \"\u002F\u002Ftensorflow:windows\": [],\n         \"\u002F\u002Ftensorflow:no_aws_support\": [],\n         \"\u002F\u002Fconditions:default\": [\n             \"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fs3:s3_file_system\",\n         ],\n     })\n\n# TODO(jart, jhseu): 当 GCP 成为默认配置时删除。\ndef tf_additional_cloud_op_deps():\n    return select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n           \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcloud:bigquery_reader_ops_op_lib\",\n           \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcloud:gcs_config_ops_op_lib\",\n       ],\n   })\n\n# TODO(jart, jhseu): 在 GCP 成为默认启用时删除\ndef tf_additional_cloud_kernel_deps():\n    return select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcloud\u002Fkernels:bigquery_reader_ops\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcloud\u002Fkernels:gcs_config_ops\",\n        ],\n    })\n\ndef tf_lib_proto_parsing_deps():\n    return [\n        \":protos_all_cc\",\n        \"\u002F\u002Fthird_party\u002Feigen3\",\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fdefault\u002Fbuild_config:proto_parsing\",\n    ]\n\ndef tf_lib_proto_compiler_deps():\n    return [\n        \"@protobuf_archive\u002F\u002F:protoc_lib\",\n    ]\n\ndef tf_additional_verbs_lib_defines():\n    return select({\n        \"\u002F\u002Ftensorflow:with_verbs_support\": [\"TENSORFLOW_USE_VERBS\"],\n        \"\u002F\u002Fconditions:default\": [],\n    })\n\ndef tf_additional_mpi_lib_defines():\n    return select({\n        \"\u002F\u002Ftensorflow:with_mpi_support\": [\"TENSORFLOW_USE_MPI\"],\n        \"\u002F\u002Fconditions:default\": [],\n    })\n\ndef tf_additional_gdr_lib_defines():\n    return select({\n        \"\u002F\u002Ftensorflow:with_gdr_support\": [\"TENSORFLOW_USE_GDR\"],\n        \"\u002F\u002Fconditions:default\": [],\n    })\n\ndef tf_py_clif_cc(name, visibility = None, **kwargs):\n    pass\n\ndef tf_pyclif_proto_library(\n        name,\n        proto_lib,\n        proto_srcfile = \"\",\n        visibility = None,\n        **kwargs):\n    pass\n\ndef tf_additional_binary_deps():\n    return [\"@nsync\u002F\u002F:nsync_cpp\"] + if_cuda(\n        [\n            \"\u002F\u002Ftensorflow\u002Fstream_executor:cuda_platform\",\n            \"\u002F\u002Ftensorflow\u002Fcore\u002Fplatform\u002Fdefault\u002Fbuild_config:cuda\",\n        ],\n    ) + [\n        \u002F\u002F TODO(allenl): 将这些拆分成各自的共享对象（目前放在这里是因为它们在 contrib\u002F 操作的共享对象和 core 之间共享）。\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Fkernels:lookup_util\",\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Futil\u002Ftensor_bundle\",\n    ] + if_mkl_ml(\n        [\n            \"\u002F\u002Fthird_party\u002Fmkl:intel_binary_blob\",\n        ],\n    )\n```\n- tensorflow\u002Ftools\u002Flib_package\u002FBUILD\n```\n# 用于 TensorFlow 非 Python API（pip whl）相关工件的打包。\n# 包括 C API、Java API 和协议缓冲区文件。\n\npackage(default_visibility = [\"\u002F\u002Fvisibility:private\"])\n\nload(\"@bazel_tools\u002F\u002Ftools\u002Fbuild_defs\u002Fpkg:pkg.bzl\", \"pkg_tar\")\nload(\"@local_config_syslibs\u002F\u002F:build_defs.bzl\", \"if_not_system_lib\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"tf_binary_additional_srcs\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_cuda\")\nload(\"\u002F\u002Fthird_party\u002Fmkl:build_defs.bzl\", \"if_mkl\")\n\ngenrule(\n    name = \"libtensorflow_proto\",\n    srcs = [\"\u002F\u002Ftensorflow\u002Fcore:protos_all_proto_srcs\"],\n    outs = [\"libtensorflow_proto.zip\"],\n    cmd = \"zip $@ $(SRCS)\",\n)\n\npkg_tar(\n    name = \"libtensorflow\",\n    extension = \"tar.gz\",\n    # 标记为“manual”直到\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # 和 https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # 解决，否则这些规则在使用 Python 3 构建时会出错。\n    tags = [\"manual\"],\n    deps = [\n        \":cheaders\",\n        \":clib\",\n        \":clicenses\",\n        \":eager_cheaders\",\n    ],\n)\n\npkg_tar(\n    name = \"libtensorflow_jni\",\n    extension = \"tar.gz\",\n    files = [\n        \"include\u002Ftensorflow\u002Fjni\u002FLICENSE\",\n        \"\u002F\u002Ftensorflow\u002Fjava:libtensorflow_jni\",\n    ],\n    # 标记为“manual”直到\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # 和 https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # 解决，否则这些规则在使用 Python 3 构建时会出错。\n    tags = [\"manual\"],\n    deps = [\":common_deps\"],\n)\n\n# 所有 TensorFlow 库都依赖的共享对象。\npkg_tar(\n    name = \"common_deps\",\n    files = tf_binary_additional_srcs(),\n    tags = [\"manual\"],\n)\n\npkg_tar(\n    name = \"cheaders\",\n    files = [\n        \"\u002F\u002Ftensorflow\u002Fc:headers\",\n    ],\n    package_dir = \"include\u002Ftensorflow\u002Fc\",\n    # 标记为“manual”直到\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # 和 https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # 解决，否则这些规则在使用 Python 3 构建时会出错。\n    tags = [\"manual\"],\n)\n\npkg_tar(\n    name = \"eager_cheaders\",\n    files = [\n        \"\u002F\u002Ftensorflow\u002Fc\u002Feager:headers\",\n    ],\n    package_dir = \"include\u002Ftensorflow\u002Fc\u002Feager\",\n    # 标记为“manual”直到\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # 和 https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # 解决，否则这些规则在使用 Python 3 构建时会出错。\n    tags = [\"manual\"],\n)\n\npkg_tar(\n    name = \"clib\",\n    files = [\"\u002F\u002Ftensorflow:libtensorflow.so\"],\n    package_dir = \"lib\",\n    # 标记为“manual”直到\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # 和 https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # 解决，否则这些规则在使用 Python 3 构建时会出错。\n    tags = [\"manual\"],\n    deps = [\":common_deps\"],\n)\n\npkg_tar(\n    name = \"clicenses\",\n    files = [\":include\u002Ftensorflow\u002Fc\u002FLICENSE\"],\n    package_dir = \"include\u002Ftensorflow\u002Fc\",\n    # 标记为“manual”直到\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # 和 https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # 解决，否则这些规则在使用 Python 3 构建时会出错。\n    tags = [\"manual\"],\n)\n\ngenrule(\n    name = \"clicenses_generate\",\n    srcs = [\n        \"\u002F\u002Fthird_party\u002Fhadoop:LICENSE.txt\",\n        \"\u002F\u002Fthird_party\u002Feigen3:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Ffft2d:LICENSE\",\n        \"@boringssl\u002F\u002F:LICENSE\",\n        \"@com_googlesource_code_re2\u002F\u002F:LICENSE\",\n        \"@curl\u002F\u002F:COPYING\",\n        \"@double_conversion\u002F\u002F:LICENSE\",\n        \"@eigen_archive\u002F\u002F:COPYING.MPL2\",\n        \"@farmhash_archive\u002F\u002F:COPYING\",\n        \"@fft2d\u002F\u002F:fft\u002Freadme.txt\",\n        \"@gemmlowp\u002F\u002F:LICENSE\",\n        \"@gif_archive\u002F\u002F:COPYING\",\n        \"@highwayhash\u002F\u002F:LICENSE\",\n        \"@icu\u002F\u002F:icu4c\u002FLICENSE\",\n        \"@jpeg\u002F\u002F:LICENSE.md\",\n        \"@llvm\u002F\u002F:LICENSE.TXT\",\n        \"@lmdb\u002F\u002F:LICENSE\",\n        \"@local_config_sycl\u002F\u002Fsycl:LICENSE.text\",\n        \"@nasm\u002F\u002F:LICENSE\",\n        \"@nsync\u002F\u002F:LICENSE\",\n        \"@png_archive\u002F\u002F:LICENSE\",\n        \"@protobuf_archive\u002F\u002F:LICENSE\",\n        \"@snappy\u002F\u002F:COPYING\",\n        \"@zlib_archive\u002F\u002F:zlib.h\",\n    ] + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@aws\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@com_github_googlecloudplatform_google_cloud_cpp\u002F\u002F:LICENSE\",\n        ],\n   }) + select({\n\n\"\u002F\u002Ftensorflow\u002Fcore\u002Fkernels:xsmm\": [\n            \"@libxsmm_archive\u002F\u002F:LICENSE.md\",\n        ],\n        \"\u002F\u002Fconditions:default\": [],\n    }) + if_cuda([\n        \"@cub_archive\u002F\u002F:LICENSE.TXT\",\n    ]) + if_mkl([\n        \"\u002F\u002Fthird_party\u002Fmkl:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Fmkl_dnn:LICENSE\",\n    ]) + if_not_system_lib(\n        \"grpc\",\n        [\n            \"@grpc\u002F\u002F:LICENSE\",\n            \"@grpc\u002F\u002Fthird_party\u002Fnanopb:LICENSE.txt\",\n            \"@grpc\u002F\u002Fthird_party\u002Faddress_sorting:LICENSE\",\n        ],\n    ),\n    outs = [\"include\u002Ftensorflow\u002Fc\u002FLICENSE\"],\n    cmd = \"$(location :concat_licenses.sh) $(SRCS) >$@\",\n    tools = [\":concat_licenses.sh\"],\n)\n\ngenrule(\n    name = \"jnilicenses_generate\",\n    srcs = [\n        \"\u002F\u002Fthird_party\u002Fhadoop:LICENSE.txt\",\n        \"\u002F\u002Fthird_party\u002Feigen3:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Ffft2d:LICENSE\",\n        \"@boringssl\u002F\u002F:LICENSE\",\n        \"@com_googlesource_code_re2\u002F\u002F:LICENSE\",\n        \"@curl\u002F\u002F:COPYING\",\n        \"@double_conversion\u002F\u002F:LICENSE\",\n        \"@eigen_archive\u002F\u002F:COPYING.MPL2\",\n        \"@farmhash_archive\u002F\u002F:COPYING\",\n        \"@fft2d\u002F\u002F:fft\u002Freadme.txt\",\n        \"@gemmlowp\u002F\u002F:LICENSE\",\n        \"@gif_archive\u002F\u002F:COPYING\",\n        \"@highwayhash\u002F\u002F:LICENSE\",\n        \"@icu\u002F\u002F:icu4j\u002Fmain\u002Fshared\u002Flicenses\u002FLICENSE\",\n        \"@jpeg\u002F\u002F:LICENSE.md\",\n        \"@llvm\u002F\u002F:LICENSE.TXT\",\n        \"@lmdb\u002F\u002F:LICENSE\",\n        \"@local_config_sycl\u002F\u002Fsycl:LICENSE.text\",\n        \"@nasm\u002F\u002F:LICENSE\",\n        \"@nsync\u002F\u002F:LICENSE\",\n        \"@png_archive\u002F\u002F:LICENSE\",\n        \"@protobuf_archive\u002F\u002F:LICENSE\",\n        \"@snappy\u002F\u002F:COPYING\",\n        \"@zlib_archive\u002F\u002F:zlib.h\",\n    ] + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@aws\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@com_github_googlecloudplatform_google_cloud_cpp\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Fkernels:xsmm\": [\n            \"@libxsmm_archive\u002F\u002F:LICENSE.md\",\n        ],\n        \"\u002F\u002Fconditions:default\": [],\n   }) + if_cuda([\n        \"@cub_archive\u002F\u002F:LICENSE.TXT\",\n    ]) + if_mkl([\n        \"\u002F\u002Fthird_party\u002Fmkl:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Fmkl_dnn:LICENSE\",\n    ]),\n    outs = [\"include\u002Ftensorflow\u002Fjni\u002FLICENSE\"],\n    cmd = \"$(location :concat_licenses.sh) $(SRCS) >$@\",\n    tools = [\":concat_licenses.sh\"],\n)\n\nsh_test(\n    name = \"libtensorflow_test\",\n    size = \"small\",\n    srcs = [\"libtensorflow_test.sh\"],\n    data = [\n        \"libtensorflow_test.c\",\n        \":libtensorflow.tar.gz\",\n    ],\n    # 标记为“手动”，直到\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # 和 https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # 得到解决，否则这些规则在使用 Python 3 构建时会出错。\n    # 在此之前，该测试会在构建发布版时由 tensorflow\u002Ftools\u002Fci_build\u002Fbuilds\u002Flibtensorflow.sh 显式执行。\n    tags = [\"manual\"],\n)\n\nsh_test(\n    name = \"libtensorflow_java_test\",\n    size = \"small\",\n    srcs = [\"libtensorflow_java_test.sh\"],\n    data = [\n        \":LibTensorFlowTest.java\",\n        \":libtensorflow_jni.tar.gz\",\n        \"\u002F\u002Ftensorflow\u002Fjava:libtensorflow.jar\",\n    ],\n    # 标记为“手动”，直到\n    # https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F2352\n    # 和 https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F1580\n    # 得到解决，否则这些规则在使用 Python 3 构建时会出错。\n    # 在此之前，该测试会在构建发布版时由 tensorflow\u002Ftools\u002Fci_build\u002Fbuilds\u002Flibtensorflow.sh 显式执行。\n    tags = [\"manual\"],\n)\n```\n- tensorflow\u002Ftools\u002Fpip_package\u002FBUILD\n```\n\n\n# 描述：\n#  用于构建 TensorFlow pip 包的工具。\n\npackage(default_visibility = [\"\u002F\u002Fvisibility:private\"])\n\nload(\n    \"\u002F\u002Ftensorflow:tensorflow.bzl\",\n    \"if_not_windows\",\n    \"if_windows\",\n    \"transitive_hdrs\",\n)\nload(\"\u002F\u002Fthird_party\u002Fmkl:build_defs.bzl\", \"if_mkl\", \"if_mkl_ml\")\nload(\"\u002F\u002Ftensorflow:tensorflow.bzl\", \"if_cuda\")\nload(\"@local_config_syslibs\u002F\u002F:build_defs.bzl\", \"if_not_system_lib\")\nload(\"\u002F\u002Ftensorflow\u002Fcore:platform\u002Fdefault\u002Fbuild_config_root.bzl\", \"tf_additional_license_deps\")\nload(\n    \"\u002F\u002Fthird_party\u002Fngraph:build_defs.bzl\",\n    \"if_ngraph\",\n)\n\n# 这个函数返回所有公共头文件库（例如，框架、库）及其所有传递依赖项的头文件列表。虽然文件组中返回的并非所有头文件都是公开的（例如，被公共头文件包含的内部头文件），但为了确保公共头文件能够正确包含，这些内部头文件也需要被打包到 pip 包中。\n#\n# 因此，公共头文件的定义是同时满足以下两个条件的头文件：\n#\n# 1) 按照 Bazel 的定义，“公开可见”\n# 2) 具有文档说明。\n\n# 这与我们 Python API 的“public”策略相符。\ntransitive_hdrs(\n    name = \"included_headers\",\n    deps = [\n        \"\u002F\u002Ftensorflow\u002Fcore:core_cpu\",\n        \"\u002F\u002Ftensorflow\u002Fcore:framework\",\n        \"\u002F\u002Ftensorflow\u002Fcore:lib\",\n        \"\u002F\u002Ftensorflow\u002Fcore:protos_all_cc\",\n        \"\u002F\u002Ftensorflow\u002Fcore:stream_executor\",\n        \"\u002F\u002Fthird_party\u002Feigen3\",\n    ] + if_cuda([\n        \"@local_config_cuda\u002F\u002Fcuda:cuda_headers\",\n    ]),\n)\n\npy_binary(\n    name = \"simple_console\",\n    srcs = [\"simple_console.py\"],\n    srcs_version = \"PY2AND3\",\n    deps = [\"\u002F\u002Ftensorflow:tensorflow_py\"],\n)\n\nCOMMON_PIP_DEPS = [\n    \":licenses\",\n    \"MANIFEST.in\",\n    \"README\",\n    \"setup.py\",\n    \":included_headers\",\n    \"\u002F\u002Ftensorflow:tensorflow_py\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fautograph:autograph\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fboosted_trees:boosted_trees_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcluster_resolver:cluster_resolver_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fcompiler:xla\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fconstrained_optimization:constrained_optimization_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Feager\u002Fpython\u002Fexamples:examples_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Feager\u002Fpython:evaluator\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fgan:gan\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fgraph_editor:graph_editor_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fkeras:keras\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flabeled_tensor:labeled_tensor_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fnn:nn_py\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fpredictor:predictor_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fproto:proto\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Freceptive_field:receptive_field_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frate:rate\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Frpc:rpc_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsession_bundle:session_bundle_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsignal:signal_py\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsignal:test_util\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fslim:slim\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fslim\u002Fpython\u002Fslim\u002Fdata:data_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fslim\u002Fpython\u002Fslim\u002Fnets:nets_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fspecs:specs\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Fsummary:summary_test_util\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest:init_py\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftensor_forest\u002Fhybrid:hybrid_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftimeseries:timeseries_pip\",\n    \"\u002F\u002Ftensorflow\u002Fcontrib\u002Ftpu\",\n    \"\u002F\u002Ftensorflow\u002Fexamples\u002Ftutorials\u002Fmnist:package\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fconverters:converters\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fcore:core\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fcore:test_lib\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fimpl:impl\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Flang:lang\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Foperators:operators\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fpyct:pyct\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fpyct\u002Ftesting:testing\",\n    # \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fpyct\u002Fstatic_analysis:static_analysis\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fautograph\u002Fpyct\u002Fcommon_transformers:common_transformers\",\n    \"\u002F\u002Ftensorflow\u002Fpython:cond_v2\",\n    \"\u002F\u002Ftensorflow\u002Fpython:distributed_framework_test_lib\",\n    \"\u002F\u002Ftensorflow\u002Fpython:meta_graph_testdata\",\n    \"\u002F\u002Ftensorflow\u002Fpython:spectral_ops_test_util\",\n    \"\u002F\u002Ftensorflow\u002Fpython:util_example_parser_configuration\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fdata\u002Fexperimental\u002Fkernel_tests\u002Fserialization:dataset_serialization_test_base\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fdata\u002Fexperimental\u002Fkernel_tests:stats_dataset_test_base\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fdata\u002Fkernel_tests:test_base\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fdebug:debug_pip\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Feager:eager_pip\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fkernel_tests\u002Ftestdata:self_adjoint_eig_op_test_files\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Fsaved_model:saved_model\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Ftools:tools_pip\",\n    \"\u002F\u002Ftensorflow\u002Fpython\u002Ftools\u002Fapi\u002Fgenerator:create_python_api\",\n    \"\u002F\u002Ftensorflow\u002Fpython:test_ops\",\n    \"\u002F\u002Ftensorflow\u002Fpython:while_v2\",\n    \"\u002F\u002Ftensorflow\u002Ftools\u002Fdist_test\u002Fserver:grpc_tensorflow_server\",\n]\n\n# 在 Windows 上，Python 二进制文件是一个包含运行文件树的 ZIP 文件。\n# 将所有内容添加到其数据依赖中，以生成运行文件树。\n\n# 用于在 Windows 上构建 pip 包。\npy_binary(\n    name = \"simple_console_for_windows\",\n    srcs = [\"simple_console_for_windows.py\"],\n    data = COMMON_PIP_DEPS,\n    srcs_version = \"PY2AND3\",\n    deps = [\"\u002F\u002Ftensorflow:tensorflow_py\"],\n)\n\nfilegroup(\n    name = \"licenses\",\n    data = [\n        \"\u002F\u002Fthird_party\u002Feigen3:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Ffft2d:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Fhadoop:LICENSE.txt\",\n        \"@absl_py\u002F\u002Fabsl\u002Fflags:LICENSE\",\n        \"@arm_neon_2_x86_sse\u002F\u002F:LICENSE\",\n        \"@astor_archive\u002F\u002F:LICENSE\",\n        \"@boringssl\u002F\u002F:LICENSE\",\n        \"@com_google_absl\u002F\u002F:LICENSE\",\n        \"@com_googlesource_code_re2\u002F\u002F:LICENSE\",\n        \"@curl\u002F\u002F:COPYING\",\n        \"@double_conversion\u002F\u002F:LICENSE\",\n        \"@eigen_archive\u002F\u002F:COPYING.MPL2\",\n        \"@farmhash_archive\u002F\u002F:COPYING\",\n        \"@fft2d\u002F\u002F:fft\u002Freadme.txt\",\n        \"@flatbuffers\u002F\u002F:LICENSE.txt\",\n        \"@gast_archive\u002F\u002F:PKG-INFO\",\n        \"@gemmlowp\u002F\u002F:LICENSE\",\n        \"@gif_archive\u002F\u002F:COPYING\",\n        \"@highwayhash\u002F\u002F:LICENSE\",\n        \"@icu\u002F\u002F:icu4c\u002FLICENSE\",\n        \"@jpeg\u002F\u002F:LICENSE.md\",\n        \"@lmdb\u002F\u002F:LICENSE\",\n        \"@local_config_sycl\u002F\u002Fsycl:LICENSE.text\",\n        \"@nasm\u002F\u002F:LICENSE\",\n        \"@nsync\u002F\u002F:LICENSE\",\n        \"@pcre\u002F\u002F:LICENCE\",\n        \"@png_archive\u002F\u002F:LICENSE\",\n        \"@protobuf_archive\u002F\u002F:LICENSE\",\n        \"@six_archive\u002F\u002F:LICENSE\",\n        \"@snappy\u002F\u002F:COPYING\",\n        \"@swig\u002F\u002F:LICENSE\",\n        \"@termcolor_archive\u002F\u002F:COPYING.txt\",\n        \"@zlib_archive\u002F\u002F:zlib.h\",\n        \"@org_python_pypi_backports_weakref\u002F\u002F:LICENSE\",\n    ] + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_aws_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@aws\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_gcp_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@com_github_googleapis_googleapis\u002F\u002F:LICENSE\",\n            \"@com_github_googlecloudplatform_google_cloud_cpp\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow:android\": [],\n        \"\u002F\u002Ftensorflow:ios\": [],\n        \"\u002F\u002Ftensorflow:linux_s390x\": [],\n        \"\u002F\u002Ftensorflow:windows\": [],\n        \"\u002F\u002Ftensorflow:no_kafka_support\": [],\n        \"\u002F\u002Fconditions:default\": [\n            \"@kafka\u002F\u002F:LICENSE\",\n        ],\n    }) + select({\n        \"\u002F\u002Ftensorflow\u002Fcore\u002Fkernels:xsmm\": [\n            \"@libxsmm_archive\u002F\u002F:LICENSE.md\",\n        ],\n        \"\u002F\u002Fconditions:default\": [],\n    }) + if_cuda([\n        \"@cub_archive\u002F\u002F:LICENSE.TXT\",\n        \"@local_config_nccl\u002F\u002F:LICENSE\",\n    ]) + if_mkl([\n        \"\u002F\u002Fthird_party\u002Fmkl:LICENSE\",\n        \"\u002F\u002Fthird_party\u002Fmkl_dnn:LICENSE\",\n    ]) + if_not_system_lib(\n        \"grpc\",\n        [\n            \"@grpc\u002F\u002F:LICENSE\",\n            \"@grpc\u002F\u002Fthird_party\u002Fnanopb:LICENSE.txt\",\n            \"@grpc\u002F\u002Fthird_party\u002Faddress_sorting:LICENSE\",\n        ],\n    ) + if_ngraph([\n        \"@ngraph\u002F\u002F:LICENSE\",\n        \"@ngraph_tf\u002F\u002F:LICENSE\",\n        \"@nlohmann_json_lib\u002F\u002F:LICENSE.MIT\",\n        \"@tbb\u002F\u002F:LICENSE\",\n    ]) + tf_additional_license_deps(),\n)\n\nsh_binary(\n    name = \"build_pip_package\",\n    srcs = [\"build_pip_package.sh\"],\n    data = select({\n        \"\u002F\u002Ftensorflow:windows\": [\n            \":simple_console_for_windows\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fpython:interpreter_test_data\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fpython:tflite_convert\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Ftoco\u002Fpython:toco_from_protos\",\n        ],\n        \"\u002F\u002Fconditions:default\": COMMON_PIP_DEPS + [\n            \":simple_console\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fpython:interpreter_test_data\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Fpython:tflite_convert\",\n            \"\u002F\u002Ftensorflow\u002Fcontrib\u002Flite\u002Ftoco\u002Fpython:toco_from_protos\",\n        ],\n    }) + if_mkl_ml([\"\u002F\u002Fthird_party\u002Fmkl:intel_binary_blob\"]),\n)\n\n# 用于在 Windows 上为 pip 包生成标记文件的 genrule\n#\n# 这仅适用于 Windows，因为 :simple_console_for_windows 是一个包含构建 pip 包所需一切内容的 Python zip 文件。然而，在其他平台上，由于 https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F4223，\n\n# 当 C++ 扩展发生变化时，此 genrule 不会重新构建。\ngenrule(\n    name = \"win_pip_package_marker\",\n    srcs = if_windows([\n        \":build_pip_package\",\n        \":simple_console_for_windows\",\n    ]),\n    outs = [\"win_pip_package_marker_file\"],\n    cmd = select({\n        \"\u002F\u002Fconditions:default\": \"touch $@\",\n        \"\u002F\u002Ftensorflow:windows\": \"md5sum $(locations :build_pip_package) $(locations :simple_console_for_windows) > $@\",\n    }),\n    visibility = [\"\u002F\u002Fvisibility:public\"],\n)\n```\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n\n$ .\u002Fconfigure\nWARNING: Processed legacy workspace file \u002Fhome\u002Fpi\u002Fwork\u002Ftensorflow\u002Ftools\u002Fbazel.rc. This file will not be processed in the next release of Bazel. Please read https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Fissues\u002F6319 for further information, including how to upgrade.\nWARNING: Running Bazel server needs to be killed, because the startup options are different.\nWARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command \"bazel shutdown\".\nYou have bazel 0.18.1- (@non-git) installed.\nPlease specify the location of python. [Default is \u002Fusr\u002Fbin\u002Fpython]: \u002Fusr\u002Fbin\u002Fpython3\n\n\nFound possible Python library paths:\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\u002Farmv7l\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\nPlease input the desired Python library path to use.  Default is [\u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\u002Farmv7l]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\nDo you wish to build TensorFlow with XLA JIT support? [Y\u002Fn]: n\nNo XLA JIT support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\u002FN]: n\nNo OpenCL SYCL support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with ROCm support? [y\u002FN]: n\nNo ROCm support will be enabled for TensorFlow.\n\nDo you wish to build TensorFlow with CUDA support? [y\u002FN]: n\nNo CUDA support will be enabled for TensorFlow.\n\nDo you wish to download a fresh release of clang? (Experimental) [y\u002FN]: n\nClang will not be downloaded.\n\nDo you wish to build TensorFlow with MPI support? [y\u002FN]: n\nNo MPI support will be enabled for TensorFlow.\n\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native]:\n\n\nWould you like to interactively configure .\u002FWORKSPACE for Android builds? [y\u002FN]: n\nNot configuring the WORKSPACE for Android builds.\n\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=\u003C>\" to your build command. See .bazelrc for more details.\n\t--config=mkl         \t# Build with MKL support.\n\t--config=monolithic  \t# Config for mostly static monolithic build.\n\t--config=gdr         \t# Build with GDR support.\n\t--config=verbs       \t# Build with libverbs support.\n\t--config=ngraph      \t# Build with Intel nGraph support.\nPreconfigured Bazel build configs to DISABLE default on features:\n\t--config=noaws       \t# Disable AWS S3 filesystem support.\n\t--config=nogcp       \t# Disable GCP support.\n\t--config=nohdfs      \t# Disable HDFS support.\n\t--config=noignite    \t# Disable Apacha Ignite support.\n\t--config=nokafka     \t# Disable Apache Kafka support.\nConfiguration finished\n```\n~~https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F22819~~\n~~https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fcommit\u002Fd80eb525e94763e09cbb9fa3cbef9a0f64e2cb2a~~\n~~https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fcommit\u002F5847293aeb9ab45a02c4231c40569a15bd4541c6~~\nhttps:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F23721\nhttps:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fpull\u002F25748\nhttps:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F25120#issuecomment-464296755\nhttps:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Ftree\u002Fmaster\u002Ftensorflow\u002Flite\u002Ftools\u002Fpip_package\nhttps:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F24372\nhttps:\u002F\u002Fgist.github.com\u002Ffyhertz\u002F4cef0b696b37d38964801d3ef21e8ce2\n```\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v1.13.1\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v1.13.1 - Bazel 0.19.2**\n\n============================================================\n\n**Python3.x**\n\n\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.19.2\u002FRaspbian_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\nimport sys\nimport numpy as np\n\n# pylint: disable=g-import-not-at-top\ntry:\n  from tensorflow.python.util.lazy_loader import LazyLoader\n  from tensorflow.python.util.tf_export import tf_export as _tf_export\n\n  # Lazy load since some of the performance benchmark skylark rules\n  # break dependencies. Must use double quotes to match code internal rewrite\n  # rule.\n  # pylint: disable=g-inconsistent-quotes\n  _interpreter_wrapper = LazyLoader(\n      \"_interpreter_wrapper\", globals(),\n      \"tensorflow.lite.python.interpreter_wrapper.\"\n      \"tensorflow_wrap_interpreter_wrapper\")\n  # pylint: enable:g-inconsistent-quotes\n\n从 LazyLoader 导入\nexcept ImportError:\n  # 当完整的 TensorFlow Python PIP 不可用时，不使用延迟加载，\n  # 而是使用 tflite_runtime 路径。\n  from tflite_runtime.lite.python import interpreter_wrapper as _interpreter_wrapper\n\n  def tf_export_dummy(*x, **kwargs):\n    del x, kwargs\n    return lambda x: x\n  _tf_export = tf_export_dummy\n\n\n@_tf_export('lite.Interpreter')\nclass Interpreter(object):\n  \"\"\"用于 TF-Lite 模型的解释器接口。\"\"\"\n\n  def __init__(self, model_path=None, model_content=None):\n    \"\"\"构造函数。\n    Args:\n      model_path: TF-Lite Flatbuffer 文件的路径。\n      model_content: 模型内容。\n    Raises:\n      ValueError: 如果无法创建解释器。\n    \"\"\"\n    if model_path and not model_content:\n      self._interpreter = (\n          _interpreter_wrapper.InterpreterWrapper_CreateWrapperCPPFromFile(\n              model_path))\n      if not self._interpreter:\n        raise ValueError('无法打开 {}'.format(model_path))\n    elif model_content和not model_path:\n      # 取一个引用，以确保指针有效。\n      # 由于 Python 字符串是不可变的，因此 PyString_XX 函数\n      # 将始终返回相同的指针。\n      self._model_content = model_content\n      self._interpreter = (\n          _interpreter_wrapper.InterpreterWrapper_CreateWrapperCPPFromBuffer(\n              model_content))\n    elif not model_path 和 not model_content:\n      raise ValueError('必须指定 `model_path` 或 `model_content`。')\n    else:\n      raise ValueError('不能同时提供 `model_path` 和 `model_content`')\n\n  def allocate_tensors(self):\n    self._ensure_safe()\n    return self._interpreter.AllocateTensors()\n\n  def _safe_to_run(self):\n    \"\"\"如果不存在指向内部缓冲区的 NumPy 数组，则返回 True。\n    这意味着可以安全地执行可能破坏内部分配内存的 TFLite 调用。\n    这是因为在 wrapper.cc 中，我们将 NumPy 基类设置为 self._interpreter。\n    \"\"\"\n    # 注意，我们在 C++ 中调用 tensor() 时会将 _interpreter 作为基指针。\n    # 如果当前环境是唯一的 _interpreter，那么引用计数应为 2（1 在 self 中，1 在 sys.getrefcount 的临时引用中）。\n    return sys.getrefcount(self._interpreter) == 2\n\n  def _ensure_safe(self):\n    \"\"\"确保没有指向内部缓冲区的 NumPy 数组处于活动状态。\n    应该在任何调用 _interpreter 上可能重新分配内存的函数之前调用此方法，\n    例如 invoke() 等。\n    Raises:\n      RuntimeError: 如果存在指向内部内存的 NumPy 对象，则抛出异常。\n    \"\"\"\n    if not self._safe_to_run():\n      raise RuntimeError(\"\"\"解释器中至少有一个指向内部数据的引用，\n      形式为 NumPy 数组或切片。如果您使用原始数据访问方式，\n      请仅保留从 tensor() 返回的函数。\"\"\")\n\n  def _get_tensor_details(self, tensor_index):\n    \"\"\"获取张量详情。\n    Args:\n      tensor_index: 要查询的张量索引。\n    Returns:\n      包含张量名称、索引、形状和类型的一个字典。\n    Raises:\n      ValueError: 如果 tensor_index 无效。\n    \"\"\"\n    tensor_index = int(tensor_index)\n    tensor_name = self._interpreter.TensorName(tensor_index)\n    tensor_size = self._interpreter.TensorSize(tensor_index)\n    tensor_type = self._interpreter.TensorType(tensor_index)\n    tensor_quantization = self._interpreter.TensorQuantization(tensor_index)\n\n    if not tensor_name 或 not tensor_type:\n      raise ValueError('无法获取张量详情')\n\n    details = {\n        'name': tensor_name,\n        'index': tensor_index,\n        'shape': tensor_size,\n        'dtype': tensor_type,\n        'quantization': tensor_quantization,\n    }\n\n    return details\n\n  def get_tensor_details(self):\n    \"\"\"获取所有具有有效张量详情的张量信息。\n    对于未找到必要信息的张量，不会将其加入列表，包括没有名称的临时张量。\n    Returns:\n      包含张量信息的字典列表。\n    \"\"\"\n    tensor_details = []\n    for idx in range(self._interpreter.NumTensors()):\n      try:\n        tensor_details.append(self._get_tensor_details(idx))\n      except ValueError:\n        pass\n    return tensor_details\n\n  def get_input_details(self):\n    \"\"\"获取模型输入详情。\n    Returns:\n      输入详情列表。\n    \"\"\"\n    return [\n        self._get_tensor_details(i) for i in self._interpreter.InputIndices()\n    ]\n\n  def set_tensor(self, tensor_index, value):\n    \"\"\"设置输入张量的值。请注意，此操作会复制 `value` 中的数据。\n    如果您希望避免复制，可以使用 `tensor()` 函数来获取指向 TFLite 解释器输入缓冲区的 NumPy 缓冲区。\n    Args:\n      tensor_index: 要设置的张量索引。此值可以从 get_input_details 中的 'index' 字段获得。\n      value: 要设置的张量值。\n    Raises:\n      ValueError: 如果解释器无法设置张量。\n    \"\"\"\n    self._interpreter.SetTensor(tensor_index, value)\n\n  def resize_tensor_input(self, input_index, tensor_size):\n    \"\"\"调整输入张量的大小。\n    Args:\n      input_index: 要调整的输入张量索引。此值可以从 get_input_details 中的 'index' 字段获得。\n      tensor_size: 要调整到的新张量形状。\n    Raises:\n      ValueError: 如果解释器无法调整输入张量的大小。\n    \"\"\"\n    self._ensure_safe()\n    # `ResizeInputTensor` 现在只接受 int32 类型的 NumPy 数组作为 `tensor_size` 参数。\n    tensor_size = np.array(tensor_size, dtype=np.int32)\n    self._interpreter.ResizeInputTensor(input_index, tensor_size)\n\n  def get_output_details(self):\n    \"\"\"获取模型输出详情。\n    Returns:\n      输出详情列表。\n    \"\"\"\n    return [\n        self._get_tensor_details(i) for i in self._interpreter.OutputIndices()\n    ]\n\n  def get_tensor(self, tensor_index):\n    \"\"\"获取输入张量的值（获取副本）。\n    如果您希望避免复制，请使用 `tensor()`。此函数不能用于读取中间结果。\n    Args:\n      tensor_index: 要获取的张量索引。此值可以从 get_output_details 中的 'index' 字段获得。\n    Returns:\n      一个 NumPy 数组。\n    \"\"\"\n    return self._interpreter.GetTensor(tensor_index)\n\ndef tensor(self, tensor_index):\n    \"\"\"返回一个函数，该函数提供当前张量缓冲区的 NumPy 视图。\n    这允许在不进行复制的情况下读取和写入这些张量。这更接近 C++ Interpreter 类接口中的 tensor() 成员函数，因此得名。请注意，在调用 `allocate_tensors()` 和 `invoke()` 时，不要保留这些输出引用。此函数不能用于读取中间结果。\n    使用示例：\n    ```\n    interpreter.allocate_tensors()\n    input = interpreter.tensor(interpreter.get_input_details()[0][\"index\"])\n    output = interpreter.tensor(interpreter.get_output_details()[0][\"index\"])\n    for i in range(10):\n      input().fill(3.)\n      interpreter.invoke()\n      print(\"inference %s\" % output())\n    ```\n    注意，该函数避免直接创建 NumPy 数组。这是因为重要的是不要比必要的时间更长时间地持有数据的实际 NumPy 视图。如果这样做，Interpreter 就无法再被调用，因为 Interpreter 可能会调整大小并使所引用的张量失效。NumPy API 不允许对底层缓冲区进行任何可变操作。\n    错误示例：\n    ```\n    input = interpreter.tensor(interpreter.get_input_details()[0][\"index\"])()\n    output = interpreter.tensor(interpreter.get_output_details()[0][\"index\"])()\n    interpreter.allocate_tensors()  # 这将抛出 RuntimeError\n    for i in range(10):\n      input.fill(3.)\n      interpreter.invoke()  # 这将抛出 RuntimeError，因为 input 和 output\n    ```\n    参数：\n      tensor_index: 要获取的张量索引。该值可以从 get_output_details 中的 'index' 字段获得。\n    返回：\n      一个函数，可以在任何时候返回指向内部 TFLite 张量状态的新 NumPy 数组。可以永久保留该函数，但不能永久保留 NumPy 数组。\n    \"\"\"\n    return lambda: self._interpreter.tensor(self._interpreter, tensor_index)\n\n  def invoke(self):\n    \"\"\"调用 Interpreter。\n    在调用此方法之前，请确保已设置输入尺寸、分配张量并填充数值。\n    异常：\n      ValueError：当底层 Interpreter 调用失败时，将抛出 ValueError。\n    \"\"\"\n    self._ensure_safe()\n    self._interpreter.Invoke()\n\n  def reset_all_variables(self):\n    return self._interpreter.ResetVariableTensors()\n\n  def set_num_threads(self, i):\n    \"\"\"设置 TFLite 内核使用的线程数。\n    如果未设置，内核将以单线程运行。需要注意的是，目前只有部分内核（如卷积）支持多线程。\n    参数：\n      i：线程数。\n    \"\"\"\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 修正了最后一行附近的代码如下\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n```C++\n  \u002F\u002F 应该是提供内存的 Interpreter 对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构建 `Interpreter` 时返回 InterpreterWrapper。\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - 删除以下内容\n```\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```\nBUILD_WITH_NNAPI=false\nifeq ($(BUILD_WITH_NNAPI),true)\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fnnapi_delegate_disabled.cc\nelse\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fnnapi_delegate.cc\nendif\n\nifeq ($(TARGET),ios)\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fminimal_logging_android.cc\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fminimal_logging_default.cc\nelse\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fminimal_logging_android.cc\n\tCORE_CC_EXCLUDE_SRCS += tensorflow\u002Flite\u002Fminimal_logging_ios.cc\nendif\n```\n- configure\n```bash\n$ .\u002Fconfigure\n正在提取 Bazel 安装...\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭您的 Bazel 服务器。\n您已安装 bazel 0.19.2- (@non-git)。\n请指定 Python 的位置。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n找到可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fhome\u002Fb920405\u002Fgit\u002Fcaffe-jacinto\u002Fpython\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fpython\u002Fpython3.5\u002Fubuntu16\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fpython\u002Fpython3.5\n  .\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fdeployment_tools\u002Fmodel_optimizer\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n您是否希望构建具有 XLA JIT 支持的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不会启用 XLA JIT 支持。\n\n您是否希望构建具有 OpenCL SYCL 支持的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 OpenCL SYCL 支持。\n\n您是否希望构建具有 ROCm 支持的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 ROCm 支持。\n\n您是否希望构建具有 CUDA 支持的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 CUDA 支持。\n\n您是否希望下载最新版本的 clang？（实验性）[y\u002FN]：n\n不会下载 clang。\n\n您是否希望构建具有 MPI 支持的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 MPI 支持。\n\n请指定在使用 bazel 选项 \"--config=opt\" 时编译过程中要使用的优化标志 [默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望交互式配置 .\u002FWORKSPACE 以用于 Android 构建？[y\u002FN]：n\n不配置 WORKSPACE 用于 Android 构建。\n\n预配置的 Bazel 构建配置。您可以通过在构建命令中添加 `--config=\u003C>` 来使用以下任一配置。更多详细信息请参阅 `.bazelrc`。\n    --config=mkl            # 使用 MKL 支持进行构建。\n    --config=monolithic     # 用于大部分静态单体构建的配置。\n    --config=gdr            # 使用 GDR 支持进行构建。\n    --config=verbs          # 使用 libverbs 支持进行构建。\n    --config=ngraph         # 使用 Intel nGraph 支持进行构建。\n    --config=dynamic_kernels    # （实验性）将内核构建为单独的共享对象。\n预配置的 Bazel 构建配置，用于禁用默认启用的功能：\n    --config=noaws          # 禁用 AWS S3 文件系统支持。\n    --config=nogcp          # 禁用 GCP 支持。\n    --config=nohdfs         # 禁用 HDFS 支持。\n    --config=noignite       # 禁用 Apache Ignite 支持。\n    --config=nokafka        # 禁用 Apache Kafka 支持。\n    --config=nonccl         # 禁用 NVIDIA NCCL 支持。\n配置完成\n```\n- 构建\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n\n\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.13.1-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-1.13.1-cp35-cp35m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v1.14.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**TensorFlow v1.14.0 - Bazel 0.24.1 - Stretch - armhf**\n\n============================================================\n\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev openjdk-8-jdk\n\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.24.1\u002FRaspbian_Stretch_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v1.14.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.14.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n\n# 在最后一行添加以下两行\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 将最后一行附近的代码修正如下\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构建 `Interpreter` 时返回 InterpreterWrapper。\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - 删除以下内容\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- configure\n```bash\n$ .\u002Fconfigure\n正在提取 Bazel 安装文件……\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭您的 Bazel 服务器。\n您已安装 bazel 0.24.1- (@non-git)。\n请指定 Python 的安装路径。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n找到了可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不会启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 CUDA 支持。\n\n您是否希望下载最新版本的 Clang？（实验性）[y\u002FN]：n\nClang 不会被下载。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 MPI 支持。\n\n请指定在使用 bazel 选项“--config=opt”时编译过程中要使用的优化标志。[默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望交互式配置用于 Android 构建的 WORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置如下。您可以通过在构建命令中添加“--config=\u003C配置名>”来使用它们。更多详细信息请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 启用 MKL 支持。\n\t--config=monolithic  \t# 静态单体式构建配置。\n\t--config=gdr         \t# 启用 GDR 支持。\n\t--config=verbs       \t# 启用 libverbs 支持。\n\t--config=ngraph      \t# 启用 Intel nGraph 支持。\n\t--config=numa        \t# 启用 NUMA 支持。\n\t--config=dynamic_kernels\t# （实验性）将内核构建为独立的共享对象。\n预配置的 Bazel 构建配置，用于禁用默认功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 GCP 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置已完成。\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.14.0-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-1.14.0-cp35-cp35m-linux_armv7l.whl\n```\n\n============================================================\n\n**Tensorflow v1.14.0 - Bazel 0.24.1 - Buster - armhf**\n\n============================================================\n首先，使用 QEMU 4.0.0 准备一个 armhf 的模拟环境。（CPU 4 核，RAM 4GB）\n**[如何在 QEMU 4.0.0 的硬件模拟模式下从零开始创建 Debian Buster armhf 操作系统镜像（内核 4.19.0-5-armmp-lpae，用于构建 Tensorflow armhf）](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fc10283a28d0699f01e01)**\n```bash\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev openjdk-11-jdk\n\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fnumpy-1.16.4-cp37-cp37m-linux_armv7l.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fh5py-2.9.0-cp37-cp37m-linux_armv7l.whl\n$ sudo pip3 install numpy-1.16.4-cp37-cp37m-linux_armv7l.whl\n$ sudo pip3 install h5py-2.9.0-cp37-cp37m-linux_armv7l.whl\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.24.1\u002FRaspbian_Buster_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v1.14.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.14.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n\n# 在最后一行添加以下两行\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 将最后一行附近的代码更正如下\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构建 `Interpreter` 时返回 `InterpreterWrapper`。\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Fcontrib\u002F__init__.py\n```python\nfrom tensorflow.contrib import checkpoint\n#if os.name != \"nt\" and platform.machine() != \"s390x\":\n#  from tensorflow.contrib import cloud\nfrom tensorflow.contrib import cluster_resolver\n```\n- tensorflow\u002Fcontrib\u002F__init__.py\n```python\nfrom tensorflow.contrib.summary import summary\n\nif os.name != \"nt\" and platform.machine() != \"s390x\":\n  try:\n    from tensorflow.contrib import cloud\n  except ImportError:\n    pass\n\nfrom tensorflow.python.util.lazy_loader import LazyLoader\nffmpeg = LazyLoader(\"ffmpeg\", globals(),\n                    \"tensorflow.contrib.ffmpeg\")\n```\n- configure\n```bash\n$ .\u002Fconfigure\n正在提取 Bazel 安装文件……\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭您的 Bazel 服务器。\n您已安装 bazel 0.24.1- (@non-git)。\n请指定 Python 的位置。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n找到可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不会启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 CUDA 支持。\n\n您是否希望下载最新版本的 clang？（实验性功能）[y\u002FN]：n\n不会下载 clang。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 MPI 支持。\n\n请指定在使用 bazel 选项“--config=opt”时编译过程中要使用的优化标志 [默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望以交互方式配置用于 Android 构建的 .\u002FWORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置。您可以通过在构建命令中添加“--config=\u003C配置名>”来使用以下任一配置。更多详细信息请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 使用 MKL 支持进行构建。\n\t--config=monolithic  \t# 主要用于静态单体式构建的配置。\n\t--config=gdr         \t# 使用 GDR 支持进行构建。\n\t--config=verbs       \t# 使用 libverbs 支持进行构建。\n\t--config=ngraph      \t# 使用 Intel nGraph 支持进行构建。\n\t--config=numa        \t# 使用 NUMA 支持进行构建。\n\t--config=dynamic_kernels\t# （实验性功能）将内核构建为独立的共享对象。\n预配置的 Bazel 构建配置，用于禁用默认启用的功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 GCP 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置已完成\n```\n- build\n```bash\n$ sudo bazel build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=4096.0,2.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n\n# 退出\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.14.0-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-1.14.0-cp37-cp37m-linux_armv7l.whl\n```\n\n============================================================\n\n**TensorFlow v1.14.0 - Bazel 0.24.1 - Buster - aarch64**\n\n============================================================\n\n首先，使用 QEMU 4.0.0 准备一个 aarch64 的模拟环境。\n**[如何在 QEMU 4.0.0 硬件模拟模式下从头开始创建 Debian Buster aarch64 操作系统镜像（内核 4.19.0-5-arm64，用于 TensorFlow aarch64 构建）](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fe117bb0389f2163e2ac8)**\n\n接下来，在模拟环境中按照以下步骤构建 Bazel 和 TensorFlow。\n```bash\n$ sudo apt-get install -y \\\nlibhdf5-dev libc-ares-dev libeigen3-dev \\\nlibatlas3-base net-tools build-essential \\\nzip unzip python3-pip curl wget git zip unzip\n$ sudo pip3 install pip --upgrade\n$ sudo pip3 install zipper\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fabsl_py-0.7.1-cp37-none-any.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fgast-0.2.2-cp37-none-any.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fgrpcio-1.21.1-cp37-cp37m-linux_aarch64.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fh5py-2.9.0-cp37-cp37m-linux_aarch64.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fnumpy-1.16.4-cp37-cp37m-linux_aarch64.whl\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fpackages\u002Fwrapt-1.11.2-cp37-cp37m-linux_aarch64.whl\n$ sudo pip3 install *.whl\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo pip3 install -U --user mock zipper wheel\n\n$ sudo apt-get update\n$ sudo apt-get remove -y openjdk-8* --purge\n$ sudo apt-get install -y openjdk-11-jdk\n\n$ cd ~\n$ mkdir bazel;cd bazel\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F0.24.1\u002Fbazel-0.24.1-dist.zip\n$ unzip bazel-0.24.1-dist.zip\n$ env EXTRA_BAZEL_ARGS=\"--host_javabase=@local_jdk\u002F\u002F:jdk\"\n\n$ nano compile.sh\n\n#################################################################################\nbazel_build \"src:bazel_nojdk${EXE_EXT}\" \\\n  --action_env=PATH \\\n  --host_platform=@bazel_tools\u002F\u002Fplatforms:host_platform \\\n  --platforms=@bazel_tools\u002F\u002Fplatforms:target_platform \\\n  || fail \"无法构建 Bazel\"\n#################################################################################\n↓\n#################################################################################\nbazel_build \"src:bazel_nojdk${EXE_EXT}\" \\\n  --host_javabase=@local_jdk\u002F\u002F:jdk \\\n  --action_env=PATH \\\n  --host_platform=@bazel_tools\u002F\u002Fplatforms:host_platform \\\n  --platforms=@bazel_tools\u002F\u002Fplatforms:target_platform \\\n  || fail \"无法构建 Bazel\"\n#################################################################################\n\n$ sudo bash .\u002Fcompile.sh\n$ sudo cp output\u002Fbazel \u002Fusr\u002Flocal\u002Fbin\n\n$ bazel version\n正在提取 Bazel 安装...\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭您的 Bazel 服务器。\n构建标签：0.24.1- (@non-git)\n构建目标：bazel-out\u002Faarch64-opt\u002Fbin\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Fgoogle\u002Fdevtools\u002Fbuild\u002Flib\u002Fbazel\u002FBazelServer_deploy.jar\n构建时间：2019年6月23日星期日 20:46:48 (1561322808)\n构建时间戳：1561322808\n构建时间戳整数：1561322808\n\n$ cd ~\n$ git clone -b v1.14.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.14.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# 在最后一行添加以下两行\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```bash\n\u002F\u002F 修正最后一行附近的代码如下\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n```bash\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 辅助函数，用于构造一个 `InterpreterWrapper` 对象。\n  \u002F\u002F 它仅在能够构造一个 `Interpreter` 时才返回 InterpreterWrapper。\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```bash\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002Ftargets\u002Faarch64_makefile.inc\n**https:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F56055359\u002Ftensorflow-lite-arm64-error-cannot-convert-const-int8x8-t**\n```bash\n# 针对 Odroid C2 或 Pine64 等通用 aarch64 板的设置。\nifeq ($(TARGET),aarch64)\n  # aarch64 架构涵盖所有 64 位 ARM 芯片。该架构强制要求 NEON，因此下方不需要 FPU 标志。\n  TARGET_ARCH := armv8-a\n  TARGET_TOOLCHAIN_PREFIX := aarch64-linux-gnu-\n\n  CXXFLAGS += \\\n    -march=armv8-a \\\n    -funsafe-math-optimizations \\\n    -ftree-vectorize \\\n    -flax-vector-conversions \\\n    -fomit-frame-pointer \\\n    -fPIC\n\n  CFLAGS += \\\n    -march=armv8-a \\\n    -funsafe-math-optimizations \\\n    -ftree-vectorize \\\n    -flax-vector-conversions \\\n    -fomit-frame-pointer \\\n    -fPIC\n\n  LDFLAGS := \\\n    -Wl,--no-export-dynamic \\\n    -Wl,--exclude-libs,ALL \\\n    -Wl,--gc-sections \\\n    -Wl,--as-needed\n\n\n  LIBS := \\\n    -lstdc++ \\\n    -lpthread \\\n    -lm \\\n    -ldl \\\n    -lrt\n\nendif\n```\n- tensorflow\u002Flite\u002Fbuild_def.bzl\n**https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F26731**\n**https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fpull\u002F29515\u002Ffiles**\n```bash\n            \"\u002FDTF_COMPILE_LIBRARY\",\n            \"\u002Fwd4018\",  # -Wno-sign-compare\n        ],\n+       str(Label(\"\u002F\u002Ftensorflow:linux_aarch64\")): [\n+           \"-flax-vector-conversions\",\n+           \"-fomit-frame-pointer\",\n+       ],\n        \"\u002F\u002Fconditions:default\": [\n            \"-Wno-sign-compare\",\n        ],\n```\n- tensorflow\u002Fcontrib\u002F__init__.py\n```python\nfrom tensorflow.contrib import checkpoint\n#if os.name != \"nt\" and platform.machine() != \"s390x\":\n\n#  from tensorflow.contrib import cloud\nfrom tensorflow.contrib import cluster_resolver\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib.summary import summary\n\nif os.name != \"nt\" and platform.machine() != \"s390x\":\n  try:\n    from tensorflow.contrib import cloud\n  except ImportError:\n    pass\n\nfrom tensorflow.python.util.lazy_loader import LazyLoader\nffmpeg = LazyLoader(\"ffmpeg\", globals(),\n                    \"tensorflow.contrib.ffmpeg\")\n```\n```bash\n$ .\u002Fconfigure\n请指定 Python 的安装路径。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n找到了可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认路径为 [\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages]\n\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\n将不会启用 TensorFlow 的 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\n将不会启用 TensorFlow 的 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\n将不会启用 TensorFlow 的 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\n将不会启用 TensorFlow 的 CUDA 支持。\n\n您是否希望下载最新版本的 Clang？（实验性功能）[y\u002FN]：n\n不会下载 Clang。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\n将不会启用 TensorFlow 的 MPI 支持。\n\n请指定在使用 Bazel 的 \"--config=opt\" 选项进行编译时要使用的优化标志 [默认为 -march=native -Wno-sign-compare]:\n\n\n您是否希望交互式配置用于 Android 构建的 WORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置如下。您可以通过在构建命令中添加 \"--config=\u003C>\" 来使用以下任一配置。更多详细信息请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 使用 MKL 支持进行构建。\n\t--config=monolithic  \t# 主要采用静态单体式构建的配置。\n\t--config=gdr         \t# 使用 GDR 支持进行构建。\n\t--config=verbs       \t# 使用 libverbs 支持进行构建。\n\t--config=ngraph      \t# 使用 Intel nGraph 支持进行构建。\n\t--config=numa        \t# 使用 NUMA 支持进行构建。\n\t--config=dynamic_kernels\t# （实验性功能）将内核构建为独立的共享对象。\n预配置的 Bazel 构建配置，用于禁用默认启用的功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 GCP 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置已完成\n```\n```bash\n$ sudo bazel build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=8192.0,4.0,1.0 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-flax-vector-conversions \\\n--copt=-fomit-frame-pointer \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.14.0-cp37-cp37m-linux_aarch64.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-1.14.0-cp37-cp37m-linux_aarch64.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>TensorFlow v1.15.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**TensorFlow v1.15.0 - Bazel 0.26.1 - Buster - armhf**\n\n============================================================\n首先，请按照以下链接中的步骤安装 openjdk-8-jdk。\n**[[稳定版] 在 Raspbian Buster（Debian 10）环境中安全安装 openjdk-8-jdk](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F612718c0ce4f1def6c6e)**\n接下来，请按照以下步骤在 Raspberry Pi 3\u002F4 上构建 TensorFlow。\n```bash\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v1.15.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v1.15.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n\n# 在最后一行添加以下两行\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 按如下方式修正最后一行附近的代码\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构建 `Interpreter` 时返回 InterpreterWrapper。\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- configure\n```bash\n$ .\u002Fconfigure\n正在提取 Bazel 安装包……\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭您的 Bazel 服务器。\n您已安装 bazel 0.26.1- (@non-git)。\n请指定 Python 的位置。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n找到了可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 CUDA 支持。\n\n您是否希望下载最新版本的 clang？（实验性）[y\u002FN]：n\n不会下载 clang。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 MPI 支持。\n\n请指定在使用 bazel 选项“--config=opt”进行编译时要使用的优化标志 [默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望交互式配置用于 Android 构建的 .\u002FWORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置如下，您可以通过在构建命令中添加“--config=\u003C配置名>”来使用它们。更多详细信息请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 启用 MKL 支持。\n\t--config=monolithic  \t# 主要用于静态单体式构建的配置。\n\t--config=gdr         \t# 启用 GDR 支持。\n\t--config=verbs       \t# 启用 libverbs 支持。\n\t--config=ngraph      \t# 启用 Intel nGraph 支持。\n\t--config=numa        \t# 启用 NUMA 支持。\n\t--config=dynamic_kernels\t# （实验性）将内核构建为独立的共享对象。\n预配置的 Bazel 构建配置，用于禁用默认功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 GCP 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置已完成\n```\n- build\n```bash\n$ sudo bazel build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-1.15.0-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-1.15.0-cp37-cp37m-linux_armv7l.whl\n```\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0-alpha\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0-alpha - Stretch - Bazel 0.19.2**\n\n============================================================\n\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.19.2\u002FRaspbian_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-alpha0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-alpha0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n\n# 在最后一行添加以下两行\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 按如下方式修正最后一行附近的代码\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构造出 `Interpreter` 时才返回 InterpreterWrapper。\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - 删除以下内容\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Fcontrib\u002F__init__.py\n```python\nfrom tensorflow.contrib import checkpoint\n#if os.name != \"nt\" and platform.machine() != \"s390x\":\n#  from tensorflow.contrib import cloud\nfrom tensorflow.contrib import cluster_resolver\n```\n- tensorflow\u002Fcontrib\u002F__init__.py\n```python\nfrom tensorflow.contrib.summary import summary\n\nif os.name != \"nt\" and platform.machine() != \"s390x\":\n  try:\n    from tensorflow.contrib import cloud\n  except ImportError:\n    pass\n\nfrom tensorflow.python.util.lazy_loader import LazyLoader\nffmpeg = LazyLoader(\"ffmpeg\", globals(),\n                    \"tensorflow.contrib.ffmpeg\")\n```\n- configure\n```bash\n$ .\u002Fconfigure\n正在提取 Bazel 安装文件……\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭 Bazel 服务器。\n您已安装 bazel 0.19.2- (@non-git)。\n请指定 Python 的位置。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n找到了可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fhome\u002Fb920405\u002Fgit\u002Fcaffe-jacinto\u002Fpython\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fpython\u002Fpython3.5\u002Fubuntu16\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fpython\u002Fpython3.5\n  .\n  \u002Fopt\u002Fintel\u002F\u002Fcomputer_vision_sdk_2018.5.455\u002Fdeployment_tools\u002Fmodel_optimizer\n  \u002Fopt\u002Fmovidius\u002Fcaffe\u002Fpython\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不会启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 CUDA 支持。\n\n您是否希望下载最新版本的 clang？（实验性功能）[y\u002FN]：n\n不会下载 clang。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 MPI 支持。\n\n请指定当使用 bazel 选项“--config=opt”时编译过程中要使用的优化标志。[默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望交互式配置用于 Android 构建的 .\u002FWORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置。您可以通过在构建命令中添加“--config=\u003C配置名>”来使用以下任一配置。更多详细信息请参阅 .bazelrc 文件。\n    --config=mkl            # 使用 MKL 支持进行构建。\n    --config=monolithic     # 主要采用静态单体式构建的配置。\n    --config=gdr            # 使用 GDR 支持进行构建。\n    --config=verbs          # 使用 libverbs 支持进行构建。\n    --config=ngraph         # 使用 Intel nGraph 支持进行构建。\n    --config=dynamic_kernels    # （实验性功能）将内核构建为独立的共享对象。\n预配置的 Bazel 构建配置，用于禁用默认启用的功能：\n    --config=noaws          # 禁用 AWS S3 文件系统支持。\n    --config=nogcp          # 禁用 GCP 支持。\n    --config=nohdfs         # 禁用 HDFS 支持。\n    --config=noignite       # 禁用 Apache Ignite 支持。\n    --config=nokafka        # 禁用 Apache Kafka 支持。\n    --config=nonccl         # 禁用 NVIDIA NCCL 支持。\n配置已完成\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n\n# 退出\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0a0-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0a0-cp35-cp35m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>TensorFlow v2.0.0-beta0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**TensorFlow v2.0.0-beta0 - Stretch - Bazel 0.24.1**\n\n============================================================\n\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.24.1\u002FRaspbian_Stretch_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-beta0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-beta0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# 在最后一行添加以下两行代码\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 修正最后一行附近的代码如下：\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构建 `Interpreter` 时返回 InterpreterWrapper。\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - 删除以下内容\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Fcontrib\u002F__init__.py\n```python\nfrom tensorflow.contrib import checkpoint\n#if os.name != \"nt\" and platform.machine() != \"s390x\":\n#  from tensorflow.contrib import cloud\nfrom tensorflow.contrib import cluster_resolver\n```\n- tensorflow\u002Fcontrib\u002F__init__.py\n```python\nfrom tensorflow.contrib.summary import summary\n\nif os.name != \"nt\" and platform.machine() != \"s390x\":\n  try:\n    from tensorflow.contrib import cloud\n  except ImportError:\n    pass\n\nfrom tensorflow.python.util.lazy_loader import LazyLoader\nffmpeg = LazyLoader(\"ffmpeg\", globals(),\n                    \"tensorflow.contrib.ffmpeg\")\n```\n- configure\n```bash\n$ .\u002Fconfigure\n正在提取 Bazel 安装文件……\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭 Bazel 服务器。\n您已安装 Bazel 0.24.1（非 Git 版本）。\n请指定 Python 的位置。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\n将不会启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\n将不会启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\n将不会启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\n将不会启用 CUDA 支持。\n\n您是否希望下载最新版本的 Clang？（实验性功能）[y\u002FN]：n\n不会下载 Clang。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\n将不会启用 MPI 支持。\n\n请指定在使用 bazel 选项“--config=opt”时编译过程中要使用的优化标志 [默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望交互式配置用于 Android 构建的 .\u002FWORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE。\n\n预配置的 Bazel 构建配置。您可以通过在构建命令中添加“--config=\u003C配置名>”来使用以下任何一种配置。有关详细信息，请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 使用 MKL 支持进行构建。\n\t--config=monolithic  \t# 主要用于静态单体式构建的配置。\n\t--config=gdr         \t# 使用 GDR 支持进行构建。\n\t--config=verbs       \t# 使用 libverbs 支持进行构建。\n\t--config=ngraph      \t# 使用 Intel nGraph 支持进行构建。\n\t--config=numa        \t# 使用 NUMA 支持进行构建。\n\t--config=dynamic_kernels\t# （实验性）将内核构建为单独的共享对象。\n预配置的 Bazel 构建配置，用于禁用默认功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 Google Cloud Platform 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置完成\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# 退出\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0b0-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0b0-cp35-cp35m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>TensorFlow v2.0.0-beta1\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**TensorFlow v2.0.0-beta1 - Stretch - Bazel 0.24.1**\n\n============================================================\n\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.7 --no-deps\n$ sudo pip3 install keras_preprocessing==1.0.9 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.24.1\u002FRaspbian_Stretch_armhf\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-beta1 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-beta1\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n# 在最后一行添加以下两行代码\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 将最后一行附近的代码修正如下\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构造 `Interpreter` 时才返回 InterpreterWrapper。\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - 删除以下内容\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Fcontrib\u002F__init__.py\n```python\nfrom tensorflow.contrib import checkpoint\n#if os.name != \"nt\" and platform.machine() != \"s390x\":\n\n#  from tensorflow.contrib import cloud\nfrom tensorflow.contrib import cluster_resolver\n```\n- tensorflow\u002Fcontrib\u002F\\_\\_init\\_\\_.py\n```python\nfrom tensorflow.contrib.summary import summary\n\nif os.name != \"nt\" and platform.machine() != \"s390x\":\n  try:\n    from tensorflow.contrib import cloud\n  except ImportError:\n    pass\n\nfrom tensorflow.python.util.lazy_loader import LazyLoader\nffmpeg = LazyLoader(\"ffmpeg\", globals(),\n                    \"tensorflow.contrib.ffmpeg\")\n```\n- configure\n```bash\n$ .\u002Fconfigure\n正在提取 Bazel 安装文件...\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭您的 Bazel 服务器。\n您已安装 bazel 0.24.1- (@non-git)。\n请指定 Python 的位置。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n找到了可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.5\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.5\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不会启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 CUDA 支持。\n\n您是否希望下载最新版本的 Clang？（实验性）[y\u002FN]：n\nClang 不会被下载。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 MPI 支持。\n\n请指定在使用 bazel 选项 \"--config=opt\" 时编译过程中要使用的优化标志 [默认为 -march=native -Wno-sign-compare]:\n\n\n您是否希望交互式配置用于 Android 构建的 .\u002FWORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置如下。您可以通过在构建命令中添加 \"--config=\u003C>\" 来使用其中任何一种。有关详细信息，请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 启用 MKL 支持的构建。\n\t--config=monolithic  \t# 主要采用静态单体式构建的配置。\n\t--config=gdr         \t# 启用 GDR 支持的构建。\n\t--config=verbs       \t# 启用 libverbs 支持的构建。\n\t--config=ngraph      \t# 启用 Intel nGraph 支持的构建。\n\t--config=numa        \t# 启用 NUMA 支持的构建。\n\t--config=dynamic_kernels\t# （实验性）将内核构建为独立的共享对象。\n预配置的 Bazel 构建配置，用于禁用默认开启的功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 GCP 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置已完成\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nogcp \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0b1-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0b1-cp35-cp35m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0-rc0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0-rc0 - Buster - Bazel 0.26.1**\n\n============================================================\n首先，按照以下网址中的步骤安装 openjdk-8-jdk。\n**[如何在 Raspbian Buster armhf 上安装 openjdk-8-jdk](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fa6ae8e04d382493ef369)**\n或\n**[如何在 Debian Buster (Debian 10) armhf 上安装 openjdk-8-jdk](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F5445c5e899f68d928f0d)**\n接下来，按照以下步骤在 RaspberryPi3 上构建 TensorFlow。\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-rc0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-rc0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n\n# 在最后一行添加以下两行\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 将最后一行附近的代码修正如下\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构造出 `Interpreter` 时才返回 InterpreterWrapper。\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - 删除以下内容\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- configure\n```bash\n$ .\u002Fconfigure\n正在提取 Bazel 安装包……\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭 Bazel 服务器。\n您已安装 bazel 0.26.1- (@non-git)。\n请指定 Python 的位置。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.7\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 CUDA 支持。\n\n您是否希望下载最新版本的 clang？（实验性）[y\u002FN]：n\n不会下载 clang。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 MPI 支持。\n\n请指定在使用 bazel 选项“--config=opt”时编译过程中要使用的优化标志。[默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望交互式配置用于 Android 构建的 WORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置如下。您可以通过在构建命令中添加“--config=\u003C配置名>”来使用它们。更多详细信息请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 启用 MKL 支持。\n\t--config=monolithic  \t# 主要采用静态单体式构建的配置。\n\t--config=gdr         \t# 启用 GDR 支持。\n\t--config=verbs       \t# 启用 libverbs 支持。\n\t--config=ngraph      \t# 启用 Intel nGraph 支持。\n\t--config=numa        \t# 启用 NUMA 支持。\n\t--config=dynamic_kernels\t# （实验性）将内核构建为独立的共享对象。\n\t--config=v2             # 构建 TensorFlow 2.x 而不是 1.x\n预配置的 Bazel 构建配置，用于禁用默认启用的功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 GCP 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置已完成\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0rc0-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0rc0-cp37-cp37m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0-rc1\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0-rc1 - Buster - Bazel 0.26.1**\n\n============================================================\n首先，按照以下网址的步骤安装 openjdk-8-jdk。\n**[如何在 Raspbian Buster armhf 上安装 openjdk-8-jdk](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fa6ae8e04d382493ef369)**\n或\n**[如何在 Debian Buster (Debian 10) armhf 上安装 openjdk-8-jdk](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F5445c5e899f68d928f0d)**\n接下来，按照以下步骤在 Raspberry Pi 3 上构建 TensorFlow。\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n$ sudo apt update;sudo apt upgrade\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-rc1 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-rc1\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n\n# 在最后一行添加以下两行\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 将最后一行附近的代码修正如下\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构造出 `Interpreter` 时才返回 InterpreterWrapper。\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - 删除以下内容\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- configure\n```bash\n$ .\u002Fconfigure\n正在提取 Bazel 安装文件……\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭 Bazel 服务器。\n您已安装 bazel 0.26.1- (@non-git)。\n请指定 Python 的位置。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.7\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不会启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 CUDA 支持。\n\n您是否希望下载最新版本的 Clang？（实验性）[y\u002FN]：n\nClang 不会被下载。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 MPI 支持。\n\n请指定在使用 bazel 选项“--config=opt”时编译过程中要使用的优化标志。[默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望交互式配置用于 Android 构建的 WORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置如下。您可以通过在构建命令中添加“--config=\u003C配置名>”来使用它们。更多详细信息请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 启用 MKL 支持。\n\t--config=monolithic  \t# 主要采用静态单体式构建的配置。\n\t--config=gdr         \t# 启用 GDR 支持。\n\t--config=verbs       \t# 启用 libverbs 支持。\n\t--config=ngraph      \t# 启用 Intel nGraph 支持。\n\t--config=numa        \t# 启用 NUMA 支持。\n\t--config=dynamic_kernels\t# （实验性）将内核构建为独立的共享对象。\n\t--config=v2             # 构建 TensorFlow 2.x 而不是 1.x\n预配置的 Bazel 构建配置，用于禁用默认功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 GCP 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置已完成\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0rc1-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0rc1-cp37-cp37m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.0.0-rc2\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.0.0-rc2 - Buster - Bazel 0.26.1**\n\n============================================================\n首先，按照以下链接中的步骤安装 openjdk-8-jdk。\n**[如何在 Raspbian Buster armhf 上安装 openjdk-8-jdk](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fa6ae8e04d382493ef369)**\n或\n**[如何在 Debian Buster (Debian 10) armhf 上安装 openjdk-8-jdk](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F5445c5e899f68d928f0d)**\n接下来，按照以下步骤在 Raspberry Pi 3 上构建 TensorFlow。\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0-rc2 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0-rc2\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n\n# 在最后一行添加以下两行\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 将最后一行附近的代码修正如下\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构造出 `Interpreter` 时才返回 InterpreterWrapper。\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD\n```python\ncc_library(\n    name = \"linalg\",\n    deps = [\n        \":cholesky_grad\",\n        \":cholesky_op\",\n        \":determinant_op\",\n        \":lu_op\",\n        \":matrix_exponential_op\",\n        \":matrix_inverse_op\",\n        \":matrix_logarithm_op\",\n        \":matrix_solve_ls_op\",\n        \":matrix_solve_op\",\n        \":matrix_triangular_solve_op\",\n        \":qr_op\",\n        \":self_adjoint_eig_op\",\n        \":self_adjoint_eig_v2_op\",\n        \":svd_op\",\n        \":tridiagonal_solve_op\",\n    ],\n)\n```\n- tensorflow\u002Ftensorflow\u002Fcore\u002Fkernels\u002FBUILD - 删除以下内容\n```python\ntf_kernel_library(\n    name = \"matrix_square_root_op\",\n    prefix = \"matrix_square_root_op\",\n    deps = LINALG_DEPS,\n)\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- configure\n```bash\n$ .\u002Fconfigure\n正在提取 Bazel 安装包……\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭 Bazel 服务器。\n您已安装 Bazel 0.26.1- (@non-git)。\n请指定 Python 的安装路径。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.7\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 CUDA 支持。\n\n您是否希望下载最新版本的 Clang？（实验性）[y\u002FN]：n\n不会下载 Clang。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 MPI 支持。\n\n请指定在使用 bazel 选项“--config=opt”时编译过程中要使用的优化标志。[默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望交互式配置用于 Android 构建的 WORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置如下，您可以通过在构建命令中添加“--config=\u003C配置名>”来使用它们。更多详细信息请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 启用 MKL 支持。\n\t--config=monolithic  \t# 主要采用静态单体式构建的配置。\n\t--config=gdr         \t# 启用 GDR 支持。\n\t--config=verbs       \t# 启用 libverbs 支持。\n\t--config=ngraph      \t# 启用 Intel nGraph 支持。\n\t--config=numa        \t# 启用 NUMA 支持。\n\t--config=dynamic_kernels\t# （实验性）将内核构建为独立的共享对象。\n\t--config=v2             # 构建 TensorFlow 2.x 而不是 1.x\n预配置的 Bazel 构建配置，用于禁用默认启用的功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 GCP 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置已完成。\n```\n- build\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0rc2-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0rc2-cp37-cp37m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>TensorFlow v2.0.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**TensorFlow v2.0.0 - Stretch - Bazel 0.26.1**\n\n============================================================\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev openjdk-8-jdk\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n\n# 在最后一行添加以下两行\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 将最后一行附近的代码修正如下\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构建 `Interpreter` 时返回 InterpreterWrapper。\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Flite\u002Fexperimental\u002Fruy\u002Fpack_arm.cc - 第1292行\n```bash\n\"mov r0, 0\\n\"\n  ↓\n\"mov r0, #0\\n\"\n```\n\n- configure\n```bash\n$ sudo .\u002Fconfigure\n正在提取 Bazel 安装包……\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭您的 Bazel 服务器。\n您已安装 bazel 0.26.1- (@non-git)。\n请指定 Python 的位置。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.7\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 CUDA 支持。\n\n您是否要下载最新版本的 Clang？（实验性）[y\u002FN]：n\n不会下载 Clang。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不启用 MPI 支持。\n\n请指定在使用 bazel 选项“--config=opt”时编译过程中要使用的优化标志。[默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望交互式配置用于 Android 构建的 .\u002FWORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE。\n\n预配置的 Bazel 构建配置如下，您可以通过在构建命令中添加“--config=\u003C配置名>”来使用它们。更多详情请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 启用 MKL 支持。\n\t--config=monolithic  \t# 主要用于静态单体构建的配置。\n\t--config=gdr         \t# 启用 GDR 支持。\n\t--config=verbs       \t# 启用 libverbs 支持。\n\t--config=ngraph      \t# 启用 Intel nGraph 支持。\n\t--config=numa        \t# 启用 NUMA 支持。\n\t--config=dynamic_kernels\t# （实验性）将内核构建为独立的共享对象。\n\t--config=v2             # 构建 Tensorflow 2.x 而不是 1.x\n预配置的 Bazel 构建配置，用于禁用默认功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 GCP 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置已完成\n```\n- build\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0-cp35-cp35m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0-cp35-cp35m-linux_armv7l.whl\n```\n\n============================================================\n\n**Tensorflow v2.0.0 - Buster - Bazel 0.26.1**\n\n============================================================\n首先，请按照以下网址中的步骤安装 openjdk-8-jdk。\n**[[稳定版] 在 Raspbian Buster（Debian 10）环境中安全安装 openjdk-8-jdk](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F612718c0ce4f1def6c6e)**\n接下来，按照以下步骤在 Raspberry Pi 3\u002F4 上构建 TensorFlow。\n```bash\n$ sudo nano \u002Fetc\u002Fdphys-swapfile\nCONF_SWAPFILE=2048\nCONF_MAXSWAP=2048\n\n$ sudo systemctl stop dphys-swapfile\n$ sudo systemctl start dphys-swapfile\n\n$ wget https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fraw\u002Fmaster\u002Fzram.sh\n$ chmod 755 zram.sh\n$ sudo mv zram.sh \u002Fetc\u002Finit.d\u002F\n$ sudo update-rc.d zram.sh defaults\n$ sudo reboot\n\n$ sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev libatlas-base-dev libopenblas-dev\n$ sudo pip3 install keras_applications==1.0.8 --no-deps\n$ sudo pip3 install keras_preprocessing==1.1.0 --no-deps\n$ sudo pip3 install h5py==2.9.0\n$ sudo apt-get install -y openmpi-bin libopenmpi-dev\n$ sudo -H pip3 install -U --user six numpy wheel mock\n\n$ cd ~\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FBazel_bin.git\n$ cd Bazel_bin\n$ .\u002F0.26.1\u002FRaspbian_Debian_Buster_armhf\u002Fopenjdk-8-jdk\u002Finstall.sh\n\n$ cd ~\n$ git clone -b v2.0.0 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow.git\n$ cd tensorflow\n$ git checkout -b v2.0.0\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter.py\n```bash\n\n# 在最后一行添加以下两行\n  def set_num_threads(self, i):\n    return self._interpreter.SetNumThreads(i)\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.cc\n```C++\n\u002F\u002F 将最后一行附近的代码更正如下\nPyObject* InterpreterWrapper::ResetVariableTensors() {\n  TFLITE_PY_ENSURE_VALID_INTERPRETER();\n  TFLITE_PY_CHECK(interpreter_->ResetVariableTensors());\n  Py_RETURN_NONE;\n}\n\nPyObject* InterpreterWrapper::SetNumThreads(int i) {\n  interpreter_->SetNumThreads(i);\n  Py_RETURN_NONE;\n}\n\n}  \u002F\u002F namespace interpreter_wrapper\n}  \u002F\u002F namespace tflite\n```\n- tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\u002Finterpreter_wrapper.h\n\n```C++\n  \u002F\u002F 应该是提供内存的解释器对象。\n  PyObject* tensor(PyObject* base_object, int i);\n\n  PyObject* SetNumThreads(int i);\n\n private:\n  \u002F\u002F 构建 `InterpreterWrapper` 对象的辅助函数。\n  \u002F\u002F 它仅在能够构建 `Interpreter` 时返回 InterpreterWrapper。\n```\n- tensorflow\u002Flite\u002Ftools\u002Fmake\u002FMakefile\n```python\nBUILD_WITH_NNAPI=false\n```\n- tensorflow\u002Flite\u002Fexperimental\u002Fruy\u002Fpack_arm.cc - 第1292行\n```bash\n\"mov r0, 0\\n\"\n  ↓\n\"mov r0, #0\\n\"\n```\n- configure\n```bash\n$ sudo .\u002Fconfigure\n正在提取 Bazel 安装包……\n警告：--batch 模式已弃用。请改用命令“bazel shutdown”显式关闭您的 Bazel 服务器。\n您已安装 bazel 0.26.1- (@non-git)。\n请指定 Python 的位置。[默认为 \u002Fusr\u002Fbin\u002Fpython]：\u002Fusr\u002Fbin\u002Fpython3\n\n\n可能的 Python 库路径：\n  \u002Fusr\u002Flocal\u002Flib\n  \u002Fusr\u002Flib\u002Fpython3\u002Fdist-packages\n  \u002Fhome\u002Fpi\u002Finference_engine_vpu_arm\u002Fpython\u002Fpython3.7\n  \u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n请输入您希望使用的 Python 库路径。默认值为 [\u002Fusr\u002Flocal\u002Flib]\n\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\n您是否希望构建支持 XLA JIT 的 TensorFlow？[Y\u002Fn]：n\nTensorFlow 将不会启用 XLA JIT 支持。\n\n您是否希望构建支持 OpenCL SYCL 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 OpenCL SYCL 支持。\n\n您是否希望构建支持 ROCm 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 ROCm 支持。\n\n您是否希望构建支持 CUDA 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 CUDA 支持。\n\n您是否希望下载最新版本的 Clang？（实验性）[y\u002FN]：n\n不会下载 Clang。\n\n您是否希望构建支持 MPI 的 TensorFlow？[y\u002FN]：n\nTensorFlow 将不会启用 MPI 支持。\n\n请指定在使用 bazel 选项“--config=opt”时编译过程中要使用的优化标志。[默认为 -march=native -Wno-sign-compare]：\n\n\n您是否希望交互式配置用于 Android 构建的 WORKSPACE 文件？[y\u002FN]：n\n不配置用于 Android 构建的 WORKSPACE 文件。\n\n预配置的 Bazel 构建配置。您可以通过在构建命令中添加“--config=\u003C配置名>”来使用以下任一配置。更多详情请参阅 .bazelrc 文件。\n\t--config=mkl         \t# 带 MKL 支持的构建。\n\t--config=monolithic  \t# 主要采用静态单体式构建的配置。\n\t--config=gdr         \t# 带 GDR 支持的构建。\n\t--config=verbs       \t# 带 libverbs 支持的构建。\n\t--config=ngraph      \t# 带 Intel nGraph 支持的构建。\n\t--config=numa        \t# 带 NUMA 支持的构建。\n\t--config=dynamic_kernels\t# （实验性）将内核构建为独立的共享对象。\n\t--config=v2             # 构建 TensorFlow 2.x 而不是 1.x\n预配置的 Bazel 构建配置，用于禁用默认功能：\n\t--config=noaws       \t# 禁用 AWS S3 文件系统支持。\n\t--config=nogcp       \t# 禁用 GCP 支持。\n\t--config=nohdfs      \t# 禁用 HDFS 支持。\n\t--config=noignite    \t# 禁用 Apache Ignite 支持。\n\t--config=nokafka     \t# 禁用 Apache Kafka 支持。\n\t--config=nonccl      \t# 禁用 NVIDIA NCCL 支持。\n配置已完成\n```\n- build\n\n(1) RaspberryPi3\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=1024.0,0.5,0.5 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n(2) RaspberryPi4\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=noignite \\\n--config=nokafka \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.0.0-cp37-cp37m-linux_arm7l.whl ~\n```\n```bash\n$ cd ~\n$ sudo pip3 uninstall tensorflow\n$ sudo -H pip3 install tensorflow-2.0.0-cp37-cp37m-linux_armv7l.whl\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.1.0-rc0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.1.0-rc0 - Buster - Bazel 0.29.1**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.1.0-rc1\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.1.0-rc1 - Buster - Bazel 0.29.1**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.1.0-rc2\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.1.0-rc2 - Buster - Bazel 0.29.1**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.1.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.1.0 - Ubuntu 19.10 aarch64 - Bazel 0.29.1**\n\n============================================================\n\n**[更新 gRPC 依赖以兼容 glibc 2.30](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fissues\u002F33758)**\n\n```bash\n$ curl -L https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftensorflow\u002Fcompare\u002Fmaster...hi-ogawa:grpc-backport-pr-18950.patch | git apply\n\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.1.0 - Buster - Bazel 0.29.1**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.2.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.2.0 - Buster - Bazel 2.0.0**\n\n============================================================\n\n```bash\n$ sudo nano .tf_configure.bazelrc\n\nbuild --action_env PYTHON_BIN_PATH=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --action_env PYTHON_LIB_PATH=\"\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\"\nbuild --python_path=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --config=xla\nbuild:opt --copt=-march=native\nbuild:opt --copt=-Wno-sign-compare\nbuild:opt --host_copt=-march=native\nbuild:opt --define with_default_optimizations=true\ntest --flaky_test_attempts=3\ntest --test_size_filters=small,medium\ntest:v1 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial\ntest:v1 --build_tag_filters=-benchmark-test,-no_oss,-gpu\ntest:v2 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial,-v1only\ntest:v2 --build_tag_filters=-benchmark-test,-no_oss,-gpu,-v1only\nbuild --action_env TF_CONFIGURE_IOS=\"0\"\n\n↓\n\nbuild --action_env PYTHON_BIN_PATH=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --action_env PYTHON_LIB_PATH=\"\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\"\nbuild --python_path=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild:opt --copt=-march=native\nbuild:opt --copt=-Wno-sign-compare\nbuild:opt --host_copt=-march=native\nbuild:opt --define with_default_optimizations=true\ntest --flaky_test_attempts=3\ntest --test_size_filters=small,medium\ntest:v1 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial\ntest:v1 --build_tag_filters=-benchmark-test,-no_oss,-gpu\ntest:v2 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial,-v1only\ntest:v2 --build_tag_filters=-benchmark-test,-no_oss,-gpu,-v1only\nbuild --action_env TF_CONFIGURE_IOS=\"0\"\nbuild --action_env TF_ENABLE_XLA=\"0\"\nbuild --define with_xla_support=false\n```\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,2.0,1.0 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.2.0 - Ubuntu 19.10 aarch64 - Bazel 2.0.0**\n\n============================================================\n\n```bash\n$ nano tensorflow\u002Fthird_party\u002Fpy\u002Fpython_configure.bzl\n\ndef _get_python_include(repository_ctx, python_bin):\n    \"\"\"获取 Python 头文件路径\"\"\"\n    result = execute(\n        repository_ctx,\n        [\n            python_bin,\n\n↓\n\ndef _get_python_include(repository_ctx, python_bin):\n    \"\"\"获取 Python 头文件路径\"\"\"\n    result = execute(\n        repository_ctx,\n        [\n            \"python3\",\n\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=opt \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_resources=4096.0,3.0,1.0 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.3.0\u003C\u002Fsummary>\u003Cdiv>\n\n============================================================\n\n**Tensorflow v2.3.0-rc0 - Buster - Bazel 3.1.0**\n\n============================================================\n\n```bash\n$ sudo nano .tf_configure.bazelrc\n\nbuild --action_env PYTHON_BIN_PATH=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --action_env PYTHON_LIB_PATH=\"\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\"\nbuild --python_path=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --config=xla\nbuild:opt --copt=-march=native\nbuild:opt --copt=-Wno-sign-compare\nbuild:opt --host_copt=-march=native\nbuild:opt --define with_default_optimizations=true\ntest --flaky_test_attempts=3\ntest --test_size_filters=small,medium\ntest:v1 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial\ntest:v1 --build_tag_filters=-benchmark-test,-no_oss,-gpu\ntest:v2 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial,-v1only\ntest:v2 --build_tag_filters=-benchmark-test,-no_oss,-gpu,-v1only\nbuild --action_env TF_CONFIGURE_IOS=\"0\"\n\n↓\n\nbuild --action_env PYTHON_BIN_PATH=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild --action_env PYTHON_LIB_PATH=\"\u002Fusr\u002Flocal\u002Flib\u002Fpython3.7\u002Fdist-packages\"\nbuild --python_path=\"\u002Fusr\u002Fbin\u002Fpython3\"\nbuild:opt --copt=-march=native\nbuild:opt --copt=-Wno-sign-compare\nbuild:opt --host_copt=-march=native\nbuild:opt --define with_default_optimizations=true\ntest --flaky_test_attempts=3\ntest --test_size_filters=small,medium\ntest:v1 --test_tag_filters=-benchmark-test,-no_oss,-gpu,-oss_serial\ntest:v1 --build_tag_filters=-benchmark-test,-no_oss,-gpu\ntest:v2 --test tag filters=-benchmark-test,-no_oss,-gpu,-oss_serial,-v1only\ntest:v2 --build tag filters=-benchmark-test,-no_oss,-gpu,-v1only\nbuild --action env TF_CONFIGURE_IOS=\"0\"\nbuild --action env TF_ENABLE_XLA=\"0\"\nbuild --define with_xla support false\n```\n\n```bash\n$ wget https:\u002F\u002Fgitlab.com\u002Flibeigen\u002Feigen\u002F-\u002Farchive\u002F386d809bde475c65b7940f290efe80e6a05878c4\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\n$ nano tensorflow\u002Fworkspace.bzl\n\ntf_http_archive(\n        name = \"eigen_archive\",\n        build_file = clean_dep(\"\u002F\u002Fthird_party:eigen.BUILD\"),\n        patch_file = clean_dep(\"\u002F\u002Fthird_party\u002Feigen3:gpu_packet_math.patch\"),\n        sha256 = \"f632d82e43ffc46adfac9043beace700b0265748075e7edc0701d81380258038\",  # SHARED_EIGEN_SHA\n        strip_prefix = \"eigen-386d809bde475c65b7940f290efe80e6a05878c4\",\n        urls = [\n            \"https:\u002F\u002Fstorage.googleapis.com\u002Fmirror.tensorflow.org\u002Fgitlab.com\u002Flibeigen\u002Feigen\u002F-\u002Farchive\u002F386d809bde475c65b7940f290efe80e6a05878c4\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\",\n            \"https:\u002F\u002Fgitlab.com\u002Flibeigen\u002Feigen\u002F-\u002Farchive\u002F386d809bde475c65b7940f290efe80e6a05878c4\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\",\n        ],\n    )\n↓\n    tf_http_archive(\n        name = \"eigen_archive\",\n        build_file = clean_dep(\"\u002F\u002Fthird_party:eigen.BUILD\"),\n        patch_file = clean_dep(\"\u002F\u002Fthird_party\u002Feigen3:gpu_packet_math.patch\"),\n        sha256 = \"f632d82e43ffc46adfac9043beace700b0265748075e7edc0701d81380258038\",  # SHARED_EIGEN_SHA\n        strip_prefix = \"eigen-386d809bde475c65b7940f290efe80e6a05878c4\",\n        urls = [\n\t    \"file:\u002F\u002F\u002Fhome\u002Fpi\u002Ftensorflow\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\",\n            \"https:\u002F\u002Fstorage.googleapis.com\u002Fmirror.tensorflow.org\u002Fgitlab.com\u002Flibeigen\u002Feigen\u002F-\u002Farchive\u002F386d809bde475c65b7940f290efe80e6a05878c4\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\",\n            \"https:\u002F\u002Fgitlab.com\u002Flibeigen\u002Feigen\u002F-\u002Farchive\u002F386d809bde475c65b7940f290efe80e6a05878c4\u002Feigen-386d809bde475c65b7940f290efe80e6a05878c4.tar.gz\",\n        ],\n    )\n```\n\n```bash\n$ nano tensorflow\u002Fthird_party\u002Fruy\u002Fworkspace.bzl\n\ndef repo():\n    third_party_http_archive(\n        name = \"ruy\",\n        sha256 = \"8fd4adeeff4f29796bf7cdda64806ec0495a2435361569f02afe3fe33406f07c\",\n        strip_prefix = \"ruy-34ea9f4993955fa1ff4eb58e504421806b7f2e8f\",\n        urls = [\n            \"https:\u002F\u002Fstorage.googleapis.com\u002Fmirror.tensorflow.org\u002Fgithub.com\u002Fgoogle\u002Fruy\u002Farchive\u002F34ea9f4993955fa1ff4eb58e504421806b7f2e8f.zip\",\n            \"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fruy\u002Farchive\u002F34ea9f4993955fa1ff4eb58e504421806b7f2e8f.zip\",\n        ],\n        build_file = \"\u002F\u002Fthird_party\u002Fruy:BUILD\",\n    )\n\n↓\n\ndef repo():\n    third_party_http_archive(\n        name = \"ruy\",\n        sha256 = \"89b8b56b4e1db894e75a0abed8f69757b37c23dde6e64bfb186656197771138a\",\n        strip_prefix = \"ruy-388ffd28ba00ffb9aacbe538225165c02ea33ee3\",\n        urls = [\n            \"https:\u002F\u002Fstorage.googleapis.com\u002Fmirror.tensorflow.org\u002Fgithub.com\u002Fgoogle\u002Fruy\u002Farchive\u002F388ffd28ba00ffb9aacbe538225165c02ea33ee3.zip\",\n            \"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fruy\u002Farchive\u002F388ffd28ba00ffb9aacbe538225165c02ea33ee3.zip\",\n        ],\n        build_file = \"\u002F\u002Fthird_party\u002Fruy:BUILD\",\n    )\n```\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_ram_resources=4096 \\\n--local_cpu_resources=2 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n--linkopt=-Wl,-latomic \\\n--host_linkopt=-Wl,-latomic \\\n--define=tensorflow_mkldnn_contraction_kernel=0 \\\n--define=raspberry_pi_with_neon=true \\\n--define=tflite_pip_with_flex=true \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.3.0-rc0 - Debian Buster aarch64 - Bazel 3.1.0**\n\n============================================================\n\n```bash\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--local_ram_resources=30720 \\\n--local_cpu_resources=10 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.4.0\u003C\u002Fsummary>\u003Cdiv>\n\n- **tensorflow\u002Ftensorflow\u002Flite\u002Fkernels\u002FBUILD**\n```bash\ncc_library(\n    name = \"builtin_op_kernels\",\n    srcs = BUILTIN_KERNEL_SRCS + [\n        \"max_pool_argmax.cc\",\n        \"max_unpooling.cc\",\n        \"transpose_conv_bias.cc\",\n    ],\n    hdrs = [\n        \"dequantize.h\",\n        \"max_pool_argmax.h\",\n        \"max_unpooling.h\",\n        \"transpose_conv_bias.h\",\n    ],\n    compatible_with = get_compatible_with_portable(),\n    copts = tflite_copts() + tf_opts_nortti_if_android() + EXTRA_EIGEN_COPTS,\n    visibility = [\"\u002F\u002Fvisibility:private\"],\n    deps = BUILTIN_KERNEL_DEPS + [\n        \"@ruy\u002F\u002Fruy\u002Fprofiler:instrumentation\",\n        \"\u002F\u002Ftensorflow\u002Flite\u002Fkernels\u002Finternal:cppmath\",\n        \"\u002F\u002Ftensorflow\u002Flite:string\",\n        \"@farmhash_archive\u002F\u002F:farmhash\",\n    ],\n)\n```\n```bash\n$ sudo pip3 install gdown\n$ cd tensorflow\u002Ftensorflow\u002Flite\u002Fkernels\n$ sudo gdown --id 17qEXPvo5l72j4O5qEcSoLcmJAthaqSws\n$ tar -zxvf kernels.tar.gz && rm kernels.tar.gz -f\n$ cd ..\u002F..\u002F..\n```\n\n============================================================\n\n**Tensorflow v2.4.0 - Buster - Bazel 3.1.0**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_ram_resources=4096 \\\n--local_cpu_resources=2 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n--linkopt=-Wl,-latomic \\\n--host_linkopt=-Wl,-latomic \\\n--define=tensorflow_mkldnn_contraction_kernel=0 \\\n--define=raspberry_pi_with_neon=true \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.4.0 - Debian Buster aarch64 - Bazel 3.1.0**\n\n============================================================\n\n```bash\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--local_ram_resources=30720 \\\n--local_cpu_resources=10 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ su --preserve-environment\n\n\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n\n# 退出\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.4.0-cp37-cp37m-linux_arm7l.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.5.0\u003C\u002Fsummary>\u003Cdiv>\n\n- **tensorflow\u002Ftensorflow\u002Flite\u002Fkernels\u002FBUILD**\n为MediaPipe添加自定义算子。\n```bash\ncc_library(\n    name = \"builtin_op_kernels\",\n    srcs = BUILTIN_KERNEL_SRCS + [\n        \"max_pool_argmax.cc\",\n        \"max_unpooling.cc\",\n        \"transpose_conv_bias.cc\",\n    ],\n    hdrs = [\n        \"dequantize.h\",\n        \"max_pool_argmax.h\",\n        \"max_unpooling.h\",\n        \"transpose_conv_bias.h\",\n    ],\n    compatible_with = get_compatible_with_portable(),\n    copts = tflite_copts() + tf_opts_nortti_if_android() + EXTRA_EIGEN_COPTS,\n    visibility = [\"\u002F\u002Fvisibility:private\"],\n    deps = BUILTIN_KERNEL_DEPS + [\n        \"@ruy\u002F\u002Fruy\u002Fprofiler:instrumentation\",\n        \"\u002F\u002Ftensorflow\u002Flite\u002Fkernels\u002Finternal:cppmath\",\n        \"\u002F\u002Ftensorflow\u002Flite:string\",\n        \"@farmhash_archive\u002F\u002F:farmhash\",\n    ],\n)\n```\n```bash\n$ sudo pip3 install gdown h5py==3.1.0\n$ cd tensorflow\u002Flite\u002Fkernels\n$ sudo gdown --id 1fuB2m7B_-3u7-kxuNcALUp9wkrHsfCQB\n$ tar -zxvf kernels.tar.gz && rm kernels.tar.gz -f\n$ cd ..\u002F..\u002F..\n$ sudo bazel clean --expunge\n```\n\n============================================================\n\n**Tensorflow v2.5.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**原生编译**\n\n============================================================\n\n```bash\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_ram_resources=4096 \\\n--local_cpu_resources=2 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n--linkopt=-Wl,-latomic \\\n--host_linkopt=-Wl,-latomic \\\n--define=tensorflow_mkldnn_contraction_kernel=0 \\\n--define=raspberry_pi_with_neon=true \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.5.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**通过x86主机进行交叉编译**\n\n============================================================\n\n```bash\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002Ftensorflow-on-arm.git && \\\n  cd tensorflow-on-arm\u002Fbuild_tensorflow\n$ docker build -t tf-arm -f Dockerfile .\n$ docker run -it --rm \\\n  -v \u002Ftmp\u002Ftensorflow_pkg\u002F:\u002Ftmp\u002Ftensorflow_pkg\u002F \\\n  --env TF_PYTHON_VERSION=3.7 \\\n  tf-arm .\u002Fbuild_tensorflow.sh configs\u002Frpi.conf\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.5.0-cp37-none-linux_armv7l.whl .\n$ sudo chmod 777 tensorflow-2.5.0-cp37-none-linux_armv7l.whl\n```\n\n============================================================\n\n**Tensorflow v2.5.0 - Debian Buster aarch64 - Bazel 3.7.2**\n**使用EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.5.0-cp37-cp37m-linux_arm7l.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.6.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install libhdf5-dev && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.0 --no-deps && \\\nsudo pip3 install gdown h5py==3.1.0 && \\\nsudo pip3 install pybind11 && \\\npip3 install -U --user six wheel mock\n```\n- 应用自定义以添加MediaPipe的自定义操作。（max_pool_argmax、max_unpooling、transpose_conv_bias）\n```bash\ncd tensorflow\u002Flite\u002Fkernels\nsudo gdown --id 124YrrMZjj_lZxVnpxePs-F69i0xz7Qru\ntar -zxvf kernels.tar.gz && rm kernels.tar.gz -f\ncd ..\u002F..\u002F..\n```\n- 为XNNPACK应用多线程支持。\n```bash\n# interpreter.py\ncd tensorflow\u002Flite\u002Fpython\nsudo gdown --id 1LuEW11VLhR4gO1RPlymELDvXBFqU7WSK\ncd ..\u002F..\u002F..\n\n# interpreter_wrapper.cc、interpreter_wrapper.h、interpreter_wrapper_pybind11.cc\ncd tensorflow\u002Flite\u002Fpython\u002Finterpreter_wrapper\nsudo gdown --id 1zTO0z6Pe_a6RJxw7N_3gyqhFxGunFK-y\ntar -zxvf interpreter_wrapper.tar.gz && rm interpreter_wrapper.tar.gz -f\ncd ..\u002F..\u002F..\u002F..\n```\n\n============================================================\n\n**TensorFlow v2.6.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**原生构建**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_ram_resources=4096 \\\n--local_cpu_resources=2 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n--linkopt=-Wl,-latomic \\\n--host_linkopt=-Wl,-latomic \\\n--define=tensorflow_mkldnn_contraction_kernel=0 \\\n--define=raspberry_pi_with_neon=true \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**TensorFlow v2.6.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**通过 x86 主机进行交叉编译**\n\n============================================================\n\n```bash\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002Ftensorflow-on-arm.git && \\\n  cd tensorflow-on-arm\u002Fbuild_tensorflow\n$ docker build -t tf-arm -f Dockerfile .\n$ docker run -it --rm \\\n  -v \u002Ftmp\u002Ftensorflow_pkg\u002F:\u002Ftmp\u002Ftensorflow_pkg\u002F \\\n  --env TF_PYTHON_VERSION=3.7 \\\n  tf-arm .\u002Fbuild_tensorflow.sh configs\u002Frpi.conf\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.6.0-cp37-none-linux_armv7l.whl .\n$ sudo chmod 777 tensorflow-2.6.0-cp37-none-linux_armv7l.whl\n```\n\n============================================================\n\n**TensorFlow v2.6.0 - Debian Buster aarch64 - Bazel 3.7.2**\n**使用 EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**TensorFlow v2.6.0 - CUDA x86_64 - Bazel 3.7.2**\n\n============================================================\n\n`支持计算能力 >= 3.5 [默认值：3.5,7.0]: 5.3,6.1,6.2,7.2,7.5,8.6`\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ su --preserve-environment\n# .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n# exit\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.6.0-cp37-cp37m-linux_arm7l.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>TensorFlow v2.7.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install libhdf5-dev && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.1.0 && \\\nsudo pip3 install pybind11 && \\\npip3 install -U --user six wheel mock\n```\n- 应用自定义以添加 MediaPipe 的自定义操作。（max_pool_argmax、max_unpooling、transpose_conv_bias）\n```bash\ncd tensorflow\u002Flite\u002Fkernels\nsudo gdown --id 1Az4hEvLXAb71e52gBORQz87Z0FExUz2B\ntar -zxvf kernels.tar.gz && rm kernels.tar.gz -f\ncd ..\u002F..\u002F..\n```\n- 为 XNNPACK 添加多线程支持（Python）。\n```bash\n# interpreter_wrapper.cc\nsudo gdown --id 1iNc8qC1y5CJdMWCcTXhl6SiDQg3M1DRv\ngit apply xnnpack_python.patch\n```\n\n============================================================\n\n**TensorFlow v2.7.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**原生构建**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel --host_jvm_args=-Xmx512m build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--local_ram_resources=4096 \\\n--local_cpu_resources=2 \\\n--copt=-mfpu=neon-vfpv4 \\\n--copt=-ftree-vectorize \\\n--copt=-funsafe-math-optimizations \\\n--copt=-ftree-loop-vectorize \\\n--copt=-fomit-frame-pointer \\\n--copt=-DRASPBERRY_PI \\\n--host_copt=-DRASPBERRY_PI \\\n--linkopt=-Wl,-latomic \\\n--host_linkopt=-Wl,-latomic \\\n--define=tensorflow_mkldnn_contraction_kernel=0 \\\n--define=raspberry_pi_with_neon=true \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**TensorFlow v2.7.0 - Buster armv7l\u002Farmhf - Bazel 3.7.2**\n**通过 x86 主机进行交叉编译**\n\n============================================================\n\n```bash\n$ git clone https:\u002F\u002Fgithub.com\u002FPINTO0309\u002Ftensorflow-on-arm.git && \\\n  cd tensorflow-on-arm\u002Fbuild_tensorflow\n$ docker build -t tf-arm -f Dockerfile .\n$ docker run -it --rm \\\n  -v \u002Ftmp\u002Ftensorflow_pkg\u002F:\u002Ftmp\u002Ftensorflow_pkg\u002F \\\n  --env TF_PYTHON_VERSION=3.7 \\\n  tf-arm .\u002Fbuild_tensorflow.sh configs\u002Frpi.conf\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.7.0-cp37-none-linux_armv7l.whl .\n$ sudo chmod 777 tensorflow-2.7.0-cp37-none-linux_armv7l.whl\n```\n\n============================================================\n\n**TensorFlow v2.7.0 - Debian Buster aarch64 - Bazel 3.7.2**\n**使用 EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**TensorFlow v2.7.0 - CUDA11.4 - TensorRT8.2 - x86_64 - Bazel 3.7.2**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ cp tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInfer_8_0.inc tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInfer_8_2.inc \\\n&& sed -i '62a #elif NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR == 2' tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002Fnvinfer_stub.cc \\\n&& sed -i '63a #include \"tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInfer_8_2.inc\"' tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002Fnvinfer_stub.cc \\\n&& cp tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInferPlugin_8_0.inc tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInferPlugin_8_2.inc \\\n&& sed -i '62a #elif NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR == 2' tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002Fnvinfer_plugin_stub.cc \\\n&& sed -i '63a #include \"tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002FNvInferPlugin_8_2.inc\"' tensorflow\u002Fcompiler\u002Ftf2tensorrt\u002Fstub\u002Fnvinfer_plugin_stub.cc\n\n$ .\u002Fconfigure\n\n支持计算能力 >= 3.5 [默认值：3.5,7.0]：6.1,7.5,8.6\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.7.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.8.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install libhdf5-dev && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.1.0 && \\\nsudo pip3 install pybind11 && \\\npip3 install -U --user six wheel mock\n```\n- 应用自定义以添加用于MediaPipe的自定义操作。（max_pool_argmax、max_unpooling、transpose_conv_bias）\n```bash\ncd tensorflow\u002Flite\u002Fkernels\nsudo gdown --id 1qTVQ9qnbvzxxWm-1mGGkO7NRB9Rd_Uht\ntar -zxvf kernels.tar.gz && rm kernels.tar.gz -f\ncd ..\u002F..\u002F..\n```\n\n============================================================\n\n**Tensorflow v2.8.0 - Debian Bullseye aarch64 - Bazel 4.2.1**\n**使用 EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.8.0 - CUDA11.4 - TensorRT8.2 - x86_64 - Bazel 4.2.1**\n\n============================================================\n\n```bash\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F4.2.1\u002Fbazel-4.2.1-installer-linux-x86_64.sh\n$ sudo chmod +x bazel-4.2.1-installer-linux-x86_64.sh && sudo .\u002Fbazel-4.2.1-installer-linux-x86_64.sh\n$ sudo bazel clean --expunge\n$ .\u002Fconfigure\n\n支持计算能力 >= 3.5 [默认值：3.5,7.0]：6.1,7.5,8.6\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.8.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.9.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y libhdf5-dev unzip pkg-config python3-pip cmake make python-is-python3 && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.6.0 && \\\nsudo pip3 install pybind11==2.9.2 && \\\nsudo pip3 install packaging && \\\npip3 install -U --user six wheel mock\n```\n- 应用自定义以添加用于MediaPipe的自定义操作。（max_pool_argmax、max_unpooling、transpose_conv_bias、TransformLandmarks、TransformTensorBilinear、Landmarks2TransformMatrix）\n```bash\n$ curl -OL https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin\u002Freleases\u002Fdownload\u002Fv2.9.0\u002Fmediapipe_customop_patch.zip \\\n&& unzip -d mediapipe_customop_patch mediapipe_customop_patch.zip \\\n&& git apply mediapipe_customop_patch\u002F*\n```\n\n============================================================\n\n**Tensorflow v2.9.0 - Debian Bullseye aarch64 - Bazel 5.0.0**\n**使用 EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ wget -O bazel https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.0.0\u002Fbazel-5.0.0-linux-arm64 \\\n&& sudo chmod 777 bazel \\\n&& sudo cp bazel \u002Fusr\u002Flocal\u002Fbin \\\n&& sudo bazel clean --expunge \\\n&& .\u002Fconfigure\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**Tensorflow v2.9.0 - CUDA11.6 - TensorRT8.4 - x86_64 - Bazel 5.0.0**\n\n============================================================\n\n```bash\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.0.0\u002Fbazel-5.0.0-installer-linux-x86_64.sh \\\n&& sudo chmod +x bazel-5.0.0-installer-linux-x86_64.sh \\\n&& sudo .\u002Fbazel-5.0.0-installer-linux-x86_64.sh \\\n&& sudo bazel clean --expunge\n&& .\u002Fconfigure\n\n支持计算能力 >= 3.5 [默认值：3.5,7.0]：6.1,7.5,8.6\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.9.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>Tensorflow v2.10.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n  libhdf5-dev unzip pkg-config python3-pip \\\n  cmake make python-is-python3 && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install numpy==1.23.2 && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.6.0 && \\\nsudo pip3 install pybind11==2.9.2 && \\\nsudo pip3 install packaging && \\\npip3 install -U --user six wheel mock\n```\n- 应用自定义以添加 MediaPipe 的自定义操作。（max_pool_argmax、max_unpooling、transpose_conv_bias、TransformLandmarks、TransformTensorBilinear、Landmarks2TransformMatrix）\n```bash\n$ curl -OL https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin\u002Freleases\u002Fdownload\u002Fv2.10.0\u002Fmediapipe_customop_patch.zip \\\n&& unzip -d mediapipe_customop_patch mediapipe_customop_patch.zip \\\n&& git apply mediapipe_customop_patch\u002F*\n```\n\n============================================================\n\n**TensorFlow v2.10.0 - Debian Bullseye aarch64 - Bazel 5.1.1**\n**使用 EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ wget -O bazel https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.1.1\u002Fbazel-5.1.1-linux-arm64 \\\n&& sudo chmod 777 bazel \\\n&& sudo cp bazel \u002Fusr\u002Flocal\u002Fbin \\\n&& sudo bazel clean --expunge \\\n&& .\u002Fconfigure\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**TensorFlow v2.10.0 - CUDA11.7 - TensorRT8.4.3 - x86_64 - Bazel 5.1.1**\n\n============================================================\n\n```bash\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.1.1\u002Fbazel-5.1.1-installer-linux-x86_64.sh \\\n&& sudo chmod +x bazel-5.1.1-installer-linux-x86_64.sh \\\n&& sudo .\u002Fbazel-5.1.1-installer-linux-x86_64.sh \\\n&& sudo bazel clean --expunge\n&& .\u002Fconfigure\n\n支持计算能力 >= 3.5 [默认值：3.5,7.0]：6.1,7.5,8.6\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.10.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>＜无效＞ TensorFlow v2.11.0\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n  libhdf5-dev unzip pkg-config python3-pip \\\n  cmake make python-is-python3 && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install numpy==1.23.4 && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.6.0 && \\\nsudo pip3 install pybind11==2.9.2 && \\\nsudo pip3 install packaging && \\\npip3 install -U --user six wheel mock\n```\n- 应用自定义以添加 MediaPipe 的自定义操作。（max_pool_argmax、max_unpooling、transpose_conv_bias、TransformLandmarks、TransformTensorBilinear、Landmarks2TransformMatrix）\n```bash\n$ curl -OL https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin\u002Freleases\u002Fdownload\u002Fv2.11.0\u002Fmediapipe_customop_patch.zip \\\n&& unzip -d mediapipe_customop_patch mediapipe_customop_patch.zip \\\n&& git apply mediapipe_customop_patch\u002F*\n```\n\n============================================================\n\n**TensorFlow v2.11.0 - Debian Bullseye aarch64 - Bazel 5.3.0**\n**使用 EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ wget -O bazel https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.3.0\u002Fbazel-5.3.0-linux-arm64 \\\n&& sudo chmod 777 bazel \\\n&& sudo cp bazel \u002Fusr\u002Flocal\u002Fbin \\\n&& sudo bazel clean --expunge \\\n&& .\u002Fconfigure\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**TensorFlow v2.11.0 - CUDA11.7 - TensorRT8.4.3 - x86_64 - Bazel 5.3.0**\n\n============================================================\n\n```bash\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.3.0\u002Fbazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo chmod +x bazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo .\u002Fbazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo bazel clean --expunge\n&& .\u002Fconfigure\n\n支持计算能力 >= 3.5 [默认值：3.5,7.0]：6.1,7.5,8.6\n\n$ sudo bazel build \\\n--config=monolithic \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_pip_with_flex=true \\\n--define=tflite_with_xnnpack=true \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.11.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>TensorFlow v2.12.0 https:\u002F\u002Fzenn.dev\u002Fpinto0309\u002Fscraps\u002Fa735fde5301bdc\u003C\u002Fsummary>\u003Cdiv>\n\n```\n$ sudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n  libhdf5-dev unzip pkg-config python3-pip \\\n  cmake make python-is-python3 wget && \\\nsudo pip3 install pip --upgrade && \\\nsudo pip3 install numpy==1.24.2 && \\\nsudo pip3 install keras_applications==1.0.8 --no-deps && \\\nsudo pip3 install keras_preprocessing==1.1.2 --no-deps && \\\nsudo pip3 install gdown h5py==3.6.0 && \\\nsudo pip3 install pybind11==2.9.2 && \\\nsudo pip3 install packaging && \\\nsudo pip3 install protobuf==3.20.3 && \\\npip3 install -U --user six wheel mock\n\n$ sed -i '15a #include \u003Cassert.h>' tensorflow\u002Ftsl\u002Fframework\u002Ffixedpoint\u002FMatMatProductAVX2.h\n```\n\n============================================================\n\n**TensorFlow v2.12.0 - Debian 11\u002FDebian 12\u002FUbuntu 20.04\u002F22.04 aarch64 - Bazel 5.3.0**\n**使用 EC2 m6g.16xlarge**\n\n============================================================\n\n```bash\n$ wget -O bazel https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.3.0\u002Fbazel-5.3.0-linux-arm64 \\\n&& sudo chmod 777 bazel \\\n&& sudo cp bazel \u002Fusr\u002Flocal\u002Fbin \\\n&& sudo bazel clean --expunge \\\n&& .\u002Fconfigure\n\n$ sudo bazel build \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_with_xnnpack=true \\\n--copt=\"-Wno-stringop-overflow\" \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n**＜无效＞ TensorFlow v2.12.0 - CUDA11.7 - TensorRT8.4.3 - x86_64 - Bazel 5.3.0**\n\n============================================================\n\n```bash\n$ wget https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F5.3.0\u002Fbazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo chmod +x bazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo .\u002Fbazel-5.3.0-installer-linux-x86_64.sh \\\n&& sudo bazel clean --expunge\n&& .\u002Fconfigure\n\n\n\n# https:\u002F\u002Fdeveloper.nvidia.com\u002Fcuda-gpus\n支持的计算能力 >= 3.5 [默认值：3.5,7.0]：8.6\n\n$ sudo bazel build \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_with_xnnpack=true \\\n--define=with_xla_support=false \\\n--ui_actions_shown=20 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n============================================================\n\n```bash\n$ sudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\n$ sudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.12.0*.whl ~\n```\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>TensorFlow v2.15.0\u003C\u002Fsummary>\u003Cdiv>\n\n```bash\n# Bullseye, Ubuntu 22.04\nsudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n    libhdf5-dev \\\n    unzip \\\n    pkg-config \\\n    python3-pip \\\n    cmake \\\n    make \\\n    git \\\n    python-is-python3 \\\n    wget \\\n    patchelf && \\\npip install -U pip && \\\npip install numpy==1.26.2 && \\\npip install keras_applications==1.0.8 --no-deps && \\\npip install keras_preprocessing==1.1.2 --no-deps && \\\npip install h5py==3.6.0 && \\\npip install pybind11==2.9.2 && \\\npip install packaging && \\\npip install protobuf==3.20.3 && \\\npip install six wheel mock gdown\n\n# Bookworm\nsudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n    libhdf5-dev \\\n    unzip \\\n    pkg-config \\\n    python3-pip \\\n    cmake \\\n    make \\\n    git \\\n    python-is-python3 \\\n    wget \\\n    patchelf && \\\npip install -U pip --break-system-packages && \\\npip install numpy==1.26.2 --break-system-packages && \\\npip install keras_applications==1.0.8 --no-deps --break-system-packages && \\\npip install keras_preprocessing==1.1.2 --no-deps --break-system-packages && \\\npip install h5py==3.10.0 --break-system-packages && \\\npip install pybind11==2.9.2 --break-system-packages && \\\npip install packaging --break-system-packages && \\\npip install protobuf==3.20.3 --break-system-packages && \\\npip install six wheel mock gdown --break-system-packages\n\n\ngit clone -b r2.15-tflite-build https:\u002F\u002Fgithub.com\u002FPINTO0309\u002Ftensorflow.git\ncd tensorflow\n\nexport TF_PYTHON_VERSION=3.xx\n\nwget -O bazel https:\u002F\u002Fgithub.com\u002Fbazelbuild\u002Fbazel\u002Freleases\u002Fdownload\u002F6.1.0\u002Fbazel-6.1.0-linux-arm64 \\\n&& sudo chmod 777 bazel \\\n&& sudo cp bazel \u002Fusr\u002Flocal\u002Fbin \\\n&& sudo bazel clean --expunge \\\n&& .\u002Fconfigure\n\nbazel build \\\n--config=noaws \\\n--config=nohdfs \\\n--config=nonccl \\\n--config=v2 \\\n--define=tflite_with_xnnpack=true \\\n--define=xnnpack_force_float_precision=fp16 \\\n--copt=\"-Wno-stringop-overflow\" \\\n--ui_actions_shown=64 \\\n\u002F\u002Ftensorflow\u002Ftools\u002Fpip_package:build_pip_package\n```\n\n```bash\nsudo .\u002Fbazel-bin\u002Ftensorflow\u002Ftools\u002Fpip_package\u002Fbuild_pip_package \u002Ftmp\u002Ftensorflow_pkg\nsudo cp \u002Ftmp\u002Ftensorflow_pkg\u002Ftensorflow-2.15.0*.whl ~\n```\n\n\n\u003C\u002Fdiv>\u003C\u002Fdetails>\n\n## 参考文章\n- **[适用于 Raspberry Pi 3\u002F4 的 64 位操作系统镜像创建仓库](https:\u002F\u002Fgithub.com\u002Fdrtyhlpr\u002Frpi23-gen-image.git)**\n\n- **[如何在 Raspberry Pi 3 上安装 Ubuntu 18.04 aarch64 (64 位)](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F4f3bca0629bc41f22b83)**\n\n- **[[日文版] [TensorFlow Lite] TensorFlow Lite 的各种神经网络模型量化方法（权重量化、整数量化、全整数量化、Float16 量化、Edge TPU）。截至 2020 年 5 月 5 日。](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F008c54536fca690e0572)**\n\n- **[[英文版] [TensorFlow Lite] TensorFlow Lite 的各种神经网络模型量化方法（权重量化、整数量化、全整数量化、Float16 量化、Edge TPU）。截至 2020 年 5 月 5 日。](https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002F865250ee23a15339d556)**\n\n- **`Michael`** 为 Jetson Nano 提供的预编译二进制文件。**https:\u002F\u002Fdl.photoprism.org\u002Ftensorflow\u002F**\n\n- **[向 TFLite 运行时添加自定义 OP 以构建 whl 安装程序（用于 Python）](https:\u002F\u002Fzenn.dev\u002Fpinto0309\u002Farticles\u002Fa0e40c2817f2ee)**，**`MaxPoolingWithArgmax2D`**、**`MaxUnpooling2D`**、**`Convolution2DTransposeBias`**","# Tensorflow-bin 快速上手指南\n\nTensorflow-bin 是专为树莓派（Raspberry Pi）及其他 ARM 架构设备预编译的 TensorFlow 二进制包，内置 TensorFlow Lite 支持，并优化了 XNNPACK 加速（支持半精度推理）。本指南帮助用户在树莓派上快速部署 TensorFlow v2 环境。\n\n## 1. 环境准备\n\n### 系统要求\n本工具主要支持以下系统与架构组合（以 64 位系统为主）：\n- **OS**: RaspberryPiOS (Bullseye\u002FBookworm), Ubuntu (20.04\u002F21.04\u002F22.04), Debian\n- **Architecture**: `aarch64` (armv8) 或 `armhf` (armv7l，仅限旧版)\n- **Python 版本**: 3.9, 3.10, 3.11 (对应 TensorFlow v2.15.0)\n\n> **注意**：自树莓派官方发布 64 位 OS 后，本项目已停止构建新的 `armhf` (32 位) Wheel 包。如需 32 位支持，请参考 [TensorflowLite-bin](https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin)。\n\n### 前置依赖安装\n根据你的系统版本选择对应的依赖安装命令。\n\n#### 方案 A：适用于 Ubuntu 22.04 \u002F Debian Bullseye\n```bash\nsudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n    libhdf5-dev \\\n    unzip \\\n    pkg-config \\\n    python3-pip \\\n    cmake \\\n    make \\\n    git \\\n    python-is-python3 \\\n    wget \\\n    patchelf && \\\npip install -U pip && \\\npip install numpy==1.26.2 && \\\npip install keras_applications==1.0.8 --no-deps && \\\npip install keras_preprocessing==1.1.2 --no-deps && \\\npip install h5py==3.6.0 && \\\npip install pybind11==2.9.2 && \\\npip install packaging && \\\npip install protobuf==3.20.3 && \\\npip install six wheel mock gdown\n```\n\n#### 方案 B：适用于 Debian Bookworm (树莓派最新系统)\n*注：Bookworm 系统需添加 `--break-system-packages` 参数以避免外部包管理冲突。*\n```bash\nsudo apt update && sudo apt upgrade -y && \\\nsudo apt install -y \\\n    libhdf5-dev \\\n    unzip \\\n    pkg-config \\\n    python3-pip \\\n    cmake \\\n    make \\\n    git \\\n    python-is-python3 \\\n    wget \\\n    patchelf && \\\npip install -U pip --break-system-packages && \\\npip install numpy==1.26.2 --break-system-packages && \\\npip install keras_applications==1.0.8 --no-deps --break-system-packages && \\\npip install keras_preprocessing==1.1.2 --no-deps --break-system-packages && \\\npip install h5py==3.10.0 --break-system-packages && \\\npip install pybind11==2.9.2 --break-system-packages && \\\npip install packaging --break-system-packages && \\\npip install protobuf==3.20.3 --break-system-packages && \\\npip install six wheel mock gdown --break-system-packages\n```\n\n> **国内加速建议**：如果下载上述 Python 包速度较慢，建议在 `pip install` 命令后追加 `-i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple` 使用清华镜像源。\n\n## 2. 安装步骤\n\n安装前请先卸载可能冲突的旧版本 TensorFlow，然后根据你的 Python 版本选择对应的 Wheel 包进行安装。\n\n### 第一步：清理旧版本\n```bash\npip uninstall tensorflow\n```\n\n### 第二步：确定版本变量\n设置你要安装的 TensorFlow 版本和目标 Python 版本：\n```bash\nTFVER=2.15.0.post1\n\n# 根据你的 Python 版本选择其一 (39 代表 3.9, 310 代表 3.10, 311 代表 3.11)\nPYVER=39\n# 或 PYVER=310\n# 或 PYVER=311\n\n# 自动获取当前 CPU 架构 (通常为 aarch64)\nARCH=`python -c 'import platform; print(platform.machine())'`\necho CPU ARCH: ${ARCH}\n```\n\n### 第三步：执行安装\n直接从 GitHub Release 下载安装包（若网络受限，可先手动下载 `.whl` 文件到本地再安装）：\n```bash\npip install \\\n--no-cache-dir \\\nhttps:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Freleases\u002Fdownload\u002Fv${TFVER}\u002Ftensorflow-${TFVER}-cp${PYVER}-none-linux_${ARCH}.whl\n```\n\n## 3. 基本使用\n\n### 验证安装\n运行以下命令检查 TensorFlow 版本，确认是否启用 XNNPACK 加速（默认开启）：\n```bash\npython -c 'import tensorflow as tf;print(tf.__version__)'\n```\n预期输出：`2.15.0.post1`\n\n### 简单推理示例 (多线程测试)\n以下示例演示如何使用 TensorFlow Lite 进行图像分类，并对比单线程与多线程的性能差异。\n\n**1. 准备测试数据**\n```bash\ncd ~; mkdir test\ncurl https:\u002F\u002Fraw.githubusercontent.com\u002Ftensorflow\u002Ftensorflow\u002Fmaster\u002Ftensorflow\u002Flite\u002Fexamples\u002Flabel_image\u002Ftestdata\u002Fgrace_hopper.bmp > ~\u002Ftest\u002Fgrace_hopper.bmp\ncurl https:\u002F\u002Fstorage.googleapis.com\u002Fdownload.tensorflow.org\u002Fmodels\u002Fmobilenet_v1_1.0_224_frozen.tgz | tar xzv -C ~\u002Ftest mobilenet_v1_1.0_224\u002Flabels.txt\nmv ~\u002Ftest\u002Fmobilenet_v1_1.0_224\u002Flabels.txt ~\u002Ftest\u002F\ncurl http:\u002F\u002Fdownload.tensorflow.org\u002Fmodels\u002Fmobilenet_v1_2018_02_22\u002Fmobilenet_v1_1.0_224_quant.tgz | tar xzv -C ~\u002Ftest\n# 注意：label_image.py 脚本需自行创建或从 TF 源码获取，此处假设已存在\n```\n\n**2. 运行测试脚本**\n创建一个名为 `label_image.py` 的文件（内容参考原项目中的 Sample Code），然后运行：\n\n*单线程模式:*\n```bash\ncd ~\u002Ftest\npython3 label_image.py \\\n--num_threads 1 \\\n--image grace_hopper.bmp \\\n--model_file mobilenet_v1_1.0_224_quant.tflite \\\n--label_file labels.txt\n```\n\n*四线程模式 (推荐，利用 XNNPACK 加速):*\n```bash\ncd ~\u002Ftest\npython3 label_image.py \\\n--num_threads 4 \\\n--image grace_hopper.bmp \\\n--model_file mobilenet_v1_1.0_224_quant.tflite \\\n--label_file labels.txt\n```\n观察输出的 `time` 字段，四线程模式下推理耗时应显著降低。","某农业科技公司正在树莓派 4B 上部署一套实时作物病害识别系统，需要在边缘端运行轻量级的 TensorFlow Lite 模型以监测田间摄像头画面。\n\n### 没有 Tensorflow-bin 时\n- **编译环境极其复杂**：开发者需在资源受限的树莓派上手动安装 HDF5、Eigen、OpenBLAS 等数十个底层依赖库，并尝试从源码编译 TensorFlow，耗时数小时且极易因内存不足而失败。\n- **推理性能低下**：即使勉强运行官方基础包，由于缺乏针对 ARM 架构优化的 XNNPACK 后端支持，模型推理帧率仅为 2-3 FPS，无法满足实时监测需求。\n- **版本兼容性差**：难以找到与特定 Raspbian 或 Ubuntu 版本（如 glibc 2.28\u002F2.31）严格匹配的预编译 Wheel 包，常出现\"undefined symbol\"导致程序无法启动。\n- **功能支持缺失**：若模型包含 MediaPipe 自定义算子或缺少 FlexDelegate 支持，官方精简版无法加载模型，迫使团队放弃边缘部署方案。\n\n### 使用 Tensorflow-bin 后\n- **一键极速部署**：直接下载匹配当前系统架构（armv7l\u002Faarch64）和 Python 版本的预编译 .whl 文件，pip 安装即可运行，将环境搭建时间从数小时缩短至几分钟。\n- **推理性能倍增**：利用内置的 XNNPACK 及半精度（Float16）加速特性，在同等硬件下模型推理速度提升一倍，帧率稳定在 6 FPS 以上，实现流畅实时检测。\n- **系统完美适配**：提供覆盖从 Debian Stretch 到 Bookworm 等多版本系统的二进制包，彻底解决 glibc 版本冲突问题，确保生产环境稳定运行。\n- **高级特性可用**：原生支持 FlexDelegate 和 MediaPipe 自定义算子，允许团队直接部署复杂的转换模型，无需修改网络结构或牺牲精度。\n\nTensorflow-bin 通过提供高度优化且开箱即用的预编译二进制包，彻底消除了边缘设备部署深度学习模型的工程壁垒，让实时 AI 应用落地变得简单高效。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPINTO0309_Tensorflow-bin_237eeea6.png","PINTO0309","Katsuya Hyodo","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FPINTO0309_c3923aa7.png","Hobby programmer.\r\nIntel Software Innovator Program member. ","CyberAgent, Inc.","Nagoya, Japan",null,"PINTO03091","https:\u002F\u002Fgithub.com\u002FPINTO0309",[83],{"name":84,"color":85,"percentage":86},"Shell","#89e051",100,508,112,"2026-02-11T06:01:12","Apache-2.0","Linux","未说明 (该工具为针对 Raspberry Pi 的 CPU 预编译二进制包，支持 Tensorflow Lite，主要依赖 XNNPACK 进行加速，无 GPU\u002FCUDA 需求)","未说明",{"notes":95,"python":96,"dependencies":97},"1. 专用于 Raspberry Pi (3\u002F4\u002F5, Zero) 设备，架构支持 armhf (32 位) 和 aarch64 (64 位)。自 64 位系统发布后，作者已停止构建新的 armhf Wheel 包，建议 32 位用户使用 TensorflowLite-bin。2. 不同 Linux 发行版 (Raspbian, Debian, Ubuntu) 对 glibc 版本有严格要求 (从 2.24 到 2.36 不等)，需严格匹配。3. 在 Debian Bookworm 等新版系统上安装 Python 包时，可能需要添加 --break-system-packages 参数。4. 支持 Flex Delegate (部分版本) 和 XNNPACK (含半精度推理加速)。","2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11 (具体版本取决于操作系统发行版，如 Debian Buster 对应 3.7, Ubuntu 22.04 对应 3.10)",[98,99,100,101,102,103,104,105,106,107],"numpy (特定版本，如 1.26.2)","h5py (特定版本，如 3.6.0 或 3.10.0)","keras_applications==1.0.8","keras_preprocessing (1.1.0 或 1.1.2)","pybind11 (2.9.2)","protobuf==3.20.3","libhdf5-dev","libatlas-base-dev","libopenblas-dev","patchelf",[16,14],[110,111,112,113,114,115,116,117,118,119,120,121,122],"tensorflow","raspberrypi","wheel","pip","tensorflowlite","python","debian","raspbian","aarch64","armhf","armv7l","armv8","tflite","2026-03-27T02:49:30.150509","2026-04-06T19:00:50.613100",[126,131,136,141,146,151],{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},19748,"为什么我的 MobileNet V2 SSD 模型推理速度与预期不符（过快或过慢）？","这通常是因为模型类型不同导致的。如果您使用的是量化模型（int8），其速度会远快于浮点模型（fp32），但会牺牲一定的精度。根据测试，浮点版 (fp32) 的 MobileNet V2 SSD 在树莓派上的推理速度约为 400+ 毫秒\u002F张图像，而量化模型则快得多。请检查您使用的模型是否为量化版本。","https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fissues\u002F7",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},19746,"如何在 Raspberry Pi 上解决导入 TensorFlow 时出现的 'GLIBC_2.29' 或 'GLIBC_2.28' 版本未找到的错误？","升级系统编译器版本非常困难且可能导致系统不稳定，建议按以下顺序尝试解决方案：\n1. 自行在 Ubuntu 18.04 上原生编译 TensorFlow（Pi3 资源较少，耗时约 3 天）。\n2. 安装 Ubuntu 19.10 aarch64 系统（默认包含 Python 3.7），这是最快的方法，约 1 小时完成。参考教程：https:\u002F\u002Fqiita.com\u002FPINTO\u002Fitems\u002Fadc5db7af7a5996c0f72\n3. 如果必须使用 TensorFlow Lite，可以尝试重命名 wheel 文件进行强制安装（例如将 cp35 改为 cp36），但这不保证能正常运行。","https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fissues\u002F17",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},19747,"是否有针对 Raspberry Pi 的纯 TensorFlow Lite (tflite) Python 包以减少安装包体积？","是的，可以使用官方提供的精简版 runtime 包，体积更小且运行更快。对于 aarch64 架构，可以下载并安装此文件：https:\u002F\u002Fdl.google.com\u002Fcoral\u002Fpython\u002Ftflite_runtime-1.14.0-cp37-cp37m-linux_aarch64.whl。注意：多线程加速在此类精简包中可能受限，但官方二进制文件通常比自行构建的版本更快。","https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fissues\u002F15",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},19749,"是否提供 TensorFlow 1.15 版本的预编译包？它在 Edge TPU 部署中很重要。","是的，维护者已提交并发布了对 Raspbian Buster 兼容的 TensorFlow v1.15.0 版本。该版本确认可以成功导入。此外，也提供了 tensorflow-2.0.0 的 armv7l 架构预编译包。用户可以直接下载对应的 .whl 文件进行安装。","https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fissues\u002F16",{"id":147,"question_zh":148,"answer_zh":149,"source_url":150},19750,"是否支持 Raspberry Pi 3 或 Jetson Nano 的 aarch64 (ARM64) 架构 TensorFlow 包？","部分较新版本（如 1.14.1 及以上）同时支持 armv7l 和 aarch64。对于旧版本（如 1.13.1），官方可能不再单独提供 aarch64 支持。社区用户建议在 Rock64 等设备上使用 Armbian Buster aarch64 系统，该系统对 TensorFlow 的支持较好。如果需要特定旧版本，可能需要自行编译或寻找社区非官方构建。","https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fissues\u002F10",{"id":152,"question_zh":153,"answer_zh":154,"source_url":140},19751,"如何在 Raspberry Pi 4 (aarch64, Python 3.9) 上进行 TensorFlow Lite 模型的基准测试？","虽然仓库主要提供预编译包，但进行基准测试通常需要结合 tflite_runtime。确保您安装了适合您 Python 版本和架构的 tflite_runtime wheel 包。由于多进程支持在某些 runtime 中可能无效，建议使用官方 Coral 提供的 tflite_runtime 包以获得最佳性能。具体步骤包括：1. 准备 .tflite 模型文件和 labelmap.txt；2. 安装对应的 whl 包；3. 编写脚本加载模型并记录推理时间。",[156,161,166,171,175],{"id":157,"version":158,"summary_zh":159,"released_at":160},117779,"v2.15.0.post1","- v2.15.0\n- armhf \u002F aarch64 自定义 `tflite_runtime`\n  - https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflowLite-bin\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fcompare\u002Fv2.12.0rc0...v2.15.0.post1","2023-12-17T12:28:09",{"id":162,"version":163,"summary_zh":164,"released_at":165},117780,"v2.12.0rc0","## 变更内容\n* 更新 README.md，替换已弃用的 URL。由 @halilsafakkilic 在 https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fpull\u002F52 中完成。\n\n## 新贡献者\n* @halilsafakkilic 在 https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fpull\u002F52 中完成了首次贡献。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fcompare\u002Fv2.10.0...v2.12.0rc0","2023-02-20T09:04:58",{"id":167,"version":168,"summary_zh":169,"released_at":170},117781,"v2.10.0","## 变更内容\n* 由 @rhenerose 在 https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fpull\u002F51 中提出，直接从 Release Assets 进行安装的变更\n\n## 新贡献者\n* @rhenerose 在 https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fpull\u002F51 中完成了首次贡献\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FPINTO0309\u002FTensorflow-bin\u002Fcompare\u002Fv2.9.0...v2.10.0","2022-09-07T02:53:00",{"id":172,"version":173,"summary_zh":79,"released_at":174},117782,"v2.9.0","2022-05-17T12:15:34",{"id":176,"version":177,"summary_zh":79,"released_at":178},117783,"v2.8.0","2022-02-08T22:50:33"]