forked from OSchip/llvm-project
Remove restriction on static dimensions in Shape method
mlir::shape::ToExtentTensorOp::areCastCompatible didn't allow the input to have a static dimension, but that is allowed.
This commit is contained in:
parent
99d95025e1
commit
64b918852c
|
@ -1767,7 +1767,7 @@ bool ToExtentTensorOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
|
|||
return false;
|
||||
if (auto inputTensor = inputs[0].dyn_cast<RankedTensorType>()) {
|
||||
if (!inputTensor.getElementType().isa<IndexType>() ||
|
||||
inputTensor.getRank() != 1 || !inputTensor.isDynamicDim(0))
|
||||
inputTensor.getRank() != 1)
|
||||
return false;
|
||||
} else if (!inputs[0].isa<ShapeType>()) {
|
||||
return false;
|
||||
|
|
|
@ -168,6 +168,11 @@ func @test_to_extent_tensor(%arg: !shape.shape) -> tensor<3xindex> {
|
|||
return %0 : tensor<3xindex>
|
||||
}
|
||||
|
||||
func @test_identity_to_extent_tensor(%arg: tensor<3xindex>) -> tensor<3xindex> {
|
||||
%0 = shape.to_extent_tensor %arg : tensor<3xindex> -> tensor<3xindex>
|
||||
return %0 : tensor<3xindex>
|
||||
}
|
||||
|
||||
func @test_from_extent_tensor(%arg: tensor<?xindex>) -> !shape.shape {
|
||||
%0 = shape.from_extent_tensor %arg : tensor<?xindex>
|
||||
return %0 : !shape.shape
|
||||
|
|
Loading…
Reference in New Issue