-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TorchFX] Export to
torch.export.export_for_training
(#3075)
### Changes * TorchFX Unit tests are moved from `torch._export.capture_pre_autograd_graph` to `torch.export.export_for_training` ALL REFERENCE GRAPHS WERE VALIDATED MANUALLY * BC types for `fuse_bn_node` are updated * NNCFGraphBuilder is updated to support a batch-norm type with only one output node (instead of three) * Model extractor does not traverse down from constans to prevent redundant nodes in the extracted model when the constant is shared * `shared_constants_unification_transformation` is removed * Tests which require `capture_pre_autograd_graph` are removed ### Reason for changes * To migrate to the lates and recommended export method for TorchFX backend ### Related tickets #2766 ### Tests test_shared_constants_unification_not_connected_const post_training_quantization/540/ is finished successfully
- Loading branch information
1 parent
3d8b0e0
commit 90d15a6
Showing
78 changed files
with
27,846 additions
and
28,687 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...data/reference_graphs/fx/extracted/ConvolutionWithAllConstantInputsModelconv2d_conv2d.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...rch/data/reference_graphs/fx/extracted/ConvolutionWithNotTensorBiasModelconv2d_conv2d.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 10 additions & 10 deletions
20
...s/torch/data/reference_graphs/fx/extracted/MultiBranchesConnectedModelconv2d_1_add__1.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
strict digraph { | ||
"0 _param_constant2" [id=0, type=get_attr]; | ||
"1 _param_constant3" [id=1, type=get_attr]; | ||
"2 conv2d_1_input" [id=2, type=input]; | ||
"3 conv2d_1" [id=3, type=conv2d]; | ||
"4 _tensor_constant0_1" [id=4, type=get_attr]; | ||
"0 conv_b_weight" [id=0, type=get_attr]; | ||
"1 conv_b_bias" [id=1, type=get_attr]; | ||
"2 bias" [id=2, type=get_attr]; | ||
"3 conv2d_1_input" [id=3, type=input]; | ||
"4 conv2d_1" [id=4, type=conv2d]; | ||
"5 add__1" [id=5, type=add_]; | ||
"6 output" [id=6, type=output]; | ||
"0 _param_constant2" -> "3 conv2d_1" [label="(3, 3, 1, 1)", style=solid]; | ||
"1 _param_constant3" -> "3 conv2d_1" [label="(3,)", style=solid]; | ||
"2 conv2d_1_input" -> "3 conv2d_1" [label=None, style=solid]; | ||
"3 conv2d_1" -> "5 add__1" [label="(1, 3, 3, 3)", style=solid]; | ||
"4 _tensor_constant0_1" -> "5 add__1" [label="(1,)", style=solid]; | ||
"0 conv_b_weight" -> "4 conv2d_1" [label="(3, 3, 1, 1)", style=solid]; | ||
"1 conv_b_bias" -> "4 conv2d_1" [label="(3,)", style=solid]; | ||
"2 bias" -> "5 add__1" [label="(1,)", style=solid]; | ||
"3 conv2d_1_input" -> "4 conv2d_1" [label=None, style=solid]; | ||
"4 conv2d_1" -> "5 add__1" [label="(1, 3, 3, 3)", style=solid]; | ||
"5 add__1" -> "6 output" [label="(1, 3, 3, 3)", style=solid]; | ||
} |
70 changes: 34 additions & 36 deletions
70
tests/torch/data/reference_graphs/fx/extracted/MultiBranchesConnectedModelconv2d_add__1.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
strict digraph { | ||
"0 _param_constant0" [id=0, type=get_attr]; | ||
"1 _param_constant1" [id=1, type=get_attr]; | ||
"2 conv2d_input" [id=2, type=input]; | ||
"3 conv2d" [id=3, type=conv2d]; | ||
"4 _param_constant2" [id=4, type=get_attr]; | ||
"5 _param_constant3" [id=5, type=get_attr]; | ||
"6 conv2d_1" [id=6, type=conv2d]; | ||
"7 _tensor_constant0" [id=7, type=get_attr]; | ||
"8 add_" [id=8, type=add_]; | ||
"9 _tensor_constant0_1" [id=9, type=get_attr]; | ||
"10 add__1" [id=10, type=add_]; | ||
"11 add" [id=11, type=add]; | ||
"12 _param_constant4" [id=12, type=get_attr]; | ||
"13 _param_constant5" [id=13, type=get_attr]; | ||
"14 conv2d_2" [id=14, type=conv2d]; | ||
"15 _tensor_constant0_2" [id=15, type=get_attr]; | ||
"16 add_1" [id=16, type=add]; | ||
"17 output" [id=17, type=output]; | ||
"0 _param_constant0" -> "3 conv2d" [label="(3, 3, 1, 1)", style=solid]; | ||
"1 _param_constant1" -> "3 conv2d" [label="(3,)", style=solid]; | ||
"2 conv2d_input" -> "3 conv2d" [label=None, style=solid]; | ||
"3 conv2d" -> "6 conv2d_1" [label="(1, 3, 3, 3)", style=solid]; | ||
"3 conv2d" -> "8 add_" [label="(1, 3, 3, 3)", style=solid]; | ||
"4 _param_constant2" -> "6 conv2d_1" [label="(3, 3, 1, 1)", style=solid]; | ||
"5 _param_constant3" -> "6 conv2d_1" [label="(3,)", style=solid]; | ||
"6 conv2d_1" -> "10 add__1" [label="(1, 3, 3, 3)", style=solid]; | ||
"7 _tensor_constant0" -> "8 add_" [label="(1,)", style=solid]; | ||
"8 add_" -> "11 add" [label="(1, 3, 3, 3)", style=solid]; | ||
"9 _tensor_constant0_1" -> "10 add__1" [label="(1,)", style=solid]; | ||
"10 add__1" -> "11 add" [label="(1, 3, 3, 3)", style=solid]; | ||
"10 add__1" -> "17 output" [label="(1, 3, 3, 3)", style=solid]; | ||
"11 add" -> "14 conv2d_2" [label="(1, 3, 3, 3)", style=solid]; | ||
"12 _param_constant4" -> "14 conv2d_2" [label="(3, 3, 1, 1)", style=solid]; | ||
"13 _param_constant5" -> "14 conv2d_2" [label="(3,)", style=solid]; | ||
"14 conv2d_2" -> "16 add_1" [label="(1, 3, 3, 3)", style=solid]; | ||
"15 _tensor_constant0_2" -> "16 add_1" [label="(1,)", style=solid]; | ||
"0 conv_a_weight" [id=0, type=get_attr]; | ||
"1 conv_a_bias" [id=1, type=get_attr]; | ||
"2 conv_b_weight" [id=2, type=get_attr]; | ||
"3 conv_b_bias" [id=3, type=get_attr]; | ||
"4 conv_c_weight" [id=4, type=get_attr]; | ||
"5 conv_c_bias" [id=5, type=get_attr]; | ||
"6 bias" [id=6, type=get_attr]; | ||
"7 conv2d_input" [id=7, type=input]; | ||
"8 conv2d" [id=8, type=conv2d]; | ||
"9 conv2d_1" [id=9, type=conv2d]; | ||
"10 add_" [id=10, type=add_]; | ||
"11 add__1" [id=11, type=add_]; | ||
"12 add" [id=12, type=add]; | ||
"13 conv2d_2" [id=13, type=conv2d]; | ||
"14 add_1" [id=14, type=add]; | ||
"15 output" [id=15, type=output]; | ||
"0 conv_a_weight" -> "8 conv2d" [label="(3, 3, 1, 1)", style=solid]; | ||
"1 conv_a_bias" -> "8 conv2d" [label="(3,)", style=solid]; | ||
"2 conv_b_weight" -> "9 conv2d_1" [label="(3, 3, 1, 1)", style=solid]; | ||
"3 conv_b_bias" -> "9 conv2d_1" [label="(3,)", style=solid]; | ||
"4 conv_c_weight" -> "13 conv2d_2" [label="(3, 3, 1, 1)", style=solid]; | ||
"5 conv_c_bias" -> "13 conv2d_2" [label="(3,)", style=solid]; | ||
"6 bias" -> "10 add_" [label="(1,)", style=solid]; | ||
"6 bias" -> "11 add__1" [label="(1,)", style=solid]; | ||
"6 bias" -> "14 add_1" [label="(1,)", style=solid]; | ||
"7 conv2d_input" -> "8 conv2d" [label=None, style=solid]; | ||
"8 conv2d" -> "9 conv2d_1" [label="(1, 3, 3, 3)", style=solid]; | ||
"8 conv2d" -> "10 add_" [label="(1, 3, 3, 3)", style=solid]; | ||
"9 conv2d_1" -> "11 add__1" [label="(1, 3, 3, 3)", style=solid]; | ||
"10 add_" -> "12 add" [label="(1, 3, 3, 3)", style=solid]; | ||
"11 add__1" -> "12 add" [label="(1, 3, 3, 3)", style=solid]; | ||
"11 add__1" -> "15 output" [label="(1, 3, 3, 3)", style=solid]; | ||
"12 add" -> "13 conv2d_2" [label="(1, 3, 3, 3)", style=solid]; | ||
"13 conv2d_2" -> "14 add_1" [label="(1, 3, 3, 3)", style=solid]; | ||
} |
51 changes: 25 additions & 26 deletions
51
...s/torch/data/reference_graphs/fx/extracted/MultiBranchesConnectedModelconv2d_add__add.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
strict digraph { | ||
"0 _param_constant0" [id=0, type=get_attr]; | ||
"1 _param_constant1" [id=1, type=get_attr]; | ||
"2 conv2d_input" [id=2, type=input]; | ||
"3 conv2d" [id=3, type=conv2d]; | ||
"4 _param_constant2" [id=4, type=get_attr]; | ||
"5 _param_constant3" [id=5, type=get_attr]; | ||
"6 conv2d_1" [id=6, type=conv2d]; | ||
"7 _tensor_constant0" [id=7, type=get_attr]; | ||
"0 conv_a_weight" [id=0, type=get_attr]; | ||
"1 conv_a_bias" [id=1, type=get_attr]; | ||
"2 conv_b_weight" [id=2, type=get_attr]; | ||
"3 conv_b_bias" [id=3, type=get_attr]; | ||
"4 bias" [id=4, type=get_attr]; | ||
"5 conv2d_input" [id=5, type=input]; | ||
"6 conv2d" [id=6, type=conv2d]; | ||
"7 conv2d_1" [id=7, type=conv2d]; | ||
"8 add_" [id=8, type=add_]; | ||
"9 _tensor_constant0_1" [id=9, type=get_attr]; | ||
"10 add__1" [id=10, type=add_]; | ||
"11 add" [id=11, type=add]; | ||
"12 output" [id=12, type=output]; | ||
"0 _param_constant0" -> "3 conv2d" [label="(3, 3, 1, 1)", style=solid]; | ||
"1 _param_constant1" -> "3 conv2d" [label="(3,)", style=solid]; | ||
"2 conv2d_input" -> "3 conv2d" [label=None, style=solid]; | ||
"3 conv2d" -> "6 conv2d_1" [label="(1, 3, 3, 3)", style=solid]; | ||
"3 conv2d" -> "8 add_" [label="(1, 3, 3, 3)", style=solid]; | ||
"4 _param_constant2" -> "6 conv2d_1" [label="(3, 3, 1, 1)", style=solid]; | ||
"5 _param_constant3" -> "6 conv2d_1" [label="(3,)", style=solid]; | ||
"6 conv2d_1" -> "10 add__1" [label="(1, 3, 3, 3)", style=solid]; | ||
"7 _tensor_constant0" -> "8 add_" [label="(1,)", style=solid]; | ||
"8 add_" -> "11 add" [label="(1, 3, 3, 3)", style=solid]; | ||
"8 add_" -> "12 output" [label="(1, 3, 3, 3)", style=solid]; | ||
"9 _tensor_constant0_1" -> "10 add__1" [label="(1,)", style=solid]; | ||
"10 add__1" -> "11 add" [label="(1, 3, 3, 3)", style=solid]; | ||
"11 add" -> "12 output" [label="(1, 3, 3, 3)", style=solid]; | ||
"9 add__1" [id=9, type=add_]; | ||
"10 add" [id=10, type=add]; | ||
"11 output" [id=11, type=output]; | ||
"0 conv_a_weight" -> "6 conv2d" [label="(3, 3, 1, 1)", style=solid]; | ||
"1 conv_a_bias" -> "6 conv2d" [label="(3,)", style=solid]; | ||
"2 conv_b_weight" -> "7 conv2d_1" [label="(3, 3, 1, 1)", style=solid]; | ||
"3 conv_b_bias" -> "7 conv2d_1" [label="(3,)", style=solid]; | ||
"4 bias" -> "8 add_" [label="(1,)", style=solid]; | ||
"4 bias" -> "9 add__1" [label="(1,)", style=solid]; | ||
"5 conv2d_input" -> "6 conv2d" [label=None, style=solid]; | ||
"6 conv2d" -> "7 conv2d_1" [label="(1, 3, 3, 3)", style=solid]; | ||
"6 conv2d" -> "8 add_" [label="(1, 3, 3, 3)", style=solid]; | ||
"7 conv2d_1" -> "9 add__1" [label="(1, 3, 3, 3)", style=solid]; | ||
"8 add_" -> "10 add" [label="(1, 3, 3, 3)", style=solid]; | ||
"8 add_" -> "11 output" [label="(1, 3, 3, 3)", style=solid]; | ||
"9 add__1" -> "10 add" [label="(1, 3, 3, 3)", style=solid]; | ||
"10 add" -> "11 output" [label="(1, 3, 3, 3)", style=solid]; | ||
} |
47 changes: 23 additions & 24 deletions
47
.../reference_graphs/fx/extracted/MultiBranchesConnectedModelconv2d_conv2d_1_add__add__1.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
strict digraph { | ||
"0 _param_constant0" [id=0, type=get_attr]; | ||
"1 _param_constant1" [id=1, type=get_attr]; | ||
"2 conv2d_input" [id=2, type=input]; | ||
"3 conv2d" [id=3, type=conv2d]; | ||
"4 _param_constant2" [id=4, type=get_attr]; | ||
"5 _param_constant3" [id=5, type=get_attr]; | ||
"6 conv2d_1_input" [id=6, type=input]; | ||
"7 conv2d_1" [id=7, type=conv2d]; | ||
"8 _tensor_constant0" [id=8, type=get_attr]; | ||
"0 conv_a_weight" [id=0, type=get_attr]; | ||
"1 conv_a_bias" [id=1, type=get_attr]; | ||
"2 conv_b_weight" [id=2, type=get_attr]; | ||
"3 conv_b_bias" [id=3, type=get_attr]; | ||
"4 bias" [id=4, type=get_attr]; | ||
"5 conv2d_input" [id=5, type=input]; | ||
"6 conv2d" [id=6, type=conv2d]; | ||
"7 conv2d_1_input" [id=7, type=input]; | ||
"8 conv2d_1" [id=8, type=conv2d]; | ||
"9 add_" [id=9, type=add_]; | ||
"10 _tensor_constant0_1" [id=10, type=get_attr]; | ||
"11 add__1" [id=11, type=add_]; | ||
"12 output" [id=12, type=output]; | ||
"0 _param_constant0" -> "3 conv2d" [label="(3, 3, 1, 1)", style=solid]; | ||
"1 _param_constant1" -> "3 conv2d" [label="(3,)", style=solid]; | ||
"2 conv2d_input" -> "3 conv2d" [label=None, style=solid]; | ||
"3 conv2d" -> "9 add_" [label="(1, 3, 3, 3)", style=solid]; | ||
"4 _param_constant2" -> "7 conv2d_1" [label="(3, 3, 1, 1)", style=solid]; | ||
"5 _param_constant3" -> "7 conv2d_1" [label="(3,)", style=solid]; | ||
"6 conv2d_1_input" -> "7 conv2d_1" [label=None, style=solid]; | ||
"7 conv2d_1" -> "11 add__1" [label="(1, 3, 3, 3)", style=solid]; | ||
"8 _tensor_constant0" -> "9 add_" [label="(1,)", style=solid]; | ||
"9 add_" -> "12 output" [label="(1, 3, 3, 3)", style=solid]; | ||
"10 _tensor_constant0_1" -> "11 add__1" [label="(1,)", style=solid]; | ||
"11 add__1" -> "12 output" [label="(1, 3, 3, 3)", style=solid]; | ||
"10 add__1" [id=10, type=add_]; | ||
"11 output" [id=11, type=output]; | ||
"0 conv_a_weight" -> "6 conv2d" [label="(3, 3, 1, 1)", style=solid]; | ||
"1 conv_a_bias" -> "6 conv2d" [label="(3,)", style=solid]; | ||
"2 conv_b_weight" -> "8 conv2d_1" [label="(3, 3, 1, 1)", style=solid]; | ||
"3 conv_b_bias" -> "8 conv2d_1" [label="(3,)", style=solid]; | ||
"4 bias" -> "9 add_" [label="(1,)", style=solid]; | ||
"4 bias" -> "10 add__1" [label="(1,)", style=solid]; | ||
"5 conv2d_input" -> "6 conv2d" [label=None, style=solid]; | ||
"6 conv2d" -> "9 add_" [label="(1, 3, 3, 3)", style=solid]; | ||
"7 conv2d_1_input" -> "8 conv2d_1" [label=None, style=solid]; | ||
"8 conv2d_1" -> "10 add__1" [label="(1, 3, 3, 3)", style=solid]; | ||
"9 add_" -> "11 output" [label="(1, 3, 3, 3)", style=solid]; | ||
"10 add__1" -> "11 output" [label="(1, 3, 3, 3)", style=solid]; | ||
} |
Oops, something went wrong.