mirror of
https://github.com/pytorch/pytorch.git
synced 2025-11-03 07:24:58 +08:00
use irange for loops (#66234)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/66234 Modified loops in files under fbsource/fbcode/caffe2/ from the format `for(TYPE var=x0;var<x_max;x++)` to the format `for(const auto var: irange(xmax))` This was achieved by running r-barnes's loop upgrader script (D28874212) with some modification to exclude all files under /torch/jit and a number of reversions or unused variable suppression warnings added by hand. bypass_size_limit allow-large-files Test Plan: Sandcastle Reviewed By: ngimel Differential Revision: D30652629 fbshipit-source-id: 0ae6c4bbbb554bad42e372792a6430e1acf15e3e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b5b7d6a3a6
commit
687c2267d4
@ -2,6 +2,7 @@
|
||||
|
||||
#include "test/cpp/tensorexpr/test_base.h"
|
||||
|
||||
#include <c10/util/irange.h>
|
||||
#include <torch/csrc/jit/tensorexpr/cpp_codegen.h>
|
||||
#include <torch/csrc/jit/tensorexpr/fwd_decls.h>
|
||||
#include <torch/csrc/jit/tensorexpr/stmt.h>
|
||||
@ -207,7 +208,7 @@ TEST(CppPrinter, Cond) {
|
||||
TEST(CppPrinter, Intrinsics) {
|
||||
const std::unordered_set<IntrinsicsOp, std::hash<int>> unsupported_ops{
|
||||
kRand, kSigmoid};
|
||||
for (int i = 0; i < kMaxIntrinsicsOp; i++) {
|
||||
for (const auto i : c10::irange(static_cast<uint32_t>(kMaxIntrinsicsOp))) {
|
||||
IntrinsicsOp op = static_cast<IntrinsicsOp>(i);
|
||||
if (unsupported_ops.count(op)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user