A list of variables accessed by this FuncGraph. Note that functions keep only weak references to variables. Calling the function after a variable it accesses has been deleted is an error. Yields: Strong references to variables accessed by this FuncGraph.
(self)
| 420 | |
| 421 | @property |
| 422 | def variables(self): |
| 423 | """A list of variables accessed by this FuncGraph. |
| 424 | |
| 425 | Note that functions keep only weak references to variables. Calling the |
| 426 | function after a variable it accesses has been deleted is an error. |
| 427 | |
| 428 | Yields: |
| 429 | Strong references to variables accessed by this FuncGraph. |
| 430 | """ |
| 431 | for weak_v in self._weak_variables: |
| 432 | v = weak_v() |
| 433 | if v is None: |
| 434 | raise AssertionError( |
| 435 | "Called a function referencing variables which have been deleted. " |
| 436 | "This likely means that function-local variables were created and " |
| 437 | "not referenced elsewhere in the program. This is generally a " |
| 438 | "mistake; consider storing variables in an object attribute on " |
| 439 | "first call.") |
| 440 | yield v |
| 441 | |
| 442 | @variables.setter |
| 443 | def variables(self, var_list): |