code: def align_weak_strong_shape(data_weak, data_strong):
      max_shape_x = max(
          data_strong["image"].shape[2], data_weak["image"].shape[2]
      )
      max_shape_y = max(
          data_strong["image"].shape[3], data_weak["image"].shape[3]
      )
  
      scale_x_s = max_shape_x / data_strong["image"].shape[2]
      scale_y_s = max_shape_y / data_strong["image"].shape[3]
      scale_x_w = max_shape_x / data_weak["image"].shape[2]
      scale_y_w = max_shape_y / data_weak["image"].shape[3]
      target_size = [max_shape_x, max_shape_y]
  
      if scale_x_s != 1 or scale_y_s != 1:
          data_strong["image"] = F.interpolate(
              data_strong["image"],
              size=target_size,
              mode="bilinear",
              align_corners=False,
          )
          if "gt_bbox" in data_strong:
              gt_bboxes = data_strong["gt_bbox"].numpy()
              for i in range(len(gt_bboxes)):
                  if len(gt_bboxes[i]) > 0:
                      gt_bboxes[i][:, 0::2] = (
                          gt_bboxes[i][:, 0::2] * scale_x_s
                      )
                      gt_bboxes[i][:, 1::2] = (
                          gt_bboxes[i][:, 1::2] * scale_y_s
                      )
              data_strong["gt_bbox"] = paddle.to_tensor(gt_bboxes)
  
      if scale_x_w != 1 or scale_y_w != 1:
          data_weak["image"] = F.interpolate(
              data_weak["image"],
              size=target_size,
              mode="bilinear",
              align_corners=False,
          )
          if "gt_bbox" in data_weak:
              gt_bboxes = data_weak["gt_bbox"].numpy()
              for i in range(len(gt_bboxes)):
                  if len(gt_bboxes[i]) > 0:
                      gt_bboxes[i][:, 0::2] = (
                          gt_bboxes[i][:, 0::2] * scale_x_w
                      )
                      gt_bboxes[i][:, 1::2] = (
                          gt_bboxes[i][:, 1::2] * scale_y_w
                      )
              data_weak["gt_bbox"] = paddle.to_tensor(gt_bboxes)
      return data_weak, data_strong
  
imports: import paddle
  import paddle.nn.functional
label_desc: Use image node_id 1 for calling a global function with example usage: align_weak_strong_shape(data_weak, data_strong) and returns: data_weak,  data_strong