[1/N] Deprecate c10::string_view and at::string (#151972)

The calls of `c10::string_view` in the code base are replaced by `std::string_view`. The calls of `at::string` are replaced by `std::string`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/151972
Approved by: https://github.com/malfet
This commit is contained in:
cyy
2025-04-29 07:23:52 +00:00
committed by PyTorch MergeBot
parent a6d19fcfac
commit 41bd0c900a
65 changed files with 228 additions and 226 deletions

View File

@ -63,8 +63,7 @@ void flatten_rec(PyObject* obj, ParsedArgs& args) {
structure.push_back(D::DictClose);
Py_DECREF(dict_items);
} else if (THPUtils_checkString(obj)) {
string str = THPUtils_unpackString(obj);
args.desc.strings.emplace_back(str);
args.desc.strings.emplace_back(THPUtils_unpackString(obj));
args.desc.structure.push_back(D::String);
} else if (THPVariable_Check(obj)) {
auto& var = THPVariable_Unpack(obj);
@ -142,8 +141,8 @@ py::object unflatten_rec(
ArrayRef<Variable>::iterator& var_it,
ArrayRef<Variable>::iterator& var_it_end,
std::string::const_iterator& desc_it,
std::vector<string>::const_iterator& str_it,
std::vector<string>::const_iterator& str_it_end) {
std::vector<std::string>::const_iterator& str_it,
std::vector<std::string>::const_iterator& str_it_end) {
char type = *desc_it++;
if (type == D::TupleOpen) {
std::vector<py::object> objs;