[functorch] fix possible overflow (#83389)

Fix some errors detected by static analysis.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/83389
Approved by: https://github.com/zou3519
This commit is contained in:
cyy
2022-11-29 00:55:32 +00:00
committed by PyTorch MergeBot
parent 63843401f5
commit 4b11119cc3

View File

@ -1158,7 +1158,7 @@ struct EnableAllLayers {
}
}
private:
int64_t levels_start_;
int64_t levels_start_{};
Slice<py::hdl<Dim>> levels_to_dim_;
};
@ -2687,7 +2687,7 @@ static PyObject* py_stack(PyObject *_,
auto d = _wrap_dim(dim, ndim, false);
auto idx = result_levels.index(d);
if (!idx) {
py::raise_error(PyExc_TypeError, "Dimension %R does not exist in inputs", dim);
py::raise_error(PyExc_TypeError, "Dimension %R does not exist in inputs", dim.ptr());
}
rawdim = *idx;
}