class_docstr: Checks the runtime performance of outputting all intermediates.
class_docstr_tok: ["Checks","the","runtime","performance","of","outputting","all","intermediates","."]
code: def _create_cond(self, x):
      def branch_fn():
          # Use a random value so the adds can't be constant folded.
          return x + sum(
              random_ops.random_normal([])
              for _ in range(self.NUM_INTERMEDIATES)
          )
  
      # Use a dynamic predicate to make sure the cond isn't constant folded.
      return cond.cond(
          math_ops.not_equal(x, -1), branch_fn, lambda: 0.0
      )
  
imports: import time
  from tensorflow.python.client import session
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import control_flow_util
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the CondWithManyIntermediatesBenchmark obj's underlying member method code with example usage: obj._create_cond(x) and returns: cond, unknown