    def box_transform(self, bbox_deltas, anchors):
        """apply transformation for proposals"""
        (delta_x, delta_y, delta_w, delta_h) = ops.split()(bbox_deltas, 1, dim=1)
        const_0_5 = Tensor(shape=[], dtype=self.dtype, name="const_0_5", value=0.5)

        (anchor_x1, anchor_y1, anchor_x2, anchor_y2) = ops.split()(anchors, 1, dim=1)
        widths = ops.elementwise(FuncEnum.SUB)(anchor_x2, anchor_x1)
        heights = ops.elementwise(FuncEnum.SUB)(anchor_y2, anchor_y1)

        width_mid = ops.elementwise(FuncEnum.MUL)(widths, const_0_5)
        height_mid = ops.elementwise(FuncEnum.MUL)(heights, const_0_5)
        ctr_x = ops.elementwise(FuncEnum.ADD)(anchor_x1, width_mid)
        ctr_y = ops.elementwise(FuncEnum.ADD)(anchor_y1, height_mid)

        pred_ctr_x = ops.elementwise(FuncEnum.ADD)(
            ops.elementwise(FuncEnum.MUL)(delta_x, widths),
            ctr_x,
        )
        pred_ctr_y = ops.elementwise(FuncEnum.ADD)(
            ops.elementwise(FuncEnum.MUL)(delta_y, heights),
            ctr_y,
        )
        pred_w = ops.elementwise(FuncEnum.MUL)(
            ops.elementwise(FuncEnum.EXP)(delta_w),
            widths,
        )
        pred_h = ops.elementwise(FuncEnum.MUL)(
            ops.elementwise(FuncEnum.EXP)(delta_h),
            heights,
        )

        p_x1 = ops.elementwise(FuncEnum.SUB)(
            pred_ctr_x,
            ops.elementwise(FuncEnum.MUL)(const_0_5, pred_w),
        )
        p_y1 = ops.elementwise(FuncEnum.SUB)(
            pred_ctr_y,
            ops.elementwise(FuncEnum.MUL)(const_0_5, pred_h),
        )
        p_x2 = ops.elementwise(FuncEnum.ADD)(
            pred_ctr_x,
            ops.elementwise(FuncEnum.MUL)(const_0_5, pred_w),
        )
        p_y2 = ops.elementwise(FuncEnum.ADD)(
            pred_ctr_y,
            ops.elementwise(FuncEnum.MUL)(const_0_5, pred_h),
        )

        if self.clip_box:
            x_min = Tensor(
                shape=[],
                dtype=self.dtype,
                name="X_min",
                value=0,
            )
            x_max_h = Tensor(
                shape=[],
                dtype=self.dtype,
                name="X_min_h",
                value=self.im_h,
            )
            x_max_w = Tensor(
                shape=[],
                dtype=self.dtype,
                name="X_min_w",
                value=self.im_w,
            )

            f_x1 = ops.elementwise(FuncEnum.HARDTANH)(p_x1, x_min, x_max_w)
            f_y1 = ops.elementwise(FuncEnum.HARDTANH)(p_y1, x_min, x_max_h)
            f_x2 = ops.elementwise(FuncEnum.HARDTANH)(p_x2, x_min, x_max_w)
            f_y2 = ops.elementwise(FuncEnum.HARDTANH)(p_y2, x_min, x_max_h)
            proposals = ops.concatenate()([f_x1, f_y1, f_x2, f_y2], dim=1)
        else:
            proposals = ops.concatenate()([p_x1, p_y1, p_x2, p_y2], dim=1)

        return proposals
apply transformation for proposals
python/aitemplate/frontend/nn/proposal.py