Fix an issue where the `sample` is not in scope, but ends up referencing the last one in the last for loop.
Fix an issue where the `sample` is not in scope, but ends up referencing the last one in the last for loop.

PiperOrigin-RevId: 449512741

google/deepvariant,google/deepvariant,google/deepvariant