MCPcopy Index your code
hub / github.com/MoonInTheRiver/DiffSinger / get_a_var

Function get_a_var

utils/pl_utils.py:32–44  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

30
31
32def get_a_var(obj): # pragma: no cover
33 if isinstance(obj, torch.Tensor):
34 return obj
35
36 if isinstance(obj, list) or isinstance(obj, tuple):
37 for result in map(get_a_var, obj):
38 if isinstance(result, torch.Tensor):
39 return result
40 if isinstance(obj, dict):
41 for result in map(get_a_var, obj.items()):
42 if isinstance(result, torch.Tensor):
43 return result
44 return None
45
46
47def data_loader(fn):

Callers 1

_workerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected