MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / save_tensor

Function save_tensor

tests/dump_phase5_reference.py:23–30  ·  view source on GitHub ↗
(path, t)

Source from the content-addressed store, hash-verified

21
22
23def save_tensor(path, t):
24 t = t.detach().cpu().float().contiguous()
25 os.makedirs(os.path.dirname(path) or ".", exist_ok=True)
26 with open(path + ".bin", "wb") as f:
27 f.write(t.numpy().tobytes())
28 with open(path + ".shape", "w") as f:
29 f.write(",".join(str(d) for d in t.shape))
30 print(f" saved {path} shape={list(t.shape)}")
31
32
33def save_tensor_i32(path, t):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected