MCPcopy Create free account
hub / github.com/dcharatan/flowmap / sanitize_pair

Function sanitize_pair

flowmap/visualization/drawing/types.py:61–67  ·  view source on GitHub ↗
(pair: Pair, device: torch.device)

Source from the content-addressed store, hash-verified

59
60
61def sanitize_pair(pair: Pair, device: torch.device) -> Float[Tensor, "2"]:
62 if isinstance(pair, Tensor):
63 pair = pair.type(torch.float32).to(device)
64 else:
65 pair = torch.tensor(pair, dtype=torch.float32, device=device)
66 assert pair.shape == (2,)
67 return pair

Callers 1

generate_conversionsFunction · 0.85

Calls 1

toMethod · 0.45

Tested by

no test coverage detected