code: def one_hot(x, v_bins):
      reshaped_bins = v_bins.view(
          ((1,) * len(x.shape)) + (len(v_bins),)
      )
      diffs = x[..., None] - reshaped_bins
      am = torch.argmin(torch.abs(diffs), dim=-1)
      return nn.functional.one_hot(am, num_classes=len(v_bins)).float()
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/models/esm/openfold_utils/tensor_utils.py
imports: from functools import partial
  from typing import List
  import torch
  import torch.nn
label_desc: Use image node_id 7 for calling a global function with example usage: one_hot(x, v_bins) and returns: nn