def METHOD_NAME(self, val):
    d, values_map = self._dist_and_values()
    if torch.is_tensor(val):
        value_hash = hash(val.cpu().contiguous().numpy().tobytes())
    elif isinstance(val, dict):
        value_hash = hash(self._dict_to_tuple(val))
    else:
        value_hash = hash(val)
    return d.METHOD_NAME(torch.tensor([list(values_map.keys()).index(value_hash)]))