Skip to content

Commit 944af22

Browse files
authored
Downgrade tf to 2.3 (#152)
And e2e test showed that the TF + GPU integration wasn't working properly, but these unit tests didn't catch it. So I also added a test checking for GPU device. http://b/177304566
1 parent ab3c454 commit 944af22

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ RUN apt-get install -y libzmq3-dev python-pip default-jdk && \
6161
# Keras sets up a virtualenv and installs tensorflow
6262
# in the WORKON_HOME directory, so choose an explicit location for it.
6363
ENV WORKON_HOME=/usr/local/share/.virtualenvs
64-
RUN pip install --user virtualenv && R -e 'keras::install_keras(tensorflow = "2.4", extra_packages = c("pandas", "numpy", "pycryptodome"))'
64+
RUN pip install --user virtualenv && R -e 'keras::install_keras(tensorflow = "2.3", extra_packages = c("pandas", "numpy", "pycryptodome"))'
6565

6666
# Install kaggle libraries.
6767
# Do this at the end to avoid rebuilding everything when any change is made.

gpu.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ENV CUDA_HOME=/usr/local/cuda
5959
ADD ldpaths $R_HOME/etc/ldpaths
6060

6161
# Install tensorflow with GPU support
62-
RUN R -e 'keras::install_keras(tensorflow = "2.4-gpu")' && \
62+
RUN R -e 'keras::install_keras(tensorflow = "2.3-gpu")' && \
6363
rm -rf /tmp/tensorflow_gpu && \
6464
/tmp/clean-layer.sh
6565

tests/test_tensorflow.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
context("tensorflow")
22

3-
test_that("gpu imports", {
3+
test_that("check gpu device", {
4+
check_gpu()
5+
6+
library(tensorflow)
7+
gpus = tf$config$experimental$list_physical_devices('GPU')
8+
expect_equal(length(gpus), 1)
9+
})
10+
11+
test_that("tensorflow with gpu", {
412
check_gpu()
513

614
library(tensorflow)
715
with(tf$device("/gpu:0"), {
816
const <- tf$constant(42)
917
expect_equal(42, as.integer(const))
1018
})
11-
12-
expect_true(TRUE)
1319
})

0 commit comments

Comments
 (0)