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

Function load_tensor

tests/visualize_cpp_masks.py:17–23  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

15os.makedirs(out_dir, exist_ok=True)
16
17def load_tensor(path):
18 data = np.fromfile(path + ".bin", dtype=np.float32)
19 if os.path.exists(path + ".shape"):
20 with open(path + ".shape") as f:
21 shape = [int(x) for x in f.read().strip().split(",") if x]
22 return data.reshape(shape) if shape else data
23 return data
24
25for fi in [1, 2, 5, 10, 20, 30, 40, 50]:
26 frame_path = os.path.join(video_dir, f"{fi:05d}.jpg")

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected