code: def generate_rois_rotated(roi_counts, im_dims):
      rois = generate_rois(roi_counts, im_dims)
      # [batch_id, ctr_x, ctr_y, w, h, angle]
      rotated_rois = np.empty((rois.shape[0], 6)).astype(np.float32)
      rotated_rois[:, 0] = rois[:, 0]  # batch_id
      rotated_rois[:, 1] = (
          rois[:, 1] + rois[:, 3]
      ) / 2.0  # ctr_x = (x1 + x2) / 2
      rotated_rois[:, 2] = (
          rois[:, 2] + rois[:, 4]
      ) / 2.0  # ctr_y = (y1 + y2) / 2
      rotated_rois[:, 3] = (
          rois[:, 3] - rois[:, 1] + 1.0
      )  # w = x2 - x1 + 1
      rotated_rois[:, 4] = (
          rois[:, 4] - rois[:, 2] + 1.0
      )  # h = y2 - y1 + 1
      rotated_rois[:, 5] = np.random.uniform(
          -90.0, 90.0
      )  # angle in degrees
      return rotated_rois
  
imports: import struct
  import unittest
  import caffe2.python.hypothesis_test_util
  import hypothesis.strategies
  import numpy
  import torch
  from caffe2.python import core, workspace
  from hypothesis import given, settings
  from scipy.stats import norm
  from ._utils import assert_allclose
label_desc: Use image node_id 2 for calling a global function with example usage: generate_rois_rotated(roi_counts, im_dims) and returns: rotated_rois