mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
Revert D30652629: use irange for loops
Test Plan: revert-hammer Differential Revision: D30652629 (https://github.com/pytorch/pytorch/commit/687c2267d4dfb69138483f90deb4d4f5921a2965) Original commit changeset: 0ae6c4bbbb55 fbshipit-source-id: 5c4f067b584a021c8c9656454d1ee60999600fb3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1e2b2ee5ff
commit
2f099c7555
@@ -1,6 +1,5 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <c10/util/irange.h>
|
||||
#include <torch/torch.h>
|
||||
|
||||
#include <test/cpp/api/support.h>
|
||||
@@ -14,7 +13,7 @@ struct ExpandingArrayTest : torch::test::SeedingFixture {};
|
||||
TEST_F(ExpandingArrayTest, CanConstructFromInitializerList) {
|
||||
torch::ExpandingArray<5> e({1, 2, 3, 4, 5});
|
||||
ASSERT_EQ(e.size(), 5);
|
||||
for (const auto i : c10::irange(e.size())) {
|
||||
for (size_t i = 0; i < e.size(); ++i) {
|
||||
ASSERT_EQ((*e)[i], i + 1);
|
||||
}
|
||||
}
|
||||
@@ -22,7 +21,7 @@ TEST_F(ExpandingArrayTest, CanConstructFromInitializerList) {
|
||||
TEST_F(ExpandingArrayTest, CanConstructFromVector) {
|
||||
torch::ExpandingArray<5> e(std::vector<int64_t>{1, 2, 3, 4, 5});
|
||||
ASSERT_EQ(e.size(), 5);
|
||||
for (const auto i : c10::irange(e.size())) {
|
||||
for (size_t i = 0; i < e.size(); ++i) {
|
||||
ASSERT_EQ((*e)[i], i + 1);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +29,7 @@ TEST_F(ExpandingArrayTest, CanConstructFromVector) {
|
||||
TEST_F(ExpandingArrayTest, CanConstructFromArray) {
|
||||
torch::ExpandingArray<5> e(std::array<int64_t, 5>({1, 2, 3, 4, 5}));
|
||||
ASSERT_EQ(e.size(), 5);
|
||||
for (const auto i : c10::irange(e.size())) {
|
||||
for (size_t i = 0; i < e.size(); ++i) {
|
||||
ASSERT_EQ((*e)[i], i + 1);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +37,7 @@ TEST_F(ExpandingArrayTest, CanConstructFromArray) {
|
||||
TEST_F(ExpandingArrayTest, CanConstructFromSingleValue) {
|
||||
torch::ExpandingArray<5> e(5);
|
||||
ASSERT_EQ(e.size(), 5);
|
||||
for (const auto i : c10::irange(e.size())) {
|
||||
for (size_t i = 0; i < e.size(); ++i) {
|
||||
ASSERT_EQ((*e)[i], 5);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user