Fix incorrectly returned error type during RaggedTensor iteration
This fix tries to address the issue raised in 24679 where
RaggedTensor iteration does not stop correctly (eager mode):
```
import tensorflow as tf
r = tf.ragged.constant([[1., 2.], [3., 4., 5.], [6.]])
for elem in r:
print(elem)
```
The reason was that `__getitem__()` should have thrown IndexError
(translated to StopIteration in next/__next__())
in order for python to correctly process iteration.
This fix fixes the issue.
This fix fixes 24679.
Signed-off-by:
Yong Tang <yong.tang.github@outlook.com>
Loading
Please sign in to comment