Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ConditionalSpeculatability implementation for DynamicReshape (#2261)
Both the input and the shape must be fully known statically. Whether the output is dynamic or not does not matter. Indeed, consider e.g.: ``` func.func @foo(%arg0: tensor<?x?xf64>) { %constant_shape = stablehlo.constant dense<[2, 3]> : tensor<2xi32> %0 = stablehlo.dynamic_reshape %arg0, %constant_shape : (tensor<?x?xf64>, tensor<2xi32>) -> tensor<?x?xf64> return } ``` The input is dynamic, so it could turn out to have e.g. 10 elements instead of the expected 6. Similarly, if the shape is unknown: ``` func.func @foo(%arg0: tensor<2x3xf64>, %unknown_shape: tensor<2xi32>) { %0 = stablehlo.dynamic_reshape %arg0, %unknown_shape : (tensor<2x3xf64>, tensor<2xi32>) -> tensor<?x?xf64> return } ``` Again, the shape could turn out to be e.g. `[2, 5]` at runtime and so the reshape's behavior would be undefined.
- Loading branch information