original_docstring: Compute classification, box regression targets for anchors
      Args:
          - anchor_list list[list[Tensor]]: per level, per scan anchors
          - gt_box_list list(Tensor): ground truth box of each scan
          - volume_range list(tuple): volume range of gt box each level
      Returns:
          - flatten_anchors (Tensor)
          - flatten_label_targets (Tensor)
          - flatten_box_targets (Tensor)
      
docstring: Compute classification, box regression targets for anchors
docstring_tokens: Compute classification box regression targets for anchors
code: def anchor_target(anchor_list, gt_box_list, volume_ranges, cfg):
      """Compute classification, box regression targets for anchors
      Args:
          - anchor_list list[list[Tensor]]: per level, per scan anchors
          - gt_box_list list(Tensor): ground truth box of each scan
          - volume_range list(tuple): volume range of gt box each level
      Returns:
          - flatten_anchors (Tensor)
          - flatten_label_targets (Tensor)
          - flatten_box_targets (Tensor)
      """
      # transpose per-level-per-scan to per-scan-per-level
      tp_anchor_list = list(zip(*anchor_list))
  
      # process anchors of each scan
      num_scans = len(tp_anchor_list)
      num_anchor_list = []
      volume_range_list = []
      for i in range(num_scans):
          num_anchor_list.append([anchor.size(0) for anchor in tp_anchor_list[i]])
          volume_range_per_scan = [
              anchor.new_tensor(regression_range)[None].expand(anchor.size(0), 2)
              for anchor, regression_range in zip(tp_anchor_list[i], volume_ranges)
          ]
          volume_range_per_scan = torch.cat(volume_range_per_scan, dim=0)
          volume_range_list.append(volume_range_per_scan)
          tp_anchor_list[i] = torch.cat(tp_anchor_list[i], dim=0)
  
      target_results = multi_apply(
          anchor_target_single, tp_anchor_list, gt_box_list, volume_range_list, cfg=cfg)
      (label_target_list, label_weight_list, box_target_list, box_weight_list, num_pos_list,
       num_neg_list) = target_results
  
      total_num_pos = max(sum(num_pos_list), 1)
      total_num_neg = max(sum(num_neg_list), 1)
  
      # split to per scan, per level
      label_target_list = split(label_target_list, num_anchor_list)
      label_weight_list = split(label_weight_list, num_anchor_list)
      box_target_list = split(box_target_list, num_anchor_list)
      box_weight_list = split(box_weight_list, num_anchor_list)
  
      # transpose back to per level, per scan
      label_target_list = list(zip(*label_target_list))
      label_weight_list = list(zip(*label_weight_list))
      box_target_list = list(zip(*box_target_list))
      box_weight_list = list(zip(*box_weight_list))
  
      # concat to single tensor
      flatten_anchors = concat_list_of_list(anchor_list)
      flatten_label_targets = concat_list_of_list(label_target_list)
      flatten_label_weights = concat_list_of_list(label_weight_list)
      flatten_box_targets = concat_list_of_list(box_target_list)
      flatten_box_weights = concat_list_of_list(box_weight_list)
      return (flatten_anchors, flatten_label_targets, flatten_label_weights, flatten_box_targets,
              flatten_box_weights, total_num_pos, total_num_neg)
code_tokens: def anchor_target ( anchor_list , gt_box_list , volume_ranges , cfg ) : tp_anchor_list = list ( zip ( * anchor_list ) ) num_scans = len ( tp_anchor_list ) num_anchor_list = [ ] volume_range_list = [ ] for i in range ( num_scans ) : num_anchor_list . append ( [ anchor . size ( 0 ) for anchor in tp_anchor_list [ i ] ] ) volume_range_per_scan = [ anchor . new_tensor ( regression_range ) [ None ] . expand ( anchor . size ( 0 ) , 2 ) for anchor , regression_range in zip ( tp_anchor_list [ i ] , volume_ranges ) ] volume_range_per_scan = torch . cat ( volume_range_per_scan , dim = 0 ) volume_range_list . append ( volume_range_per_scan ) tp_anchor_list [ i ] = torch . cat ( tp_anchor_list [ i ] , dim = 0 ) target_results = multi_apply ( anchor_target_single , tp_anchor_list , gt_box_list , volume_range_list , cfg = cfg ) ( label_target_list , label_weight_list , box_target_list , box_weight_list , num_pos_list , num_neg_list ) = target_results total_num_pos = max ( sum ( num_pos_list ) , 1 ) total_num_neg = max ( sum ( num_neg_list ) , 1 ) label_target_list = split ( label_target_list , num_anchor_list ) label_weight_list = split ( label_weight_list , num_anchor_list ) box_target_list = split ( box_target_list , num_anchor_list ) box_weight_list = split ( box_weight_list , num_anchor_list ) label_target_list = list ( zip ( * label_target_list ) ) label_weight_list = list ( zip ( * label_weight_list ) ) box_target_list = list ( zip ( * box_target_list ) ) box_weight_list = list ( zip ( * box_weight_list ) ) flatten_anchors = concat_list_of_list ( anchor_list ) flatten_label_targets = concat_list_of_list ( label_target_list ) flatten_label_weights = concat_list_of_list ( label_weight_list ) flatten_box_targets = concat_list_of_list ( box_target_list ) flatten_box_weights = concat_list_of_list ( box_weight_list ) return ( flatten_anchors , flatten_label_targets , flatten_label_weights , flatten_box_targets , flatten_box_weights , total_num_pos , total_num_neg )
short_docstring: Compute classification, box regression targets for anchors
short_docstring_tokens: Compute classification box regression targets for anchors
comment: """Compute classification, box regression targets for anchors
      Args:
          - anchor_list list[list[Tensor]]: per level, per scan anchors
          - gt_box_list list(Tensor): ground truth box of each scan
          - volume_range list(tuple): volume range of gt box each level
      Returns:
          - flatten_anchors (Tensor)
          - flatten_label_targets (Tensor)
          - flatten_box_targets (Tensor)
      """$SEP$# transpose per-level-per-scan to per-scan-per-level$SEP$# process anchors of each scan$SEP$# split to per scan, per level$SEP$# transpose back to per level, per scan$SEP$# concat to single tensor