We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 99b1f6c commit f446b82Copy full SHA for f446b82
torch/onnx/operators.py
@@ -0,0 +1,20 @@
1
+import torch
2
+import torch.onnx
3
+
4
5
+def _shape_as_tensor(g, input):
6
+ return g.op('Shape', input)
7
8
9
+@torch.onnx.symbolic_override(_shape_as_tensor)
10
+def shape_as_tensor(x):
11
+ return torch.LongTensor(tuple(x.shape))
12
13
14
+def _reshape_from_tensor_shape(g, input, shape):
15
+ return g.op('Reshape', input, shape)
16
17
18
+@torch.onnx.symbolic_override(_reshape_from_tensor_shape)
19
+def reshape_from_tensor_shape(x, shape):
20
+ return x.reshape(shape.tolist())
0 commit comments