Commit 3e85e82f authored by Yong Tang's avatar Yong Tang
Browse files

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: default avatarYong Tang <yong.tang.github@outlook.com>
parent f69eca8c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment