code: def _expand_onehot_labels(labels, label_weights, label_channels):
      bin_labels = labels.new_full((labels.size(0), label_channels), 0)
      inds = torch.nonzero(
          (labels >= 0) & (labels < label_channels), as_tuple=False
      ).squeeze()
      if inds.numel() > 0:
          bin_labels[inds, labels[inds]] = 1
      bin_label_weights = label_weights.view(-1, 1).expand(
          label_weights.size(0), label_channels
      )
      return bin_labels, bin_label_weights
  
file_path: mmdetection/mmdet/models/losses/ghm_loss.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from mmdet.registry import MODELS
  from .utils import weight_reduce_loss
label_desc: Use image node_id 1 for calling a global function with example usage: _expand_onehot_labels(labels, label_weights, label_channels) and returns: bin_labels,  bin_label_weights