mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/18598 ghimport-source-id: c74597e5e7437e94a43c163cee0639b20d0d0c6a Stack from [ghstack](https://github.com/ezyang/ghstack): * **#18598 Turn on F401: Unused import warning.** This was requested by someone at Facebook; this lint is turned on for Facebook by default. "Sure, why not." I had to noqa a number of imports in __init__. Hypothetically we're supposed to use __all__ in this case, but I was too lazy to fix it. Left for future work. Be careful! flake8-2 and flake8-3 behave differently with respect to import resolution for # type: comments. flake8-3 will report an import unused; flake8-2 will not. For now, I just noqa'd all these sites. All the changes were done by hand. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Differential Revision: D14687478 fbshipit-source-id: 30d532381e914091aadfa0d2a5a89404819663e3
55 lines
1.4 KiB
Python
55 lines
1.4 KiB
Python
import torch._C as _C
|
|
|
|
TensorProtoDataType = _C._onnx.TensorProtoDataType
|
|
OperatorExportTypes = _C._onnx.OperatorExportTypes
|
|
PYTORCH_ONNX_CAFFE2_BUNDLE = _C._onnx.PYTORCH_ONNX_CAFFE2_BUNDLE
|
|
|
|
ONNX_ARCHIVE_MODEL_PROTO_NAME = "__MODEL_PROTO"
|
|
|
|
|
|
class ExportTypes:
|
|
PROTOBUF_FILE = 1
|
|
ZIP_ARCHIVE = 2
|
|
COMPRESSED_ZIP_ARCHIVE = 3
|
|
DIRECTORY = 4
|
|
|
|
|
|
def _export(*args, **kwargs):
|
|
from torch.onnx import utils
|
|
return utils._export(*args, **kwargs)
|
|
|
|
|
|
def export(*args, **kwargs):
|
|
from torch.onnx import utils
|
|
return utils.export(*args, **kwargs)
|
|
|
|
|
|
def export_to_pretty_string(*args, **kwargs):
|
|
from torch.onnx import utils
|
|
return utils.export_to_pretty_string(*args, **kwargs)
|
|
|
|
|
|
def _export_to_pretty_string(*args, **kwargs):
|
|
from torch.onnx import utils
|
|
return utils._export_to_pretty_string(*args, **kwargs)
|
|
|
|
|
|
def _optimize_trace(trace, operator_export_type):
|
|
from torch.onnx import utils
|
|
trace.set_graph(utils._optimize_graph(trace.graph(), operator_export_type))
|
|
|
|
|
|
def set_training(*args, **kwargs):
|
|
from torch.onnx import utils
|
|
return utils.set_training(*args, **kwargs)
|
|
|
|
|
|
def _run_symbolic_function(*args, **kwargs):
|
|
from torch.onnx import utils
|
|
return utils._run_symbolic_function(*args, **kwargs)
|
|
|
|
|
|
def _run_symbolic_method(*args, **kwargs):
|
|
from torch.onnx import utils
|
|
return utils._run_symbolic_method(*args, **kwargs)
|