-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add specialization of ComputeReshapeShapeOp (#2102)
This enables specialization of stablehlo.compute_reshape_shape operator that operates on constant data: ``` func.func @test() -> (tensor<4xi32>, tensor<1xi32>) { %0 = arith.constant dense<[2, -1, 2, 64]> : tensor<4xi32> %1 = arith.constant dense<[-1]> : tensor<1xi32> %2 = arith.constant 32768 : index %3 = stablehlo.compute_reshape_shape %2, %0 : (index, tensor<4xi32>) -> tensor<4xi32> %4 = stablehlo.compute_reshape_shape %2, %1 : (index, tensor<1xi32>) -> tensor<1xi32> func.return %3, %4 : tensor<4xi32>, tensor<1xi32> } ``` is transformed into: ``` func.func @test() -> (tensor<4xi32>, tensor<1xi32>) { %0 = stablehlo.constant dense<[2, 128, 2, 64]> : tensor<4xi32> %1 = stablehlo.constant dense<32768> : tensor<1xi32> return %0, %1 : tensor<4xi32>, tensor<1xi32> } ```
- Loading branch information
Showing
5 changed files
with
147 additions
and
2 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