Run the Tensorflow examples as part of Tensorflow image build process.

This is a bit silly but it is quite light on CPU and runs pretty fast.

This ensures that all the prerequisite models are predownloaded into the
image.

Without this, the image fails when running with networking disabled.

PiperOrigin-RevId: 660004352
This commit is contained in:
Etienne Perot
2024-08-06 10:23:24 -07:00
committed by gVisor bot
parent 7bcc2b0167
commit 940395c545
@@ -5,3 +5,18 @@ RUN apt-get update \
RUN git clone --depth 1 https://github.com/aymericdamien/TensorFlow-Examples.git
RUN python -m pip install -U pip setuptools
RUN python -m pip install matplotlib
# Run the Tensorflow examples; they use the CPU only, but what we want here
# is the side-effect of pre-downloading the models they will use.
RUN export PYTHONPATH=$PYTHONPATH:/TensorFlow-Examples/examples; \
cd /TensorFlow-Examples/examples; \
examples=' \
2_BasicModels/kmeans.py \
2_BasicModels/logistic_regression.py \
2_BasicModels/nearest_neighbor.py \
2_BasicModels/random_forest.py \
3_NeuralNetworks/convolutional_network.py \
3_NeuralNetworks/multilayer_perceptron.py \
3_NeuralNetworks/neural_network.py \
'; \
for f in $examples; do python "$f"; done