Skip to content

Commit 6dd1bea

Browse files
mpjlufacebook-github-bot
authored andcommitted
To fix caffe2 model with Copy OP cannot export to onnx model (pytorch#37144)
Summary: To fix caffe2 model with Copy OP cannot export to onnx model Pull Request resolved: pytorch#37144 Reviewed By: houseroad Differential Revision: D21252421 Pulled By: yinghai fbshipit-source-id: 4f1077188f36b0691d199e418880bbb27f11032d
1 parent 1bac49f commit 6dd1bea

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

caffe2/onnx/onnx_exporter.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ OnnxExporter::get_renamed_operators() const {
371371
{"MaxPool3D", "MaxPool"},
372372
{"AveragePool1D", "AveragePool"},
373373
{"AveragePool2D", "AveragePool"},
374-
{"AveragePool3D", "AveragePool"}};
374+
{"AveragePool3D", "AveragePool"},
375+
{"Copy", "Identity"}};
375376
return kRenamedOperators;
376377
}
377378

caffe2/operators/copy_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ OPERATOR_SCHEMA(Copy)
1616
.NumOutputs(1)
1717
.IdenticalTypeAndShape()
1818
.InputsCanCrossDevices()
19+
.InheritOnnxSchema("Identity")
1920
.SetDoc(R"DOC(
2021
Copy input tensor into output, potentially across devices.
2122

0 commit comments

Comments
 (0)