diff --git a/Dockerfile b/Dockerfile index a04401f7..69c28dba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -65,6 +65,11 @@ RUN pip install /tmp/tensorflow_gcs_config/tensorflow*.whl && \ rm -rf /tmp/tensorflow_gcs_config && \ /tmp/clean-layer.sh +# Install TensorFlow addons (TFA). +# TFA functionnality relying on Custom Op won't work. See: https://github.com/tensorflow/addons/issues/987. +RUN pip install tensorflow-addons==0.10.0 && \ + /tmp/clean-layer.sh + RUN apt-get install -y libfreetype6-dev && \ apt-get install -y libglib2.0-0 libxext6 libsm6 libxrender1 libfontconfig1 --fix-missing && \ pip install gensim && \ diff --git a/tests/test_tensorflow_addons.py b/tests/test_tensorflow_addons.py new file mode 100644 index 00000000..51a09489 --- /dev/null +++ b/tests/test_tensorflow_addons.py @@ -0,0 +1,14 @@ +import unittest + +import tensorflow as tf +import tensorflow_addons as tfa + + +class TestTensorflowAddons(unittest.TestCase): + def test_tfa_image(self): + img_raw = tf.io.read_file('/input/tests/data/dot.png') + img = tf.io.decode_image(img_raw) + img = tf.image.convert_image_dtype(img, tf.float32) + mean = tfa.image.mean_filter2d(img, filter_shape=1) + + self.assertEqual(1, len(mean)) \ No newline at end of file