(device)
| 1409 | |
| 1410 | |
| 1411 | def _is_torch_fp64_available(device): |
| 1412 | if not is_torch_available(): |
| 1413 | return False |
| 1414 | |
| 1415 | import torch |
| 1416 | |
| 1417 | device = torch.device(device) |
| 1418 | |
| 1419 | try: |
| 1420 | x = torch.zeros((2, 2), dtype=torch.float64).to(device) |
| 1421 | _ = torch.mul(x, x) |
| 1422 | return True |
| 1423 | |
| 1424 | except Exception as e: |
| 1425 | if device.type == "cuda": |
| 1426 | raise ValueError( |
| 1427 | f"You have passed a device of type 'cuda' which should work with 'fp64', but 'cuda' does not seem to be correctly installed on your machine: {e}" |
| 1428 | ) |
| 1429 | |
| 1430 | return False |
| 1431 | |
| 1432 | |
| 1433 | # Guard these lookups for when Torch is not used - alternative accelerator support is for PyTorch |
no test coverage detected
searching dependent graphs…