(pair: Pair, device: torch.device)
| 59 | |
| 60 | |
| 61 | def 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 |
no test coverage detected