I load in a dataset as such:
import tensorflow_datasets as tfds
ds = tfds.load(
'caltech_birds2010',
split='train',
as_supervised=False)
And this function works fine:
import tensorflow as tf
@tf.function
def pad(image,label):
return (tf.image.resize_with_pad(image,32,32),label)
ds = ds.map(pad)
But when when I try mapping a different built-in function
from tf.keras.preprocessing.image import random_rotation
@tf.function
def rotate(image,label):
return (random_rotation(image,90), label)
ds = ds.map(rotate)
I get the following error:
AttributeError: 'Tensor' object has no attribute 'ndim'
This is not the only function giving me issues, and it happens with or without the @tf.function decorator.
Any help is greatly appreciated!