Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 803c774

Browse files
committed
add a test for mismatching tensor dimension
674ed01 hardened the checks for mismatching tensor dimensions, making TC throw if the input/output tensor dimensions match those in the TC function signature, but the test was missing. Add this test.
1 parent cc4b1eb commit 803c774

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/cuda/test_corner_cases.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,17 @@ i))
320320
at::Scalar(d[0]).toFloat());
321321
}
322322

323+
// Passing a tensor of mismatching dimension should fail.
324+
TEST(TestCornerCases, E25) {
325+
auto a = F(1);
326+
auto b = F(1, 1); // 2D-tensor
327+
Fail(
328+
"expected 1 dimensions but found tensor with 2 dimensions",
329+
"def f(float(1) a) -> (b) { b(i) = a(i) }",
330+
{a},
331+
{b});
332+
}
333+
323334
int main(int argc, char** argv) {
324335
::testing::InitGoogleTest(&argc, argv);
325336
::gflags::ParseCommandLineFlags(&argc, &argv, true);

0 commit comments

Comments
 (0)