(device)
| 1205 | |
| 1206 | |
| 1207 | def _is_torch_fp64_available(device): |
| 1208 | if not is_torch_available(): |
| 1209 | return False |
| 1210 | |
| 1211 | import torch |
| 1212 | |
| 1213 | device = torch.device(device) |
| 1214 | |
| 1215 | try: |
| 1216 | x = torch.zeros((2, 2), dtype=torch.float64).to(device) |
| 1217 | _ = torch.mul(x, x) |
| 1218 | return True |
| 1219 | |
| 1220 | except Exception as e: |
| 1221 | if device.type == "cuda": |
| 1222 | raise ValueError( |
| 1223 | 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}" |
| 1224 | ) |
| 1225 | |
| 1226 | return False |
| 1227 | |
| 1228 | |
| 1229 | # Guard these lookups for when Torch is not used - alternative accelerator support is for PyTorch |
no test coverage detected
searching dependent graphs…