MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / get_map_func

Function get_map_func

samples/python/engine_refit_onnx_bidaf/data_processing.py:40–46  ·  view source on GitHub ↗
(filepath)

Source from the content-addressed store, hash-verified

38
39
40def get_map_func(filepath):
41 file = open(filepath)
42 category_map = json.load(file)
43 category_mapper = dict(zip(category_map["cats_strings"], category_map["cats_int64s"]))
44 default_int64 = category_map["default_int64"]
45 func = lambda s: category_mapper.get(s, default_int64)
46 return np.vectorize(func)
47
48
49def get_inputs(context, query):

Callers 1

get_inputsFunction · 0.85

Calls 2

loadMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected