mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Summary: These were indiscriminately dumping `onnx::` instructions into traces, and making it so you couldn't run the traces in the JIT interpreter Pull Request resolved: https://github.com/pytorch/pytorch/pull/12803 Differential Revision: D10443526 Pulled By: jamesr66a fbshipit-source-id: 07172004bf31be9f61e498b5772759fe9262e9b3
21 lines
578 B
Python
21 lines
578 B
Python
r"""This file provides a location for operators that help exporting
|
|
models via onnx. E.g. shape_as_tensor and reshape_from_tensor_shape
|
|
are to make all dynamic sizes operations traceble.
|
|
|
|
NOTE: at one point these functions were implemented differently.
|
|
Since then we have implemented these directly in ATen, so this
|
|
file is kept purely for backward-compatibility.
|
|
"""
|
|
|
|
import torch
|
|
import torch.onnx
|
|
import torch.onnx.utils
|
|
|
|
|
|
def shape_as_tensor(x):
|
|
return torch._shape_as_tensor(x)
|
|
|
|
|
|
def reshape_from_tensor_shape(x, shape):
|
|
return torch._reshape_from_tensor(x, shape)
|