class_docstr: Tests for auto-compilation on CPU/GPU devices.
docstr: Tests an operator with compile-time constant and non-constant inputs.
docstr_tok: ["Tests","an","operator","with","compile-time","constant","and","non-constant","inputs","."]
code: def testReshape(self):
      """Tests an operator with compile-time constant and non-constant inputs."""
  
      with self.session(config=NoRewriteSessionConfig()) as sess:
          x = array_ops.placeholder(dtypes.float32)
          y = array_ops.placeholder(dtypes.int32)
          with jit_scope():
              # Reshape's first argument is non-constant in the JIT, but its second
              # (shape) argument will be treated as a compile-time constant for
              # each JIT compilation.
              # We do not use a tf.const() argument since we want to ensure the
              # shape is still a run-time argument to the JIT, and not
              # statically known as part of the JIT compilation's input graph.
              z = array_ops.reshape(x, y)
          run_metadata = config_pb2.RunMetadata()
          out = test_utils.RunWithWarmup(
              sess,
              z,
              {x: np.array([1, 2, 3, 4, 5, 6], np.float32), y: [-1, 3]},
              run_metadata=run_metadata,
              options=config_pb2.RunOptions(
                  trace_level=config_pb2.RunOptions.FULL_TRACE
              ),
          )
          self.assertTrue(MetadataHasXlaRunOp(run_metadata))
          self.assertAllClose(
              np.array([[1, 2, 3], [4, 5, 6]], np.float32), out
          )
  
imports: import os
  import numpy
  from tensorflow.compiler.tests import test_utils
  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.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import function
  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_ops
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the XlaCompilationTest obj's underlying member method code with example usage: obj.testReshape() without return types