def valid_flags(self, featmap_size, valid_size):
    (feat_h, feat_w) = featmap_size
    (valid_h, valid_w) = valid_size
    assert ((valid_h <= feat_h) and (valid_w <= feat_w))
    valid_x = paddle.zeros([feat_w], dtype='int32')
    valid_y = paddle.zeros([feat_h], dtype='int32')
    valid_x[:valid_w] = 1
    valid_y[:valid_h] = 1
    (valid_xx, valid_yy) = self._meshgrid(valid_x, valid_y)
    valid = (valid_xx & valid_yy)
    valid = paddle.reshape(valid, [(- 1), 1])
    valid = paddle.expand(valid, [(- 1), self.num_base_anchors]).reshape([(- 1)])
    return valid
def valid_flags(self, featmap_size, valid_size):
    (feat_h, feat_w) = featmap_size
    (valid_h, valid_w) = valid_size
    assert ((valid_h <= feat_h) and (valid_w <= feat_w))
    valid_x = paddle.zeros([feat_w], dtype='int32')
    valid_y = paddle.zeros([feat_h], dtype='int32')
    valid_x[:valid_w] = 1
    valid_y[:valid_h] = 1
    (valid_xx, valid_yy) = self._meshgrid(valid_x, valid_y)
    valid = (valid_xx & valid_yy)
    valid = paddle.reshape(valid, [(- 1), 1])
    valid = paddle.expand(valid, [(- 1), self.num_base_anchors]).reshape([(- 1)])
    return valid