MCPcopy Create free account
hub / github.com/togethercomputer/OpenChatKit / set_storage

Function set_storage

training/data_parallel/flatten_utils.py:26–34  ·  view source on GitHub ↗
(param, weight_storage, grad_storage, storage_offset)

Source from the content-addressed store, hash-verified

24 flatten_grads_storage = flatten_grads_tensor.storage()
25
26 def set_storage(param, weight_storage, grad_storage, storage_offset):
27 with torch.no_grad():
28 z = torch.zeros_like(param.data)
29 z.set_(weight_storage, storage_offset, param.shape)
30 param.data = z
31
32 t = torch.zeros_like(param.data)
33 t.set_(grad_storage, storage_offset, param.shape)
34 param.grad = t
35
36 offset = 0
37 for i in range(len(params)):

Callers 2

flatten_paramsFunction · 0.85
flatten_tensorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected