Skip to content

Commit cdd5c64

Browse files
committed
gen doc and sample support status
1 parent fdc7e32 commit cdd5c64

File tree

2 files changed

+189
-0
lines changed

2 files changed

+189
-0
lines changed

support_status.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
## `tf2onnx` Support Status
2+
### Domain: "" (default domain)
3+
| Tensorflow Op | Convertible to ONNX Op Versions |
4+
| ------------- | ------------------------------- |
5+
| Const | ['1'] |
6+
| ConstV2 | ['1'] |
7+
| RandomNormal | ['1'] |
8+
| RandomUniform | ['1'] |
9+
| RandomNormalLike | ['1'] |
10+
| RandomUniformLike | ['1'] |
11+
| ZerosLike | ['1'] |
12+
| LogicalNot | ['1'] |
13+
| LogicalOr | ['1', '6'] |
14+
| LogicalAnd | ['1', '6'] |
15+
| Equal | ['1', '7'] |
16+
| NotEqual | ['1', '7'] |
17+
| Greater | ['1', '7'] |
18+
| Less | ['1', '7'] |
19+
| Add | ['1', '6'] |
20+
| Div | ['1', '6'] |
21+
| Mul | ['1', '6'] |
22+
| Sub | ['1', '6'] |
23+
| RealDiv | ['1', '6'] |
24+
| TruncateDiv | ['1', '6'] |
25+
| LeakyRelu | ['1'] |
26+
| LogSoftmax | ['1'] |
27+
| Softplus | ['1'] |
28+
| Softsign | ['1'] |
29+
| Abs | ['1', '6'] |
30+
| Ceil | ['1', '6'] |
31+
| Elu | ['1', '6'] |
32+
| Exp | ['1', '6'] |
33+
| Floor | ['1', '6'] |
34+
| Log | ['1', '6'] |
35+
| Neg | ['1', '6'] |
36+
| Relu | ['1', '6'] |
37+
| Sigmoid | ['1', '6'] |
38+
| Sqrt | ['1', '6'] |
39+
| Tanh | ['1', '6'] |
40+
| Reciprocal | ['1', '6'] |
41+
| Maximum | ['1'] |
42+
| Minimum | ['1'] |
43+
| Softmax | ['1'] |
44+
| Square | ['1'] |
45+
| Relu6 | ['1'] |
46+
| Rsqrt | ['1'] |
47+
| SquaredDifference | ['1'] |
48+
| Sign | ['1', '9'] |
49+
| Pow | ['1', '7'] |
50+
| LRN | ['1'] |
51+
| MatMul | ['1'] |
52+
| BatchMatMul | ['1'] |
53+
| Erf | ['1', '9'] |
54+
| Selu | ['1'] |
55+
| CheckNumerics | ['1'] |
56+
| StopGradient | ['1'] |
57+
| Placeholder | ['1'] |
58+
| PlaceholderV2 | ['1'] |
59+
| PlaceholderWithDefault | ['1'] |
60+
| NoOp | ['1'] |
61+
| Size | ['1'] |
62+
| Flatten | ['1', '9'] |
63+
| Dropout | ['1', '6', '7', '10'] |
64+
| Identity | ['1'] |
65+
| Reshape | ['1', '5'] |
66+
| Squeeze | ['1'] |
67+
| Transpose | ['1'] |
68+
| Concat | ['1'] |
69+
| ConcatV2 | ['1'] |
70+
| Slice | ['1', '10'] |
71+
| Gather | ['1'] |
72+
| GatherV2 | ['1'] |
73+
| GatherNd | ['1'] |
74+
| Split | ['1', '2'] |
75+
| SplitV | ['1', '2'] |
76+
| ExpandDims | ['1', '7'] |
77+
| StridedSlice | ['1', '10'] |
78+
| Cast | ['1', '6', '9'] |
79+
| TopKV2 | ['1', '10'] |
80+
| Tile | ['1'] |
81+
| Pack | ['1'] |
82+
| Unpack | ['1'] |
83+
| OneHot | ['1', '9'] |
84+
| Shape | ['1'] |
85+
| BatchToSpaceND | ['1'] |
86+
| SpaceToBatchND | ['1'] |
87+
| Conv1D | ['1'] |
88+
| Conv2D | ['1'] |
89+
| Conv3D | ['1'] |
90+
| Conv2DBackpropInput | ['1'] |
91+
| DepthwiseConv2d | ['1'] |
92+
| DepthwiseConv2dNative | ['1'] |
93+
| MaxPool | ['1', '10'] |
94+
| MaxPoolV2 | ['1', '10'] |
95+
| AvgPool | ['1', '10'] |
96+
| AvgPool3D | ['1', '10'] |
97+
| BiasAdd | ['1', '7'] |
98+
| BiasAddV1 | ['1', '7'] |
99+
| Pad | ['1'] |
100+
| PadV2 | ['1'] |
101+
| MirrorPad | ['1'] |
102+
| SpaceToDepth | ['1'] |
103+
| DepthToSpace | ['1'] |
104+
| Prod | ['1'] |
105+
| Sum | ['1'] |
106+
| Mean | ['1'] |
107+
| Max | ['1'] |
108+
| Min | ['1'] |
109+
| ArgMax | ['1'] |
110+
| ArgMin | ['1'] |
111+
| LSTMBlockCell | ['1', '7'] |
112+
| FloorDiv | ['6'] |
113+
| FusedBatchNorm | ['6', '9'] |
114+
| FusedBatchNormV2 | ['6', '9'] |
115+
| All | ['6'] |
116+
| Any | ['6'] |
117+
| AddN | ['6'] |
118+
| If | ['7'] |
119+
| Loop | ['7'] |
120+
| Scan | ['7'] |
121+
| Range | ['7'] |
122+
| Fill | ['7', '9'] |
123+
| Multinomial | ['7'] |
124+
| LessEqual | ['7'] |
125+
| GreaterEqual | ['7'] |
126+
| Acos | ['7'] |
127+
| Asin | ['7'] |
128+
| Atan | ['7'] |
129+
| Cos | ['7'] |
130+
| Sin | ['7'] |
131+
| Tan | ['7'] |
132+
| FloorMod | ['7'] |
133+
| ResizeBilinear | ['7', '9', '10'] |
134+
| ResizeNearestNeighbor | ['7', '9', '10'] |
135+
| MatrixBandPart | ['7'] |
136+
| SoftmaxCrossEntropyWithLogits | ['7'] |
137+
| SparseSoftmaxCrossEntropyWithLogits | ['7', '9'] |
138+
| Select | ['8', '9'] |
139+
| ReverseSequence | ['8', '9', '10'] |
140+
| MaxPoolWithArgmax | ['8'] |
141+
| Where | ['9'] |
142+
| Acosh | ['9'] |
143+
| Asinh | ['9'] |
144+
| Atanh | ['9'] |
145+
| Cosh | ['9'] |
146+
| Sinh | ['9'] |
147+
| IsNan | ['9'] |
148+
| IsInf | ['10'] |
149+
| NonMaxSuppressionV2 | ['10'] |
150+
| NonMaxSuppressionV3 | ['10'] |
151+
### Domain: "com.microsoft"
152+
| Tensorflow Op | Convertible to ONNX Op Versions |
153+
| ------------- | ------------------------------- |
154+
| Range | ['1'] |

