In [0]:
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
This Colab provides a convenient way to build the C++ example named lstpu: github.com/google-coral/tflite/tree/master/cpp/examples/lstpu.
Simply run this notebook and it produces the downloadable binary for your target system (default target is aarch64, which is compatible with the Coral Dev Board).
To start the build, select Runtime > Run all in the Colab toolbar.
In [0]:
! sudo apt install curl
! curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
! echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
In [0]:
! sudo apt update && sudo apt install bazel
In [0]:
! git clone https://github.com/google-coral/tflite.git
In [0]:
! sudo apt-get install -y crossbuild-essential-armhf crossbuild-essential-arm64 bazel
In [0]:
%cd tflite/cpp/examples/lstpu
The following line builds for an ARM64 system (aarch64). Alternative CPU architectures are k8 and armv7a.
In [0]:
! make CPU=aarch64
In [0]:
from google.colab import files
files.download('bazel-out/aarch64-opt/bin/lstpu')
The download might fail if you used Run all. If so, just retry by clicking Run cell in this last code cell.
Note: You probably need to modify the file permissions in order to run it.