Skip to content

Commit ac4ad9a

Browse files
authored
[NFC] Add a negative unit test for dynamic tensorrt.linspace (#556)
Adds a unit test to check if error is reported when step dim[0] is not equal to rank of output in tensorrt.linspace.
1 parent 0ddac3f commit ac4ad9a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mlir-tensorrt/tensorrt/test/Dialect/TensorRT/invalid.mlir

+8
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@ func.func @trt_fill_linspace(%arg0: tensor<2xi32>, %arg1: tensor<2xi32>) -> tens
322322

323323
// -----
324324

325+
func.func @trt_dynamic_fill_linspace(%arg0: tensor<i32>, %arg1: tensor<2xi32>, %arg2: tensor<3xi32>) -> tensor<?x?xi32> {
326+
// expected-error @below {{'tensorrt.linspace' op dynamic `step` type dimension 0 length must be the same size as the rank of the result type}}
327+
%0 = tensorrt.linspace [%arg0: tensor<i32>][%arg1: tensor<2xi32>][%arg2: tensor<3xi32>] : tensor<?x?xi32>
328+
return %0 : tensor<?x?xi32>
329+
}
330+
331+
// -----
332+
325333
func.func @trt_expand_rank(%arg0: tensor<100x100xf32>) -> tensor<100x100xf32> {
326334
// expected-error @below {{'tensorrt.expand_rank' op the reshape is not a valid rank expansion produced from inserting 1's}}
327335
%0 = tensorrt.expand_rank %arg0 : tensor<100x100xf32> to tensor<100x100xf32>

0 commit comments

Comments
 (0)