code: def CompareOrthogonal(self, x, y, rank):
      # We only compare the first 'rank' orthogonal vectors since the
      # remainder form an arbitrary orthonormal basis for the
      # (row- or column-) null space, whose exact value depends on
      # implementation details. Notice that since we check that the
      # matrices of singular vectors are unitary elsewhere, we do
      # implicitly test that the trailing vectors of x and y span the
      # same space.
      x = x[..., 0:rank]
      y = y[..., 0:rank]
      # Q is only unique up to sign (complex phase factor for complex matrices),
      # so we normalize the sign first.
      sum_of_ratios = np.sum(np.divide(y, x), -2, keepdims=True)
      phases = np.divide(sum_of_ratios, np.abs(sum_of_ratios))
      x *= phases
      self.assertTrue(np.all(self.AdjustedNorm(x - y) < 30.0))
  
imports: import itertools
  import unittest
  from absl.testing import parameterized
  import numpy
  from tensorflow.compiler.tests import xla_test
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import linalg_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the QrOpTest obj's underlying member method code with example usage: obj.CompareOrthogonal(x, y, rank) without return types