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 <algorithm>
|
||||
@@ -173,7 +172,7 @@ TEST_F(SequentialTest, AccessWithAt) {
|
||||
ASSERT_EQ(sequential->size(), 3);
|
||||
|
||||
// returns the correct module for a given index
|
||||
for (const auto i : c10::irange(modules.size())) {
|
||||
for (size_t i = 0; i < modules.size(); ++i) {
|
||||
ASSERT_EQ(&sequential->at<M>(i), modules[i].get());
|
||||
}
|
||||
|
||||
@@ -202,7 +201,7 @@ TEST_F(SequentialTest, AccessWithPtr) {
|
||||
ASSERT_EQ(sequential->size(), 3);
|
||||
|
||||
// returns the correct module for a given index
|
||||
for (const auto i : c10::irange(modules.size())) {
|
||||
for (size_t i = 0; i < modules.size(); ++i) {
|
||||
ASSERT_EQ(sequential->ptr(i).get(), modules[i].get());
|
||||
ASSERT_EQ(sequential[i].get(), modules[i].get());
|
||||
ASSERT_EQ(sequential->ptr<M>(i).get(), modules[i].get());
|
||||
|
||||
Reference in New Issue
Block a user