mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
irange for PyTorch sans jit (#59481)
Summary: Switches most of the simple for loops outside of `jit` directories to use `c10::irange`. Generated with D28874212. Pull Request resolved: https://github.com/pytorch/pytorch/pull/59481 Test Plan: Sandcastle Reviewed By: ngimel Differential Revision: D28909681 fbshipit-source-id: ec9ab1bd602933238d9d0f73d4d8d027b75d9d85
This commit is contained in:
committed by
Facebook GitHub Bot
parent
804f924504
commit
e3d75b8475
@ -222,7 +222,7 @@ PyObject *THPEngine_run_backward(PyObject *self, PyObject *args, PyObject *kwarg
|
||||
if (inputs != nullptr) {
|
||||
int num_inputs = PyTuple_GET_SIZE(inputs);
|
||||
output_edges.reserve(num_inputs);
|
||||
for (int i = 0; i < num_inputs; ++i) {
|
||||
for (const auto i : c10::irange(num_inputs)) {
|
||||
PyObject *input = PyTuple_GET_ITEM(inputs, i);
|
||||
THPUtils_assert(THPVariable_Check(input),
|
||||
"all inputs have to be Tensors, but got %s", THPUtils_typename(input));
|
||||
|
Reference in New Issue
Block a user