Add first version of forwardDType.
Major change
- Introduce a GraphView::forwardDType function that forward data type through the graph to solve #247
- The Operator::forwardDType function try to infer the datatype of the outputs of each nodes based on the datatype of the inputs.
Illustration of change
Before
Warning: Displaying this diagram might cause performance issues on this page.
%%{init: {'flowchart': { 'curve': 'monotoneY'}, 'fontFamily': 'Verdana' } }%%
flowchart TB
Identity_0("Input<br/><sub><em>(Identity#0)</em></sub>")
Unsqueeze_0("unsqueeze_op_2_out0<br/><sub><em>(Unsqueeze#0)</em></sub>")
Producer_1("unsqueeze_op_2_in1_constant<br/><sub><em>(Producer#1)</em></sub>"):::producerCls
Producer_0("two_a<br/><sub><em>(Producer#0)</em></sub>"):::producerCls_rootCls
Shape_0("shape_op_2_out0<br/><sub><em>(Shape#0)</em></sub>")
Producer_11("gather_op_2_in1_constant<br/><sub><em>(Producer#11)</em></sub>"):::producerCls
Gather_3("gather_op_2<br/><sub><em>(Gather#3)</em></sub>")
Producer_7("two_b<br/><sub><em>(Producer#7)</em></sub>"):::producerCls
Div_0("div_op<br/><sub><em>(Div#0)</em></sub>")
Producer_3("unsqueeze_op_3_in1_constant<br/><sub><em>(Producer#3)</em></sub>"):::producerCls
Unsqueeze_2("unsqueeze_op_3_out0<br/><sub><em>(Unsqueeze#2)</em></sub>")
Shape_1("shape_op_3_out0<br/><sub><em>(Shape#1)</em></sub>")
Producer_8("gather_op_3_in1_constant<br/><sub><em>(Producer#8)</em></sub>"):::producerCls
Gather_1("gather_op_3<br/><sub><em>(Gather#1)</em></sub>")
Producer_4("unsqueeze_op_4_in1_constant<br/><sub><em>(Producer#4)</em></sub>"):::producerCls
Unsqueeze_3("unsqueeze_op_4_out0<br/><sub><em>(Unsqueeze#3)</em></sub>")
Shape_2("shape_op_4_out0<br/><sub><em>(Shape#2)</em></sub>")
Producer_9("gather_op_4_in1_constant<br/><sub><em>(Producer#9)</em></sub>"):::producerCls
Gather_2("gather_op_4<br/><sub><em>(Gather#2)</em></sub>")
Producer_12("unsqueeze_op_8_in1_constant<br/><sub><em>(Producer#12)</em></sub>"):::producerCls
Unsqueeze_6("unsqueeze_op_8_out0<br/><sub><em>(Unsqueeze#6)</em></sub>")
Producer_14("unsqueeze_op_7_in1_constant<br/><sub><em>(Producer#14)</em></sub>"):::producerCls
Unsqueeze_8("unsqueeze_op_7_out0<br/><sub><em>(Unsqueeze#8)</em></sub>")
Producer_13("unsqueeze_op_9_in1_constant<br/><sub><em>(Producer#13)</em></sub>"):::producerCls
Unsqueeze_7("unsqueeze_op_9_out0<br/><sub><em>(Unsqueeze#7)</em></sub>")
Shape_3("shape_op_1_out0<br/><sub><em>(Shape#3)</em></sub>")
Producer_6("gather_op_1_in1_constant<br/><sub><em>(Producer#6)</em></sub>"):::producerCls
Gather_0("gather_op_1<br/><sub><em>(Gather#0)</em></sub>")
Producer_10("unsqueeze_op_6_in1_constant<br/><sub><em>(Producer#10)</em></sub>"):::producerCls
Unsqueeze_5("unsqueeze_op_6_out0<br/><sub><em>(Unsqueeze#5)</em></sub>")
Producer_5("unsqueeze_op_5_in1_constant<br/><sub><em>(Producer#5)</em></sub>"):::producerCls
Unsqueeze_4("unsqueeze_op_5_out0<br/><sub><em>(Unsqueeze#4)</em></sub>")
Producer_2("unsqueeze_op_1_in1_constant<br/><sub><em>(Producer#2)</em></sub>"):::producerCls
Unsqueeze_1("unsqueeze_op_1_out0<br/><sub><em>(Unsqueeze#1)</em></sub>")
Concat_0("concat_op_1<br/><sub><em>(Concat#0)</em></sub>")
Reshape_0("reshape_op_1<br/><sub><em>(Reshape#0)</em></sub>")
Concat_1("concat_op_2<br/><sub><em>(Concat#1)</em></sub>")
Transpose_0("transpose_op_1<br/><sub><em>(Transpose#0)</em></sub>")
Reshape_1("reshape_op_2<br/><sub><em>(Reshape#1)</em></sub>")
Identity_0-->|"0 [5, 12, 24, 24] Float32<br/>↓<br/>0"|Shape_0
Identity_0-->|"0 [5, 12, 24, 24] Float32<br/>↓<br/>0"|Shape_1
Identity_0-->|"0 [5, 12, 24, 24] Float32<br/>↓<br/>0"|Shape_2
Identity_0-->|"0 [5, 12, 24, 24] Float32<br/>↓<br/>0"|Shape_3
Identity_0-->|"0 [5, 12, 24, 24] Float32<br/>↓<br/>0"|Reshape_0
Unsqueeze_0-->|"0 [1] Float32<br/>↓<br/>1"|Concat_0
Producer_1-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_0
Producer_0-->|"0 [] Int64<br/>↓<br/>0"|Unsqueeze_0
Shape_0-->|"0 [4] Float32<br/>↓<br/>0"|Gather_3
Producer_11-->|"0 [] Int64<br/>↓<br/>1"|Gather_3
Gather_3-->|"0 [] Float32<br/>↓<br/>0"|Div_0
Gather_3-->|"0 [] Float32<br/>↓<br/>0"|Unsqueeze_8
Producer_7-->|"0 [] Int64<br/>↓<br/>1"|Div_0
Div_0-->|"0 [] Float32<br/>↓<br/>0"|Unsqueeze_2
Producer_3-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_2
Unsqueeze_2-->|"0 [1] Float32<br/>↓<br/>2"|Concat_0
Shape_1-->|"0 [4] Float32<br/>↓<br/>0"|Gather_1
Producer_8-->|"0 [] Int64<br/>↓<br/>1"|Gather_1
Gather_1-->|"0 [] Float32<br/>↓<br/>0"|Unsqueeze_3
Gather_1-->|"0 [] Float32<br/>↓<br/>0"|Unsqueeze_6
Producer_4-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_3
Unsqueeze_3-->|"0 [1] Float32<br/>↓<br/>3"|Concat_0
Shape_2-->|"0 [4] Float32<br/>↓<br/>0"|Gather_2
Producer_9-->|"0 [] Int64<br/>↓<br/>1"|Gather_2
Gather_2-->|"0 [] Float32<br/>↓<br/>0"|Unsqueeze_7
Gather_2-->|"0 [] Float32<br/>↓<br/>0"|Unsqueeze_4
Producer_12-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_6
Unsqueeze_6-->|"0 [1] Float32<br/>↓<br/>2"|Concat_1
Producer_14-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_8
Unsqueeze_8-->|"0 [1] Float32<br/>↓<br/>1"|Concat_1
Producer_13-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_7
Unsqueeze_7-->|"0 [1] Float32<br/>↓<br/>3"|Concat_1
Shape_3-->|"0 [4] Float32<br/>↓<br/>0"|Gather_0
Producer_6-->|"0 [] Int64<br/>↓<br/>1"|Gather_0
Gather_0-->|"0 [] Float32<br/>↓<br/>0"|Unsqueeze_5
Gather_0-->|"0 [] Float32<br/>↓<br/>0"|Unsqueeze_1
Producer_10-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_5
Unsqueeze_5-->|"0 [1] Float32<br/>↓<br/>0"|Concat_1
Producer_5-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_4
Unsqueeze_4-->|"0 [1] Float32<br/>↓<br/>4"|Concat_0
Producer_2-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_1
Unsqueeze_1-->|"0 [1] Float32<br/>↓<br/>0"|Concat_0
Concat_0-->|"0 [5] Float32<br/>↓<br/>1"|Reshape_0
Reshape_0-->|"0 [5, 12, 24, 24, 1] Float32<br/>↓<br/>0"|Transpose_0
Concat_1-->|"0 [4] Float32<br/>↓<br/>1"|Reshape_1
Transpose_0-->|"0 [5, 24, 12, 24, 1] Float32<br/>↓<br/>0"|Reshape_1
input0((in#0)):::inputCls--->|" [5, 12, 24, 24] Float32<br/>↓<br/>0"|Identity_0
Reshape_1--->|"0 [5, 24, 12, 24] Float32<br/>↓"|output0((out#0)):::outputCls
classDef inputCls fill:#afa
classDef outputCls fill:#ffa
classDef externalCls fill:#ccc
classDef producerCls fill:#ccf
classDef genericCls fill:#f9f9ff,stroke-width:1px,stroke-dasharray: 5 5
classDef metaCls stroke-width:5px
classDef rootCls stroke:#f00
classDef producerCls_rootCls stroke:#f00,fill:#ccf
classDef genericCls_rootCls stroke:#f00,fill:#f9f9ff,stroke-width:1px,stroke-dasharray: 5 5
classDef metaCls_rootCls stroke:#f00,stroke-width:5px
After
Warning: Displaying this diagram might cause performance issues on this page.
%%{init: {'flowchart': { 'curve': 'monotoneY'}, 'fontFamily': 'Verdana' } }%%
flowchart TB
Identity_0("Input<br/><sub><em>(Identity#0)</em></sub>")
Unsqueeze_0("unsqueeze_op_2_out0<br/><sub><em>(Unsqueeze#0)</em></sub>")
Producer_1("unsqueeze_op_2_in1_constant<br/><sub><em>(Producer#1)</em></sub>"):::producerCls
Producer_0("two_a<br/><sub><em>(Producer#0)</em></sub>"):::producerCls_rootCls
Shape_0("shape_op_2_out0<br/><sub><em>(Shape#0)</em></sub>")
Producer_8("gather_op_3_in1_constant<br/><sub><em>(Producer#8)</em></sub>"):::producerCls
Producer_11("gather_op_2_in1_constant<br/><sub><em>(Producer#11)</em></sub>"):::producerCls
Gather_3("gather_op_2<br/><sub><em>(Gather#3)</em></sub>")
Producer_7("two_b<br/><sub><em>(Producer#7)</em></sub>"):::producerCls
Div_0("div_op<br/><sub><em>(Div#0)</em></sub>")
Producer_3("unsqueeze_op_3_in1_constant<br/><sub><em>(Producer#3)</em></sub>"):::producerCls
Unsqueeze_2("unsqueeze_op_3_out0<br/><sub><em>(Unsqueeze#2)</em></sub>")
Shape_1("shape_op_3_out0<br/><sub><em>(Shape#1)</em></sub>")
Gather_1("gather_op_3<br/><sub><em>(Gather#1)</em></sub>")
Producer_4("unsqueeze_op_4_in1_constant<br/><sub><em>(Producer#4)</em></sub>"):::producerCls
Unsqueeze_3("unsqueeze_op_4_out0<br/><sub><em>(Unsqueeze#3)</em></sub>")
Shape_2("shape_op_4_out0<br/><sub><em>(Shape#2)</em></sub>")
Producer_9("gather_op_4_in1_constant<br/><sub><em>(Producer#9)</em></sub>"):::producerCls
Gather_2("gather_op_4<br/><sub><em>(Gather#2)</em></sub>")
Producer_12("unsqueeze_op_8_in1_constant<br/><sub><em>(Producer#12)</em></sub>"):::producerCls
Unsqueeze_6("unsqueeze_op_8_out0<br/><sub><em>(Unsqueeze#6)</em></sub>")
Producer_14("unsqueeze_op_7_in1_constant<br/><sub><em>(Producer#14)</em></sub>"):::producerCls
Unsqueeze_8("unsqueeze_op_7_out0<br/><sub><em>(Unsqueeze#8)</em></sub>")
Producer_13("unsqueeze_op_9_in1_constant<br/><sub><em>(Producer#13)</em></sub>"):::producerCls
Unsqueeze_7("unsqueeze_op_9_out0<br/><sub><em>(Unsqueeze#7)</em></sub>")
Shape_3("shape_op_1_out0<br/><sub><em>(Shape#3)</em></sub>")
Producer_6("gather_op_1_in1_constant<br/><sub><em>(Producer#6)</em></sub>"):::producerCls
Gather_0("gather_op_1<br/><sub><em>(Gather#0)</em></sub>")
Producer_10("unsqueeze_op_6_in1_constant<br/><sub><em>(Producer#10)</em></sub>"):::producerCls
Unsqueeze_5("unsqueeze_op_6_out0<br/><sub><em>(Unsqueeze#5)</em></sub>")
Producer_5("unsqueeze_op_5_in1_constant<br/><sub><em>(Producer#5)</em></sub>"):::producerCls
Unsqueeze_4("unsqueeze_op_5_out0<br/><sub><em>(Unsqueeze#4)</em></sub>")
Producer_2("unsqueeze_op_1_in1_constant<br/><sub><em>(Producer#2)</em></sub>"):::producerCls
Unsqueeze_1("unsqueeze_op_1_out0<br/><sub><em>(Unsqueeze#1)</em></sub>")
Concat_0("concat_op_1<br/><sub><em>(Concat#0)</em></sub>")
Reshape_0("reshape_op_1<br/><sub><em>(Reshape#0)</em></sub>")
Concat_1("concat_op_2<br/><sub><em>(Concat#1)</em></sub>")
Transpose_0("transpose_op_1<br/><sub><em>(Transpose#0)</em></sub>")
Reshape_1("reshape_op_2<br/><sub><em>(Reshape#1)</em></sub>")
Identity_0-->|"0 [5, 12, 24, 24] Float32<br/>↓<br/>0"|Shape_0
Identity_0-->|"0 [5, 12, 24, 24] Float32<br/>↓<br/>0"|Shape_1
Identity_0-->|"0 [5, 12, 24, 24] Float32<br/>↓<br/>0"|Shape_2
Identity_0-->|"0 [5, 12, 24, 24] Float32<br/>↓<br/>0"|Shape_3
Identity_0-->|"0 [5, 12, 24, 24] Float32<br/>↓<br/>0"|Reshape_0
Unsqueeze_0-->|"0 [1] Int64<br/>↓<br/>1"|Concat_0
Producer_1-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_0
Producer_0-->|"0 [] Int64<br/>↓<br/>0"|Unsqueeze_0
Shape_0-->|"0 [4] Int64<br/>↓<br/>0"|Gather_3
Producer_8-->|"0 [] Int64<br/>↓<br/>1"|Gather_1
Producer_11-->|"0 [] Int64<br/>↓<br/>1"|Gather_3
Gather_3-->|"0 [] Int64<br/>↓<br/>0"|Div_0
Gather_3-->|"0 [] Int64<br/>↓<br/>0"|Unsqueeze_8
Producer_7-->|"0 [] Int64<br/>↓<br/>1"|Div_0
Div_0-->|"0 [] Int64<br/>↓<br/>0"|Unsqueeze_2
Producer_3-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_2
Unsqueeze_2-->|"0 [1] Int64<br/>↓<br/>2"|Concat_0
Shape_1-->|"0 [4] Int64<br/>↓<br/>0"|Gather_1
Gather_1-->|"0 [] Int64<br/>↓<br/>0"|Unsqueeze_3
Gather_1-->|"0 [] Int64<br/>↓<br/>0"|Unsqueeze_6
Producer_4-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_3
Unsqueeze_3-->|"0 [1] Int64<br/>↓<br/>3"|Concat_0
Shape_2-->|"0 [4] Int64<br/>↓<br/>0"|Gather_2
Producer_9-->|"0 [] Int64<br/>↓<br/>1"|Gather_2
Gather_2-->|"0 [] Int64<br/>↓<br/>0"|Unsqueeze_7
Gather_2-->|"0 [] Int64<br/>↓<br/>0"|Unsqueeze_4
Producer_12-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_6
Unsqueeze_6-->|"0 [1] Int64<br/>↓<br/>2"|Concat_1
Producer_14-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_8
Unsqueeze_8-->|"0 [1] Int64<br/>↓<br/>1"|Concat_1
Producer_13-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_7
Unsqueeze_7-->|"0 [1] Int64<br/>↓<br/>3"|Concat_1
Shape_3-->|"0 [4] Int64<br/>↓<br/>0"|Gather_0
Producer_6-->|"0 [] Int64<br/>↓<br/>1"|Gather_0
Gather_0-->|"0 [] Int64<br/>↓<br/>0"|Unsqueeze_5
Gather_0-->|"0 [] Int64<br/>↓<br/>0"|Unsqueeze_1
Producer_10-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_5
Unsqueeze_5-->|"0 [1] Int64<br/>↓<br/>0"|Concat_1
Producer_5-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_4
Unsqueeze_4-->|"0 [1] Int64<br/>↓<br/>4"|Concat_0
Producer_2-->|"0 [] Int64<br/>↓<br/>1"|Unsqueeze_1
Unsqueeze_1-->|"0 [1] Int64<br/>↓<br/>0"|Concat_0
Concat_0-->|"0 [5] Int64<br/>↓<br/>1"|Reshape_0
Reshape_0-->|"0 [5, 12, 24, 24, 100056253490536] Float32<br/>↓<br/>0"|Transpose_0
Concat_1-->|"0 [4] Int64<br/>↓<br/>1"|Reshape_1
Transpose_0-->|"0 [5, 24, 12, 24, 100056253490536] Float32<br/>↓<br/>0"|Reshape_1
input0((in#0)):::inputCls--->|" [5, 12, 24, 24] Float32<br/>↓<br/>0"|Identity_0
Reshape_1--->|"0 [5, 24, 12, 24] Float32<br/>↓"|output0((out#0)):::outputCls
classDef inputCls fill:#afa
classDef outputCls fill:#ffa
classDef externalCls fill:#ccc
classDef producerCls fill:#ccf
classDef genericCls fill:#f9f9ff,stroke-width:1px,stroke-dasharray: 5 5
classDef metaCls stroke-width:5px
classDef rootCls stroke:#f00
classDef producerCls_rootCls stroke:#f00,fill:#ccf
classDef genericCls_rootCls stroke:#f00,fill:#f9f9ff,stroke-width:1px,stroke-dasharray: 5 5
classDef metaCls_rootCls stroke:#f00,stroke-width:5px
Edited by Cyril Moineau
Merge request reports
Activity
Filter activity
added Feature 🚀 label
assigned to @cmoineau
requested review from @olivierbichler and @pineapple
added StatusWork in Progress label
added 6 commits
- 6c6566b8 - Add forwardDType to FC operator.
- a9a7f1b2 - Add forwardDType to Clip operator.
- a992d818 - Add forwardDType to Cast operator.
- d0fae109 - Add forwardDType to MetaOperator operator.
- 87e65d66 - OperatorTensor::forwarDType no longer require in tensor to be defined.
- 633a061f - Fix GraphView::forwardDType, error with undefined tensors.
Toggle commit listadded StatusReview Ready label and removed StatusWork in Progress label
changed milestone to %aidge v0.6.0
added StatusChanges required label and removed StatusReview Ready label
Please register or sign in to reply