mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: Should be non-semantic. Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos, with https://github.com/bwignall/typochecker to help automate the checking. Uses an updated version of the tool used in https://github.com/pytorch/pytorch/pull/30606 . Pull Request resolved: https://github.com/pytorch/pytorch/pull/31523 Differential Revision: D19216749 Pulled By: mrshenli fbshipit-source-id: 7fd489cb9a77cd7e4950c1046f925d57524960ea
21 lines
579 B
Python
21 lines
579 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 traceable.
|
|
|
|
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)
|