code: def _check_valid_rotation_matrix(R, tol: float = 1e-7) -> None:
      """
      Determine if R is a valid rotation matrix by checking it satisfies the
      following conditions:
  
      ``RR^T = I and det(R) = 1``
  
      Args:
          R: an (N, 3, 3) matrix
  
      Returns:
          None
  
      Emits a warning if R is an invalid rotation matrix.
      """
      N = R.shape[0]
      eye = torch.eye(3, dtype=R.dtype, device=R.device)
      eye = eye.view(1, 3, 3).expand(N, -1, -1)
      orthogonal = torch.allclose(
          R.bmm(R.transpose(1, 2)), eye, atol=tol
      )
      det_R = _safe_det_3x3(R)
      no_distortion = torch.allclose(det_R, torch.ones_like(det_R))
      if not (orthogonal and no_distortion):
          msg = "R is not a valid rotation matrix"
          warnings.warn(msg)
      return
  
imports: import math
  import os
  import warnings
  from typing import List, Optional, Union
  import torch
  from ..common.datatypes import Device, get_device, make_device
  from ..common.workaround import _safe_det_3x3
  from .rotation_conversions import _axis_angle_rotation
  from .se3 import se3_log_map
label_desc: Use image node_id 5 for calling a global function with example usage: _check_valid_rotation_matrix(R, tol) without return types