MCPcopy Create free account
hub / github.com/TencentARC/MotionCtrl / gather_data

Function gather_data

lvdm/common.py:11–17  ·  view source on GitHub ↗

gather data from multiple processes to one list

(data, return_np=True)

Source from the content-addressed store, hash-verified

9
10
11def gather_data(data, return_np=True):
12 ''' gather data from multiple processes to one list '''
13 data_list = [torch.zeros_like(data) for _ in range(dist.get_world_size())]
14 dist.all_gather(data_list, data) # gather not supported with NCCL
15 if return_np:
16 data_list = [data.cpu().numpy() for data in data_list]
17 return data_list
18
19def autocast(f):
20 def do_autocast(*args, **kwargs):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected