Skip to content

Commit d612a67

Browse files
youge325claude
andcommitted
test(scatter_reduce): add dim out of range align test
Add ScatterReduceDimOutOfRange cross-framework comparison test for int64_t dim exceeding int range. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent cc53567 commit d612a67

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

test/ATen/ops/ScatterReduceTest.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,5 +528,27 @@ TEST_F(ScatterReduceTest, ScatterReduceInvalidReduce) {
528528
file.saveFile();
529529
}
530530

531+
// Exception: dim out of int range
532+
TEST_F(ScatterReduceTest, ScatterReduceDimOutOfRange) {
533+
auto file_name = g_custom_param.get();
534+
FileManerger file(file_name);
535+
file.openAppend();
536+
file << "ScatterReduceDimOutOfRange ";
537+
538+
try {
539+
at::Tensor self = at::zeros({2, 2}, at::kFloat);
540+
at::Tensor index = make_index_1x5();
541+
at::Tensor src = at::ones({1, 5}, at::kFloat);
542+
at::Tensor result = self.scatter_reduce(
543+
static_cast<int64_t>(INT_MAX) + 1, index, src, "sum");
544+
write_scatter_reduce_result_to_file(&file, result);
545+
} catch (const std::exception&) {
546+
file << "exception ";
547+
}
548+
549+
file << "\n";
550+
file.saveFile();
551+
}
552+
531553
} // namespace test
532554
} // namespace at

0 commit comments

Comments
 (0)