class_docstr: One-hot featurizer with zero-padding.
  If ``single_vector``, return the only vector per sample which can have several elements equal to ``1``.
  
  Parameters:
      depth: the depth for one-hotting
      pad_zeros: whether to pad elements of batch with zeros
      single_vector: whether to return one vector for the sample (sum of each one-hotted vectors)
class_docstr_tok: ["One-hot","featurizer","with","zero-padding",".","If","``","single_vector","``",",","return","the","only","vector","per","sample","which","can","have","several","elements","equal","to","``","1","``",".","Parameters",":","depth",":","the","depth","for","one-hotting","pad_zeros",":","whether","to","pad","elements","of","batch","with","zeros","single_vector",":","whether","to","return","one","vector","for","the","sample","(","sum","of","each","one-hotted","vectors",")"]
code: def _to_one_hot(x, n):
      b = np.zeros([len(x), n], dtype=np.float32)
      for q, tok in enumerate(x):
          b[q, int(tok)] = 1
      return b
  
file_path: DeepPavlov/deeppavlov/models/preprocessors/one_hotter.py
imports: from typing import List, Union, Iterable
  import numpy
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.data.utils import zero_pad
  from deeppavlov.core.models.component import Component
label_desc: Use image node_id 3 for calling the OneHotter obj's underlying member method code with example usage: obj._to_one_hot(x, n) and returns: b