Skip to content

Commit a2dbc7b

Browse files
authored
Merge pull request #830 from RandySheriffH/rashuai/ContribCropResize
switch to contrib cropandresize
2 parents 457dfb2 + 1ffebcd commit a2dbc7b

File tree

1 file changed

+11
-0
lines changed
  • tf2onnx/custom_opsets

1 file changed

+11
-0
lines changed

tf2onnx/custom_opsets/ms.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,14 @@ def version_1(cls, ctx, node, **kwargs):
9292
node.attr.pop("padding")
9393
if "explicit_paddings" in node.attr:
9494
node.attr.pop("explicit_paddings")
95+
96+
@tf_op("CropAndResize", domain=constants.MICROSOFT_DOMAIN)
97+
class CropAndResize:
98+
@classmethod
99+
def version_11(cls, ctx, node, **kwargs):
100+
""" utilize contrib cropandresize """
101+
node.attr['method'].name = 'mode'
102+
node.domain = constants.MICROSOFT_DOMAIN
103+
ctx.insert_new_node_on_input(node, "Transpose", node.input[0], perm=constants.NHWC_TO_NCHW)
104+
ctx.insert_new_node_on_output("Transpose", node.output[0], node.name + '_transposed',
105+
None, perm=constants.NCHW_TO_NHWC)

0 commit comments

Comments
 (0)