addons
addons copied to clipboard
tfa.rotate() doesn't work in tf.data.Dataset.map()
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
- TensorFlow version and how it was installed (source or binary): 2.3 binary
- TensorFlow-Addons version and how it was installed (source or binary): 0.13.0 binary
- Python version: 3.8.1
- Is GPU used? (yes/no): yes
Describe the bug
tfa.image.rotate()
doesn't work in tf.data.Dataset.map()
Code to reproduce the issue
import tensorflow as tf
import tensorflow_addons as tfa
import tensorflow_datasets as tfds
mnist = tfds.load('mnist', split='test', as_supervised=True)
ds = mnist.map(lambda x, y: (tfa.image.rotate(x, 10), y))
NotImplementedError: Cannot convert a symbolic Tensor (rotate/angles_to_projective_transforms/strided_slice_1:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported
Can you try with this: https://github.com/tensorflow/models/blob/master/official/vision/beta/ops/augment.py#L190:L218
/cc @yarri-oss @theadactyl At some point we could handle these duplicates in the ecosystem.
+1 for putting a process together to catch such duplication issues. I know Sean wanted to discuss this. I wonder if we could create a pre-submit test for this somehow?
On Fri, Jul 23, 2021 at 4:24 PM bhack @.***> wrote:
/cc @yarri-oss https://github.com/yarri-oss @theadactyl https://github.com/theadactyl At some point we could handle these duplicates in the ecosystem.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/addons/issues/2529#issuecomment-885959402, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATUWYYZCJ2O7SXNSJKCMHPTTZH2Z3ANCNFSM5A2ZJKYA .
!pip install -U tf-models-official
import tensorflow as tf
from official.vision.beta.ops import augment as tfm
import tensorflow_datasets as tfds
mnist = tfds.load('mnist', split='test', as_supervised=True)
ds = mnist.map(lambda x, y: (tfm.rotate(x, 10), y))
I found this while searching how to use tfa.image.rotate
. I tried this using tensorflow==2.6.0
and tensorflow-addons==0.14.0
but I cannot reproduce this issue.
colab link: https://colab.research.google.com/drive/1MsywxouFx2Ikfh0nO-svjgeYgePdBarB?usp=sharing
TensorFlow Addons is transitioning to a minimal maintenance and release mode. New features will not be added to this repository. For more information, please see our public messaging on this decision: TensorFlow Addons Wind Down
Please consider sending feature requests / contributions to other repositories in the TF community with a similar charters to TFA: Keras Keras-CV Keras-NLP