def METHOD_NAME(self, anchors, anchor_masks):
    self.anchors = [[anchors[i] for i in mask] for mask in anchor_masks]
    self.mask_anchors = []
    anchor_num = len(anchors)
    for masks in anchor_masks:
        self.mask_anchors.append([])
        for mask in masks:
            assert mask < anchor_num, "anchor mask index overflow"
            self.mask_anchors[-1].extend(anchors[mask])