Adds a forward-compatibility window to guard disable_copy_on_read uses.
PiperOrigin-RevId: 441012032
diff --git a/tensorflow/python/ops/resource_variable_ops.py b/tensorflow/python/ops/resource_variable_ops.py
index 99a53a1..5893260 100644
--- a/tensorflow/python/ops/resource_variable_ops.py
+++ b/tensorflow/python/ops/resource_variable_ops.py
@@ -688,7 +688,7 @@
variable_accessed(self)
def read_and_set_handle(no_copy):
- if no_copy:
+ if no_copy and forward_compat.forward_compatible(2022, 5, 3):
gen_resource_variable_ops.disable_copy_on_read(self.handle)
result = gen_resource_variable_ops.read_variable_op(
self.handle, self._dtype)