MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / insert_tensor

Method insert_tensor

deepspeed/runtime/swap_tensor/utils.py:50–53  ·  view source on GitHub ↗
(self, tensor, swap_path, aligned_numel)

Source from the content-addressed store, hash-verified

48 self.num_elem = 0
49
50 def insert_tensor(self, tensor, swap_path, aligned_numel):
51 swap_tensor, compute_tensor = self.allocate_tensor(swap_path, tensor.numel(), aligned_numel)
52 compute_tensor.data.copy_(tensor.data)
53 return swap_tensor, compute_tensor
54
55 def allocate_tensor(self, swap_path, numel, aligned_numel):
56 assert self.has_space(aligned_numel)

Callers 4

insert_tensorMethod · 0.45
_swap_out_fp16_paramsMethod · 0.45
_swap_out_tensorMethod · 0.45

Calls 3

allocate_tensorMethod · 0.95
numelMethod · 0.45
copy_Method · 0.45

Tested by

no test coverage detected