(obj)
| 649 | """Finds existing Tensors, runs the test, checks for new Tensors.""" |
| 650 | |
| 651 | def _is_tensorflow_object(obj): |
| 652 | try: |
| 653 | return isinstance(obj, |
| 654 | (ops.Tensor, variables.Variable, |
| 655 | tensor_shape.Dimension, tensor_shape.TensorShape)) |
| 656 | except ReferenceError: |
| 657 | # If the object no longer exists, we don't care about it. |
| 658 | return False |
| 659 | |
| 660 | tensors_before = set( |
| 661 | id(obj) for obj in gc.get_objects() if _is_tensorflow_object(obj)) |