MCPcopy Index your code
hub / github.com/NVIDIA/TensorRT-LLM / _regularize_value

Method _regularize_value

tensorrt_llm/parameter.py:265–274  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

263 return None
264
265 def _regularize_value(self, value):
266 if isinstance(value, np.ndarray):
267 return value
268
269 elif isinstance(value, torch.distributed.tensor.DTensor):
270 return value.to_local().cpu().numpy()
271 elif isinstance(value, torch.Tensor):
272 return torch_to_numpy(value)
273 raise TypeError(
274 f'Expected numpy.ndarray or torch.Tensor, got {type(value)}')

Callers 3

__init__Method · 0.95
valueMethod · 0.95
set_value_or_dummyMethod · 0.95

Calls 1

torch_to_numpyFunction · 0.85

Tested by

no test coverage detected