class_docstr: XLA test cases are parameterized test cases.
class_docstr_tok: ["XLA","test","cases","are","parameterized","test","cases","."]
docstr: Custom implementation of session() for XLA tests.
  
  We override the standard Tensorflow session() since it is too
  specific to CPU and GPU tests. In particular, we want to disable soft
  placement and explicitly assign ops to devices under test.
  
  Yields:
    A session to use when running a test case.
code: def session(self) -> Iterator[session.Session]:
      """Custom implementation of session() for XLA tests.
  
      We override the standard Tensorflow session() since it is too
      specific to CPU and GPU tests. In particular, we want to disable soft
      placement and explicitly assign ops to devices under test.
  
      Yields:
        A session to use when running a test case.
      """
      graph = ops.Graph()
      config = context.context().config
  
      # Grappler can constant fold TensorListFromTensor ops into DT_VARIANT
      # constants which XLA does not understand.  So disable constant folding in
      # these tests.
      config.graph_options.rewrite_options.constant_folding = (
          rewriter_config_pb2.RewriterConfig.OFF
      )
  
      if self.rewrite_ops_for_tpu:
          session_type = TPURewriteSession
      else:
          session_type = session.Session
  
      with session_type(
          graph=graph, config=config
      ) as sess, graph.as_default():
          yield sess
  
imports: from collections.abc import Iterator
  import contextlib
  import os
  import random
  import re
  import numpy
  from tensorflow.core.framework import types_pb2
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.compiler.xla import jit
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import random_seed
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import flags
  from tensorflow.python.platform import test
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 11 for calling the XLATestCase obj's underlying member method code with example usage: obj.session() without return types