TF: Fix generation repetition penalty with XLA
# What does this PR do?

There was a dynamic shape being fetched as a static shape, causing issues from the 2nd generation iteration. 

Fixes #18630 
_The documentation is not available anymore as the PR was closed or merged._