Creates resource variables by default. Resource variables are improved versions of TensorFlow variables with a well-defined memory model. Accessing a resource variable reads its value, and all ops which access a specific read value of the variable are guaranteed to see the same value for th
()
| 217 | |
| 218 | @tf_export(v1=["enable_resource_variables"]) |
| 219 | def enable_resource_variables(): |
| 220 | """Creates resource variables by default. |
| 221 | |
| 222 | Resource variables are improved versions of TensorFlow variables with a |
| 223 | well-defined memory model. Accessing a resource variable reads its value, and |
| 224 | all ops which access a specific read value of the variable are guaranteed to |
| 225 | see the same value for that tensor. Writes which happen after a read (by |
| 226 | having a control or data dependency on the read) are guaranteed not to affect |
| 227 | the value of the read tensor, and similarly writes which happen before a read |
| 228 | are guaranteed to affect the value. No guarantees are made about unordered |
| 229 | read/write pairs. |
| 230 | |
| 231 | Calling tf.enable_resource_variables() lets you opt-in to this TensorFlow 2.0 |
| 232 | feature. |
| 233 | """ |
| 234 | global _DEFAULT_USE_RESOURCE |
| 235 | _DEFAULT_USE_RESOURCE = True |
| 236 | _api_usage_gauge.get_cell().set(True) |
| 237 | |
| 238 | |
| 239 | @tf_export(v1=["resource_variables_enabled"]) |