Wrong notebook output on website

I was reading this doc, and the notebook output from one of the code snippets is wrong (I also ran the doc in collab to verify).

I tried to fix it in the tensorflow/docs code, but the repository doesn’t include the notebook outputs (only the notebook code). So I assume the notebook outputs (printed on the website) are generated on the fly when the tensorflow/docs code is deployed, and hence there could be a possible bug in that workflow (and meaning there could be more such issues across the docs).

The snippet with the wrong output is (it should throw an error but the output doesn’t indicate so):

def unused_return_eager(x):
  # Get index 1 will fail when `len(x) == 1`
  tf.gather(x, [1]) # unused 
  return x

try:
  print(unused_return_eager(tf.constant([0.0])))
except tf.errors.InvalidArgumentError as e:
  # All operations are run during eager execution so an error is raised.
  print(f'{type(e).__name__}: {e}')

I’m happy to investigate further into this, can someone please help me with understanding how the notebook outputs (printed on the website) are generated?

Thanks,

Archil

Thank you for reporting the issue. We have submitted Changelist internally and will update you as soon as this issue is resolved.

This is because of: tf.gather  |  TensorFlow v2.10.0

It doesn’t raise an error for OOB Indices on GPU.