tf.py_function does not output ragged tensors #69777
Labels
comp:ops
OPs related issues
stat:awaiting tensorflower
Status - Awaiting response from tensorflower
TF 2.15
For issues related to 2.15.x
type:bug
Bug
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
No
Source
source
TensorFlow version
2.15
Custom code
Yes
OS platform and distribution
Windows
Mobile device
No response
Python version
3.9
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
Hello everyone,
I am having a problem with the function tf.py_function. I want it to output a ragged tensor but I cannot manage to make it happen.
The longer context is that I am training a neural network, YOLO, for object detection. I want to use some data augmentations techniques that do not support bounding boxes. Therefore, I moved to albumentations for data augmentation. The problem is that albuminations works on numpy arrays. I use tf.py_function to output my defined data augmentation but I would need the bounding boxes to be a ragged tensor.
Reference code: https://keras.io/examples/vision/yolov8/
Inside of the map_augmentation function:
I can modify the Tout in order to output a tf.TensorRaggedSpec but I always get errors.
Moreover, I tried to find a solution with this topic #26453 but I did not manage.
I manage to make this run:
but I have the issue when I declare an input for py_func.
Standalone code to reproduce the issue
The text was updated successfully, but these errors were encountered: