MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / round_float

Function round_float

engine.py:22–32  ·  view source on GitHub ↗
(items)

Source from the content-addressed store, hash-verified

20from mmcv.runner import get_dist_info, init_dist
21
22def round_float(items):
23 if isinstance(items, list):
24 return [round_float(item) for item in items]
25 elif isinstance(items, float):
26 return round(items, 3)
27 elif isinstance(items, np.ndarray):
28 return round_float(float(items))
29 elif isinstance(items, torch.Tensor):
30 return round_float(items.detach().cpu().numpy())
31 else:
32 return items
33
34def train_one_epoch(model: torch.nn.Module,
35 criterion: torch.nn.Module,

Callers 1

train_one_epochFunction · 0.85

Calls 1

detachMethod · 0.45

Tested by

no test coverage detected