docstr: Tests rotation around Z axis.
docstr_tok: ["Tests","rotation","around","Z","axis","."]
code: def test_from_rotation_matrix_random(self):
      """Tests rotation around Z axis."""
  
      def get_rotation_matrix_around_z(angle_rad):
          return np.array(
              [
                  [np.cos(angle_rad), -np.sin(angle_rad), 0],
                  [np.sin(angle_rad), np.cos(angle_rad), 0],
                  [0, 0, 1],
              ]
          )
  
      tensor_size = np.random.randint(10)
      angle = np.array(
          [
              np.deg2rad(np.random.randint(720) - 360)
              for _ in range(tensor_size)
          ]
      ).reshape((tensor_size, 1))
      rotation_matrix = [
          get_rotation_matrix_around_z(i[0]) for i in angle
      ]
      rotation_matrix = np.array(rotation_matrix).reshape(
          (tensor_size, 3, 3)
      )
      tf_axis, tf_angle = axis_angle.from_rotation_matrix(
          rotation_matrix
      )
      axis = np.tile([[0.0, 0.0, 1.0]], (angle.shape[0], 1))
      tf_quat_gt = quaternion.from_axis_angle(axis, angle)
      tf_quat = quaternion.from_axis_angle(tf_axis, tf_angle)
      # Compare quaternions since axis orientation and angle ambiguity will
      # lead to more complex comparisons.
      for quat_gt, quat in zip(
          self.evaluate(tf_quat_gt), self.evaluate(tf_quat)
      ):
          # Remember that q=-q for any quaternion.
          pos = np.allclose(quat_gt, quat)
          neg = np.allclose(quat_gt, -quat)
  
          self.assertTrue(pos or neg)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import flagsaver
  from absl.testing import parameterized
  import numpy
  from six.moves import range
  from six.moves import zip
  import tensorflow
  from tensorflow_graphics.geometry.transformation import axis_angle
  from tensorflow_graphics.geometry.transformation import quaternion
  from tensorflow_graphics.geometry.transformation import rotation_matrix_3d
  from tensorflow_graphics.geometry.transformation.tests import test_helpers
  from tensorflow_graphics.util import test_case
label_desc: Use image node_id 22 for calling the AxisAngleTest obj's underlying member method code with example usage: obj.test_from_rotation_matrix_random() and returns: np