Skip to content

Commit

Permalink
Merge pull request #104 from isZumpo/optimize_tensorflow_cloning
Browse files Browse the repository at this point in the history
Optimize fetching of tensorflow header files
  • Loading branch information
tphakala authored Apr 6, 2024
2 parents 166d766 + 2e10fa7 commit 75880c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ RUN PLATFORM='unknown'; \
WORKDIR /root/src

# Download TensorFlow headers
RUN git clone --branch ${TENSORFLOW_VERSION} --depth 1 https://github.com/tensorflow/tensorflow.git
RUN git clone --branch ${TENSORFLOW_VERSION} --filter=blob:none --depth 1 --no-checkout https://github.com/tensorflow/tensorflow.git \
&& git -C tensorflow config core.sparseCheckout true \
&& echo "**/*.h" >> tensorflow/.git/info/sparse-checkout \
&& git -C tensorflow checkout

FROM buildenv as build

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ check-tensorflow:
@if [ ! -f "$(HOME)/src/tensorflow/tensorflow/lite/c/c_api.h" ]; then \
echo "TensorFlow Lite C API header not found. Cloning TensorFlow source..."; \
mkdir -p $(HOME)/src; \
git clone --branch v2.14.0 --depth 1 https://github.com/tensorflow/tensorflow.git $(HOME)/src/tensorflow; \
git clone --branch v2.14.0 --filter=blob:none --depth 1 --no-checkout https://github.com/tensorflow/tensorflow.git $(HOME)/src/tensorflow; \
git -C $(HOME)/src/tensorflow config core.sparseCheckout true; \
echo "**/*.h" >> $(HOME)/src/tensorflow/.git/info/sparse-checkout; \
git -C $(HOME)/src/tensorflow checkout; \
else \
echo "TensorFlow Lite C API header exists."; \
fi
Expand Down

0 comments on commit 75880c3

Please sign in to comment.