class_docstr: Verifies Python loops for TF-specific limits.
class_docstr_tok: ["Verifies","Python","loops","for","TF-specific","limits","."]
docstr: Checks for possibly-inefficient creation of ops in a Python loop.
code: def _verify_inefficient_unroll(self):
      """Checks for possibly-inefficient creation of ops in a Python loop."""
      assert self.ops_before_iteration is not None
      ops_after_iteration = self._get_ops()
      new_ops = tuple(
          op
          for op in ops_after_iteration
          if op not in self.ops_before_iteration
      )
  
      if len(new_ops) < INEFFICIENT_UNROLL_MIN_OPS:
          return False
  
      ag_logging.warning(
          "Large unrolled loop detected. Did you mean to use a TF loop?"
          " The following ops were created after iteration %s: %s"
          "\nSee"
          " https://github.com/tensorflow/tensorflow/blob/master/"
          "tensorflow/python/autograph/g3doc/reference/common_errors.md"
          "#warning-large-unrolled-loop-detected"
          "\n"
          "Location:"
          "\n%s"
          "",
          self.iterations,
          new_ops,
          "\n".join(traceback.format_stack()),
      )
      return True
  
imports: import functools
  import sys
  import traceback
  import numpy
  from tensorflow.python.autograph.operators import py_builtins
  from tensorflow.python.autograph.operators import variables
  from tensorflow.python.autograph.utils import ag_logging
  from tensorflow.python.autograph.utils import misc
  from tensorflow.python.autograph.utils import tensors
  from tensorflow.python.autograph.utils import type_registry
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_conversion
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import control_flow_assert
  from tensorflow.python.ops import control_flow_util
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import tensor_array_ops
  from tensorflow.python.ops import while_loop
  from tensorflow.python.types import distribute
  from tensorflow.python.util import nest
  from tensorflow.python.util import variable_utils
label_desc: Use image node_id 5 for calling the _PythonLoopChecker obj's underlying member method code with example usage: obj._verify_inefficient_unroll() and returns: True, False