Caffe2 - Python API
A deep learning, cross platform ML framework
operators.py
1 r"""This file provides a location for operators that help exporting
2 models via onnx. E.g. shape_as_tensor and reshape_from_tensor_shape
3 are to make all dynamic sizes operations traceble.
4 
5 NOTE: at one point these functions were implemented differently.
6 Since then we have implemented these directly in ATen, so this
7 file is kept purely for backward-compatibility.
8 """
9 
10 import torch
11 import torch.onnx
12 import torch.onnx.utils
13 
14 
15 def shape_as_tensor(x):
16  return torch._shape_as_tensor(x)
17 
18 
19 def reshape_from_tensor_shape(x, shape):
20  return torch._reshape_from_tensor(x, shape)