class_docstr: Encode bounding boxes training target with normalized center offsets.
  
  Input bounding boxes are using corner type: `x_{min}, y_{min}, x_{max}, y_{max}`.
  
  Parameters
  ----------
  max_pos : int, default is 128
      Upper bound of Number of positive samples.
  per_device_batch_size : int, default is 1
      Per device batch size
  stds : array-like of size 4
      Std value to be divided from encoded values, default is (0.1, 0.1, 0.2, 0.2).
  means : array-like of size 4
      Mean value to be subtracted from encoded values, default is (0., 0., 0., 0.).
class_docstr_tok: ["Encode","bounding","boxes","training","target","with","normalized","center","offsets",".","Input","bounding","boxes","are","using","corner","type",":","`","x_","{","min","}",",","y_","{","min","}",",","x_","{","max","}",",","y_","{","max","}","`",".","Parameters","--","--","--","--","--","max_pos",":","int",",","default","is","128","Upper","bound","of","Number","of","positive","samples",".","per_device_batch_size",":","int",",","default","is","1","Per","device","batch","size","stds",":","array-like","of","size","4","Std","value","to","be","divided","from","encoded","values",",","default","is","(","0.1",",","0.1",",","0.2",",","0.2",")",".","means",":","array-like","of","size","4","Mean","value","to","be","subtracted","from","encoded","values",",","default","is","(","0.",",","0.",",","0.",",","0",".",")","."]
docstr: Encode BBox One entry per category
  
  Parameters
  ----------
  samples: (B, N) value +1 (positive), -1 (negative), 0 (ignore)
  matches: (B, N) value range [0, M)
  anchors: (B, N, 4) encoded in corner
  labels: (B, N) value range [0, self._num_class), excluding background
  refs: (B, M, 4) encoded in corner
  
  Returns
  -------
  targets: (B, N_pos, C, 4) transform anchors to refs picked according to matches
  masks: (B, N_pos, C, 4) only positive anchors of the correct class has targets
  indices : (B, N_pos) positive sample indices
docstr_tok: ["Encode","BBox","One","entry","per","category","Parameters","--","--","--","--","--","samples",":","(","B",",","N",")","value","+1","(","positive",")",",","-1","(","negative",")",",","0","(","ignore",")","matches",":","(","B",",","N",")","value","range","[","0",",","M",")","anchors",":","(","B",",","N",",","4",")","encoded","in","corner","labels",":","(","B",",","N",")","value","range","[","0",",","self._num_class",")",",","excluding","background","refs",":","(","B",",","M",",","4",")","encoded","in","corner","Returns","--","--","--","-","targets",":","(","B",",","N_pos",",","C",",","4",")","transform","anchors","to","refs","picked","according","to","matches","masks",":","(","B",",","N_pos",",","C",",","4",")","only","positive","anchors","of","the","correct","class","has","targets","indices",":","(","B",",","N_pos",")","positive","sample","indices"]
code: def hybrid_forward(
      self,
      F,
      samples,
      matches,
      anchors,
      labels,
      refs,
      means=None,
      stds=None,
  ):
      """Encode BBox One entry per category
  
      Parameters
      ----------
      samples: (B, N) value +1 (positive), -1 (negative), 0 (ignore)
      matches: (B, N) value range [0, M)
      anchors: (B, N, 4) encoded in corner
      labels: (B, N) value range [0, self._num_class), excluding background
      refs: (B, M, 4) encoded in corner
  
      Returns
      -------
      targets: (B, N_pos, C, 4) transform anchors to refs picked according to matches
      masks: (B, N_pos, C, 4) only positive anchors of the correct class has targets
      indices : (B, N_pos) positive sample indices
  
      """
      # refs [B, M, 4], anchors [B, N, 4], samples [B, N], matches [B, N]
      # encoded targets [B, N, 4], masks [B, N, 4]
      if "box_encode" in F.contrib.__dict__:
          targets, masks = F.contrib.box_encode(
              samples, matches, anchors, refs, means, stds
          )
      else:
          targets, masks = self.class_agnostic_encoder(
              samples, matches, anchors, refs
          )
  
      # labels [B, M] -> [B, N, M]
      ref_labels = F.broadcast_like(
          labels.reshape((0, 1, -1)), matches, lhs_axes=1, rhs_axes=1
      )
      # labels [B, N, M] -> pick from matches [B, N] -> [B, N, 1]
      ref_labels = (
          F.pick(ref_labels, matches, axis=2)
          .reshape((0, -1))
          .expand_dims(2)
      )
      # boolean array [B, N, C]
      same_cids = F.broadcast_equal(
          ref_labels,
          F.reshape(F.arange(self._num_class), shape=(1, 1, -1)),
      )
  
      # reduce box targets to positive samples only
      indices = F.slice_axis(
          F.reshape(
              F.argsort(
                  F.slice_axis(masks, axis=-1, begin=0, end=1),
                  axis=1,
                  is_ascend=False,
              ),
              (self._batch_size, -1),
          ),
          axis=1,
          begin=0,
          end=self._max_pos,
      )
      targets_tmp = []
      masks_tmp = []
      same_cids_tmp = []
      for i in range(self._batch_size):
          ind = F.slice_axis(
              indices, axis=0, begin=i, end=i + 1
          ).squeeze(axis=0)
          target = F.slice_axis(
              targets, axis=0, begin=i, end=i + 1
          ).squeeze(axis=0)
          mask = F.slice_axis(
              masks, axis=0, begin=i, end=i + 1
          ).squeeze(axis=0)
          same_cid = F.slice_axis(
              same_cids, axis=0, begin=i, end=i + 1
          ).squeeze(axis=0)
          targets_tmp.append(F.take(target, ind).expand_dims(axis=0))
          masks_tmp.append(F.take(mask, ind).expand_dims(axis=0))
          same_cids_tmp.append(
              F.take(same_cid, ind).expand_dims(axis=0)
          )
      targets = F.concat(*targets_tmp, dim=0)
      masks = F.concat(*masks_tmp, dim=0)
      same_cids = F.concat(*same_cids_tmp, dim=0).expand_dims(3)
  
      # targets, masks [B, N_pos, C, 4]
      all_targets = F.broadcast_axes(
          targets.expand_dims(2), axis=2, size=self._num_class
      )
      all_masks = F.broadcast_mul(
          masks.expand_dims(2),
          F.broadcast_axes(same_cids, axis=3, size=4),
      )
      return all_targets, all_masks, indices
  
imports: from __future__ import absolute_import
  import numpy
  from mxnet import gluon
  from mxnet import nd
  from .bbox import BBoxCornerToCenter, NumPyBBoxCornerToCenter
label_desc: Use image node_id 2 for calling the NormalizedPerClassBoxCenterEncoder obj's underlying member method code with example usage: obj.hybrid_forward(F, samples, matches, anchors, labels, refs, means, stds) and returns: all_targets,  all_masks,  indices