docstr: Test that results match with RoIAlign when angle=0.
docstr_tok: ["Test","that","results","match","with","RoIAlign","when","angle=0","."]
code: def test_horizontal_rois(
      self, H, W, C, num_rois, pooled_size, gc, dc
  ):
      """
      Test that results match with RoIAlign when angle=0.
      """
      X = np.random.randn(1, C, H, W).astype(np.float32)
      R = np.zeros((num_rois, 6)).astype(np.float32)
      angle = 0.0
      for i in range(num_rois):
          x = np.random.uniform(1, W - 1)
          y = np.random.uniform(1, H - 1)
          w = np.random.uniform(1, min(x, W - x))
          h = np.random.uniform(1, min(y, H - y))
          R[i] = [0, x, y, w, h, angle]
  
      op = core.CreateOperator(
          "RoIAlignRotated",
          ["X", "R"],
          ["Y"],
          pooled_h=pooled_size,
          pooled_w=pooled_size,
          sampling_ratio=0,
      )
  
      def roialign_ref(X, R):
          # Remove angle and convert from [center_x center_y w h]
          # to [x1 y1 x2 y2] format.
          R_ref = copy.deepcopy(R[:, 0:5])
          R_ref[:, 1:5] = self.bbox_xywh_to_xyxy(R_ref[:, 1:5])
  
          ref_op = core.CreateOperator(
              "RoIAlign",
              ["X_ref", "R_ref"],
              ["Y_ref"],
              pooled_h=pooled_size,
              pooled_w=pooled_size,
              sampling_ratio=0,
          )
          workspace.FeedBlob("X_ref", X)
          workspace.FeedBlob("R_ref", R_ref)
          workspace.RunOperatorOnce(ref_op)
          return [workspace.FetchBlob("Y_ref")]
  
      self.assertReferenceChecks(
          device_option=gc, op=op, inputs=[X, R], reference=roialign_ref
      )
      if core.IsGPUDeviceType(gc.device_type):
          self.assertGradientChecks(gc, op, [X, R], 0, [0])
  
file_path: pytorch/caffe2/python/operator_test/roi_align_rotated_op_test.py
imports: from caffe2.python import core, workspace
  from hypothesis import given
  import caffe2.python.hypothesis_test_util
  import hypothesis.strategies
  import numpy
  import copy
label_desc: Use image node_id 2 for calling the RoIAlignRotatedOp obj's underlying member method code with example usage: obj.test_horizontal_rois(H, W, C, num_rois, pooled_size, gc, dc) and returns: list