def gen_base_anchors(self):
    w = self.base_size
    h = self.base_size
    if (self.ctr is None):
        x_ctr = (0.5 * (w - 1))
        y_ctr = (0.5 * (h - 1))
    else:
        (x_ctr, y_ctr) = self.ctr
    h_ratios = paddle.sqrt(self.ratios)
    w_ratios = (1 / h_ratios)
    if self.scale_major:
        ws = ((w * w_ratios[:]) * self.scales[:]).reshape([(- 1)])
        hs = ((h * h_ratios[:]) * self.scales[:]).reshape([(- 1)])
    else:
        ws = ((w * self.scales[:]) * w_ratios[:]).reshape([(- 1)])
        hs = ((h * self.scales[:]) * h_ratios[:]).reshape([(- 1)])
    base_anchors = paddle.stack([(x_ctr - (0.5 * (ws - 1))), (y_ctr - (0.5 * (hs - 1))), (x_ctr + (0.5 * (ws - 1))), (y_ctr + (0.5 * (hs - 1)))], axis=(- 1))
    base_anchors = paddle.round(base_anchors)
    return base_anchors
def gen_base_anchors(self):
    w = self.base_size
    h = self.base_size
    if (self.ctr is None):
        x_ctr = (0.5 * (w - 1))
        y_ctr = (0.5 * (h - 1))
    else:
        (x_ctr, y_ctr) = self.ctr
    h_ratios = paddle.sqrt(self.ratios)
    w_ratios = (1 / h_ratios)
    if self.scale_major:
        ws = ((w * w_ratios[:]) * self.scales[:]).reshape([(- 1)])
        hs = ((h * h_ratios[:]) * self.scales[:]).reshape([(- 1)])
    else:
        ws = ((w * self.scales[:]) * w_ratios[:]).reshape([(- 1)])
        hs = ((h * self.scales[:]) * h_ratios[:]).reshape([(- 1)])
    base_anchors = paddle.stack([(x_ctr - (0.5 * (ws - 1))), (y_ctr - (0.5 * (hs - 1))), (x_ctr + (0.5 * (ws - 1))), (y_ctr + (0.5 * (hs - 1)))], axis=(- 1))
    base_anchors = paddle.round(base_anchors)
    return base_anchors