docstr: Tests that op(*args) == expected.
docstr_tok: ["Tests","that","op","(","*","args",")","==","expected","."]
code: def _assertOpOutputMatchesExpected(self, op, args, expected):
      """Tests that op(*args) == expected."""
      with self.session() as session:
          with self.test_scope():
              placeholders = [
                  array_ops.placeholder(
                      dtypes.as_dtype(arg.dtype), arg.shape
                  )
                  for arg in args
              ]
              feeds = {
                  placeholders[i]: args[i] for i in range(0, len(args))
              }
              output = op(*placeholders)
              if isinstance(output, tensor.Tensor):
                  output = [output]
  
          results = session.run(output, feeds)
          for result, v in zip(results, expected):
              self.assertAllClose(v, result, rtol=1e-3)
  
imports: import unittest
  from absl.testing import parameterized
  import numpy
  from tensorflow.compiler.tests import xla_test
  from tensorflow.compiler.tf2xla.python import xla
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import function
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import sort_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the XlaSortOpTest obj's underlying member method code with example usage: obj._assertOpOutputMatchesExpected(op, args, expected) without return types