code: def test_pca_reduce_numpy_equivalence(N: int, D: int, Q: int) -> None:
      X = np.random.randn(N, D)
  
      if Q > D:
          with pytest.raises(ValueError):
              gpflow.utilities.ops.pca_reduce(
                  tf.convert_to_tensor(X), Q
              )
  
      else:
          np_result = pca_reduce(X, Q)
          tf_result = gpflow.utilities.ops.pca_reduce(
              tf.convert_to_tensor(X), Q
          ).numpy()
          assert np_result.shape == tf_result.shape == (N, Q)
  
          for i in range(Q):
              # PCA does not necessarily preserve the overall sign, so also accept it to flip
              tf_column = tf_result[:, i]
              np_column = np_result[:, i]
              assert np.allclose(tf_column, np_column) or np.allclose(
                  tf_column, -np_column
              )
  
file_path: GPflow/tests/gpflow/utilities/test_ops.py
imports: from typing import Union, cast
  import numpy
  import pytest
  import tensorflow
  from check_shapes import check_shapes
  import gpflow
  from gpflow.base import AnyNDArray
  from gpflow.utilities.ops import difference_matrix
label_desc: Use image node_id 2 for calling a global function with example usage: test_pca_reduce_numpy_equivalence(N, D, Q) without return types