tools/gen_doc.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import argparse
2+
from tf2onnx.handler import tf_op
3+
from collections import OrderedDict
4+
5+
parser = argparse.ArgumentParser()
6+
parser.add_argument('filename',
7+
type=str,
8+
help="Path to the documentation file.")
9+
args = parser.parse_args()
10+
11+
with open(args.filename, 'w+') as doc_file:
12+
doc_file.write("## `tf2onnx` Support Status\n")
13+
14+
for domain, opsets in tf_op.get_opsets().items():
15+
comment = "(default domain)" if domain == "" else ""
16+
doc_file.write("### Domain: \"{}\" {}\n".format(domain, comment))
17+
doc_file.write("| Tensorflow Op | Convertible to ONNX Op Versions |\n")
18+
doc_file.write("| ------------- | ------------------------------- |\n")
19+
20+
# Collect a mapping from tf ops to supported handler versions.
21+
tf_op_to_versions = OrderedDict()
22+
for opset in opsets:
23+
for name, func in opset.items():
24+
handler_ver = func[0].__name__.replace("version_", "")
25+
if name in tf_op_to_versions:
26+
tf_op_to_versions[name].append(handler_ver)
27+
else:
28+
tf_op_to_versions[name] = [handler_ver]
29+
30+
# Document support status according to the gathered mapping.
31+
for tf_op, supported_versions in tf_op_to_versions.items():
32+
doc_file.write("| {} | {} |\n".format(tf_op, supported_versions))
33+
34+
doc_file.close()
35+

0 commit comments

Comments
 (0)