Closed GitEasonXu closed 3 years ago
@yangw1234 Please take a look.
Looks like this is an issue of tensorflow.
According to the error message " ValueError: Input 0 of layer sequential is incompatible with the layer: its rank is undefined, but the layer requires a defined rank.", it seems your model cannot recognize the shape of the output of your py_function
. Does you dataset work without using orca?
I think you can also try adding a tf.reshape op after your tf.py_fucntion.
@yangw1234 You are right. After adding a tf.reshape op , there is no problem.
def train_preprocess_aug(x, y):
x = tf.py_function(image_aug, [x], tf.float32)
x = tf.cast(tf.reshape(x, image_shape), dtype=tf.float32) / 255.0
return x, y
Problem Description:
Code segment
Cannot train mode, if
dataset.map
usingtrain_preprocess_aug
in thetrain_data_creator
, but ifdataset.map
usingtrain_preprocess
that will be ok.Error details, when
dataset.map
usingtrain_preprocess_aug
.The code can be geted here