code: def one_hot(x:Collection[int], c:int):
      "One-hot encode `x` with `c` classes."
      res = np.zeros((c,), np.float32)
      res[listify(x)] = 1.
      return ref one_hot(x:Collection[int], c:int):
      "One-hot encode `x` with `c` classes."
      res = np.zeros((c,), np.float32)
      res[listify(x)] = 1.
      return res
docs: One-hot encode `x` with `c` classes.