MCPcopy Index your code
hub / github.com/FoundationVision/ByteTrack / pyobj2tensor

Function pyobj2tensor

yolox/utils/allreduce_norm.py:41–44  ·  view source on GitHub ↗

serialize picklable python object to tensor

(pyobj, device="cuda")

Source from the content-addressed store, hash-verified

39
40
41def pyobj2tensor(pyobj, device="cuda"):
42 """serialize picklable python object to tensor"""
43 storage = torch.ByteStorage.from_buffer(pickle.dumps(pyobj))
44 return torch.ByteTensor(storage).to(device=device)
45
46
47def tensor2pyobj(tensor):

Callers 1

all_reduceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected