-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We have the following constraints in the spec: ``` (I1) inputs: variadic number of tensors. (I2) dimensions: 1-dimensional tensor constant of type `si64`. (I3) computation: function. (C1) All `inputs` and `result` have the same shape. (C2) size(`inputs`) = N >= 1. (C3) `dimensions = [0, ..., R-1]`, where `R` = rank(`inputs[0]`). (C4) `computation` has type `(tensor<E0>, ..., tensor<EN-1>) -> tensor<E'>` where `Ek` = element_type(`inputs[k]`) and `E'` = element_type(`result`). ``` These constraints will be comprehensively covered by the following tests: ``` I1: a) inputs is not a variadic tensor. (Covered by ODS). I2: a) dimensions is not a 1-dimensional tensor. b) element_type(dimensions) != si64. (Covered by ODS). I3: a) computation is not a function. (Covered by ODS). C1: a) Not all `inputs` have the same shape. (Covered by ODS). b) `inputs` and `result` do not have the same shape. (Covered by ODS). C2: size(`inputs`) < 1. (Covered by ODS). C3: a) `dimensions != [0, ..., R-1]`, where `R` = rank(`inputs[0]`). C4: a) `computation` does not have type `(tensor<E0>, ..., tensor<EN-1>) -> tensor<E'>` where `Ek` = element_type(`inputs[k]`) and `E'` = element_type(`result`). ``` If we drop the "Covered by ODS" pieces, this will leave us with the following test cases: ``` I2a: dimensions is not a 1-dimensional tensor. C3a: `dimensions != [0, ..., R-1]`, where `R` = rank(`inputs[0]`). C4a: `computation` does not have type `(tensor<E0>, ..., tensor<EN-1>) -> tensor<E'>` where `Ek` = element_type(`inputs[k]`) and `E'` = element_type(`result`). ``` closes #1106
- Loading branch information
Showing
8 changed files
with
109 additions
and
69 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,15 @@ | ||
// RUN: stablehlo-translate --interpret -split-input-file %s | ||
|
||
func.func @map_op_test_si64() { | ||
%input0 = stablehlo.constant dense<[[0, 1], [2, 3]]> : tensor<2x2xi64> | ||
%input1 = stablehlo.constant dense<[[4, 5], [6, 7]]> : tensor<2x2xi64> | ||
%result = "stablehlo.map"(%input0, %input1) ({ | ||
^bb0(%arg0: tensor<i64>, %arg1: tensor<i64>): | ||
%0 = stablehlo.multiply %arg0, %arg1 : tensor<i64> | ||
stablehlo.return %0 : tensor<i64> | ||
}) { | ||
dimensions = dense<[0, 1]> : tensor<2xi64> | ||
} : (tensor<2x2xi64>, tensor<2x2xi64>) -> tensor<2x2xi64> | ||
check.expect_eq_const %result, dense<[[0, 5], [12, 21]]> : tensor<2x2xi64> | ||
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