code: def _label_to_bow(label: pt.Tensor, num_labels: int):
      bow = pt.zeros(label.shape[0], num_labels, device=label.device)
      bow[
          pt.arange(0, label.shape[0], dtype=pt.int64)[:, np.newaxis],
          label.long(),
      ] = 1.0
      return bow
  
imports: import logging
  import math
  from abc import ABC, abstractmethod
  from typing import Any, Dict, Optional, Tuple
  import torch
  import numpy
  from .None import constants
  from .None import utils
label_desc: Use image node_id 1 for calling a global function with example usage: _label_to_bow(label, num_labels) and returns: bow