forked from openxla/stablehlo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dynamic_reshape op spec (openxla#2284)
* Constraints in the spec: ``` I1 operand is tensor or quantized tensor I2 output_shape is 1-dimensional tensor constant of type si64 ``` * Test coverage; ``` I1.1 operand is tensor or quantized tensor. (covered by ODS) I2.1 output_shape is not a 1-dimensional tensor constant of type si64 . (covered by ODS) C1.1 if !is_per_axis_quantized(operand), element_type(result) = element_type(operand). (Added a verifier logic and a test) C1.2 if is_per_axis_quantized(operand), element_type(result) = element_type(operand) except quantization_dimension(operand) and quantization_dimension(result) may differ. (Validated; but test can't be added at this moment because interpreter doesn't support dynamic shapes) C2.1 size(operand) = size(result). (can't be verified at static time for dynamic ops) C3.1 quantization constraints. (verifier logic is common for reshape and dynamic_reshape op. Tests are already present for reshape op. Not needed for dynamic_reshape.) C4.1 rank(result) = size(output_shape) (Already present, validated) ``` * Reference interpreter: partial implementation to support only static shapes. ref:openxla#2267 fixes:openxla#2293
- Loading branch information
Showing
9 changed files
with
206 additions
and
72 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// RUN: stablehlo-translate --interpret -split-input-file %s | ||
|
||
func.func @dynamic_reshape_op_test_si64() { | ||
%operand = stablehlo.constant dense<[[1, 2, 3, 4, 5, 6]]> : tensor<1x6xi64> | ||
%output_shape = stablehlo.constant dense<[6]> : tensor<1xi64> | ||
%result = stablehlo.dynamic_reshape %operand, %output_shape : (tensor<1x6xi64>, tensor<1xi64>) -> tensor<6xi64> | ||
check.expect_eq_const %result, dense<[1, 2, 3, 4, 5, 6]> : tensor<6xi64> | ||
func.return | ||
} |
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
Oops, something went wrong.