class_docstr: AnchorGenerator by paddle
class_docstr_tok: ["AnchorGenerator","by","paddle"]
code: 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
  
imports: import math
  import paddle
  import paddle.nn
  import numpy
  from ppdet.core.workspace import register
label_desc: Use image node_id 6 for calling the S2ANetAnchorGenerator obj's underlying member method code with example usage: obj.valid_flags(featmap_size, valid_size) and returns: valid