MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / new_tensor

Function new_tensor

deepspeed/runtime/zero/partition_parameters.py:240–246  ·  view source on GitHub ↗
(cls, *args)

Source from the content-addressed store, hash-verified

238def get_new_tensor_fn_for_dtype(dtype: torch.dtype) -> Callable:
239
240 def new_tensor(cls, *args) -> Tensor:
241 device = torch.device(get_accelerator().device_name(os.environ["LOCAL_RANK"]))
242 tensor = _orig_torch_empty(0, device=device).new_empty(*args)
243 if tensor.is_floating_point():
244 tensor = tensor.to(dtype)
245
246 return tensor
247
248 return new_tensor
249

Callers

nothing calls this directly

Calls 3

get_acceleratorFunction · 0.90
deviceMethod · 0.45
device_nameMethod · 0.45

Tested by

no test coverage detected