microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
onnxruntime_extensions/onnxprocess/torch_wrapper.py
31lines · modecode
| 1 | try: |
| 2 | import torch |
| 3 | except ImportError: |
| 4 | raise RuntimeError("pytorch not installed, which is required by this ONNX build tool") |
| 5 | |
| 6 | from torch import (float32, |
| 7 | float, |
| 8 | float64, |
| 9 | double, |
| 10 | float16, |
| 11 | bfloat16, |
| 12 | half, |
| 13 | uint8, |
| 14 | int8, |
| 15 | int16, |
| 16 | short, |
| 17 | int32, |
| 18 | int, |
| 19 | int64, |
| 20 | long, |
| 21 | complex64, |
| 22 | cfloat, |
| 23 | complex128, |
| 24 | cdouble, |
| 25 | quint8, |
| 26 | qint8, |
| 27 | qint32, |
| 28 | bool) # noqa |
| 29 | |
| 30 | from torch import randn, onnx # noqa |
| 31 | from ._tensor import * # noqa |
| 32 | |