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

Function load_tensor

tests/dump_geom_encoder_reference.py:82–86  ·  view source on GitHub ↗
(path: str)

Source from the content-addressed store, hash-verified

80
81
82def load_tensor(path: str) -> torch.Tensor:
83 with open(path + ".shape", "r") as f:
84 shape = [int(x) for x in f.read().strip().split(",") if x]
85 data = np.fromfile(path + ".bin", dtype=np.float32).reshape(shape)
86 return torch.from_numpy(data)
87
88
89# ── Sinusoidal position encoding (matches PositionEmbeddingSine) ──────────

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected