[Compiler][luci] Upgrade logic of shape/type inference algorithm
What?
Let's re-implement(upgrade) shape and type inference algorithm for following things!
- Shape inference
- Add testcases which include dynamic shape
- Support shape inference with unknown dimensions
- Reduce code duplication by grouping similar logic as a helper function
- Type inference
- Reduce code duplication by grouping similar logic as a helper function
How
- Select an operation/operations to implement and write your name in the list of table at assignee.
- You can select multiple operations which logic is similar so that PR can be reviewed at once. (ex: ReLU and ReLU6)
- Only reserve as much as you can finish in one week. DO NOT BE GREEDY.
- Implement each operations as following rules
- Shape Inference
- Write new recipes with dynamic shape, which are enough to cover most of algorithm codes. (For code coverage)
- Add the recipes to
common-artifacts/exclude.lst. (TestDataGenerator not supports yet) - Add the recipes to
res/TensorFlowLiteRecipes/orres/CircleRecipes. - Upgrade shape inference algorithm with considering unknown dimension. (Group similar algorithms as helper function)
- Deprecate old shape inference algorithm
- Type Inference
- Move original type inference algorithm. (Group similar algorithms as helper function)
- Shape Inference
- Create PR(s). Then write the PR number in the table at
-
PR(exclude), for adding recipe to
common-artifacts/exclude.lst. -
PR(res), for adding recipe to
res/. - PR(type), for type inference algorithm implementation
- PR(shape), for shape inference algorithm implementation
-
PR(exclude), for adding recipe to
- After PR is merged, write :heavy_check_mark: at Status in the table.
Examples (Guide)
- PR(exlucde)
- #5611
- PR(res)
- #5079
- PR(type) / PR(shape)
- #6312
Background
This issue is originated from #5501. Please refer to the comment in that issue.
Operation Table (A-C)
:no_entry_sign: : Not needed :heavy_check_mark: : Done
| Operation | Assignee | PR(exlucde) | PR(res) | PR(type) | PR(shape) | Status |
|---|---|---|---|---|---|---|
| Abs | ||||||
| Add | ||||||
| AddN | ||||||
| All | ||||||
| ArgMax | ||||||
| ArgMin | ||||||
| AveragePool2D | ||||||
| BatchMatMul | ||||||
| BatchToSpaceND | ||||||
| Cast | ||||||
| Ceil | ||||||
| Concatenation | ||||||
| Const | :no_entry_sign: | :no_entry_sign: | ||||
| Conv2D | ||||||
| Cos | ||||||
| Custom | :no_entry_sign: | :no_entry_sign: |
Operation Table (D-F)
:no_entry_sign: : Not needed :heavy_check_mark: : Done
| Operation | Assignee | PR(exlucde) | PR(res) | PR(type) | PR(shape) | Status |
|---|---|---|---|---|---|---|
| DepthToSpace | ||||||
| DepthwiseConv2D | ||||||
| Dequantize | ||||||
| Div | ||||||
| Elu | ||||||
| Equal | ||||||
| Exp | ||||||
| ExpandDims | ||||||
| FakeQuant | ||||||
| Fill | ||||||
| Floor | ||||||
| FloorDiv | ||||||
| FloorMod | ||||||
| FullyConnected |
Operation Table (G-L)
:no_entry_sign: : Not needed :heavy_check_mark: : Done
| Operation | Assignee | PR(exlucde) | PR(res) | PR(type) | PR(shape) | Status |
|---|---|---|---|---|---|---|
| Gather | ||||||
| GatherNd | ||||||
| Greater | ||||||
| GreaterEqual | ||||||
| If | ||||||
| L2Normalize | ||||||
| L2Pool2D | ||||||
| LeakyRelu | ||||||
| Less | ||||||
| LessEqual | ||||||
| LocalResponseNormalization | ||||||
| Log | ||||||
| LogicalAnd | ||||||
| LogicalNot | ||||||
| LogicalOr | ||||||
| Logistic | ||||||
| LogSoftmax |
Operation Table (M-P)
:no_entry_sign: : Not needed :heavy_check_mark: : Done
| Operation | Assignee | PR(exlucde) | PR(res) | PR(type) | PR(shape) | Status |
|---|---|---|---|---|---|---|
| MatrixDiag | ||||||
| MatrixSetDiag | ||||||
| Maximum | ||||||
| MaxPool2D | ||||||
| Mean | ||||||
| Minimum | ||||||
| MirrorPad | ||||||
| Mul | ||||||
| Neg | ||||||
| NonMaxSuppressionV4 | ||||||
| NonMaxSuppressionV5 | ||||||
| NotEqual | ||||||
| OneHot | ||||||
| Pack | ||||||
| Pad | ||||||
| PadV2 | ||||||
| Pow | ||||||
| PRelu |
Operation Table (R)
:no_entry_sign: : Not needed :heavy_check_mark: : Done
| Operation | Assignee | PR(exlucde) | PR(res) | PR(type) | PR(shape) | Status |
|---|---|---|---|---|---|---|
| Range | ||||||
| Rank | ||||||
| ReduceAny | ||||||
| ReduceMax | ||||||
| ReduceMin | ||||||
| ReduceProd | ||||||
| Relu | @llFreetimell | #5611 | #5079 | |||
| Relu6 | @llFreetimell | #5611 | #5079 | |||
| ReluN1To1 | @llFreetimell | #5072 | #5079 | |||
| Reshape | ||||||
| ResizeBilinear | ||||||
| ResizeNearestNeighbor | ||||||
| ReverseSequence | ||||||
| ReverseV2 | ||||||
| Round | ||||||
| Rsqrt |
Operation Table (S)
:no_entry_sign: : Not needed :heavy_check_mark: : Done
| Operation | Assignee | PR(exlucde) | PR(res) | PR(type) | PR(shape) | Status |
|---|---|---|---|---|---|---|
| ScatterNd | ||||||
| SegmentSum | ||||||
| Select | ||||||
| SelectV2 | ||||||
| Shape | ||||||
| Sin | ||||||
| Slice | ||||||
| Softmax | ||||||
| SpaceToBatchND | ||||||
| SpaceToDepth | ||||||
| SparseToDense | ||||||
| Split | ||||||
| SplitV | ||||||
| Sqrt | ||||||
| Square | ||||||
| SquaredDifference | ||||||
| Squeeze | ||||||
| StridedSlice | ||||||
| Sub | ||||||
| Sum |
Operation Table (T-Z)
:no_entry_sign: : Not needed :heavy_check_mark: : Done
| Operation | Assignee | PR(exlucde) | PR(res) | PR(type) | PR(shape) | Status |
|---|---|---|---|---|---|---|
| Tanh | ||||||
| Tile | ||||||
| TopKV2 | ||||||
| Transpose | ||||||
| TransposeConv | ||||||
| UnidirectionalSequenceLSTM | ||||||
| Unique | ||||||
| Unpack | ||||||
| Where | ||||||
| While | ||||||
| ZerosLike |
Operation Table (Circle Only Ops)
:no_entry_sign: : Not needed :heavy_check_mark: : Done
| Operation | Assignee | PR(exlucde) | PR(res) | PR(type) | PR(shape) | Status |
|---|---|---|---|---|---|---|
| BCQFullyConnected | ||||||
| BCQGather | ||||||
| InstanceNorm |
Operation Table (Virtual Ops)
:no_entry_sign: : Not needed :heavy_check_mark: : Done
| Operation | Assignee | PR(exlucde) | PR(res) | PR(type) | PR(shape) | Status |
|---|---|---|---|---|---|---|
| CustomOut | :no_entry_sign: | :no_entry_sign: | ||||
| IfOut | @llFreetimell | :no_entry_sign: | :no_entry_sign: | #6312 | #6312 | :heavy_check_mark: |
| Input | :no_entry_sign: | :no_entry_sign: | ||||
| NonMaxSuppressionV4Out | :no_entry_sign: | :no_entry_sign: | ||||
| NonMaxSuppressionV5Out | :no_entry_sign: | :no_entry_sign: | ||||
| Output | :no_entry_sign: | :no_entry_sign: | ||||
| OutputDummy | :no_entry_sign: | :no_entry_sign: | ||||
| OutputExclude | :no_entry_sign: | :no_entry_sign: | ||||
| SplitOut | :no_entry_sign: | :no_entry_sign: | ||||
| SplitVOut | :no_entry_sign: | :no_entry_sign: | ||||
| TopKV2Out | :no_entry_sign: | :no_entry_sign: | ||||
| UniqueOut | :no_entry_sign: | :no_entry_sign: | ||||
| UnpackOut | :no_entry_sign: | :no_entry_sign: | ||||
| WhileOut | :no_entry_sign: | :no_entry_sign: |