Eliminate c10::stoi,c10::stod,c10::stoull,c10::stoll (#109179)

We can remove these functions in favor of std ones.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/109179
Approved by: https://github.com/colesbury
This commit is contained in:
cyy
2023-09-16 07:22:50 +00:00
committed by PyTorch MergeBot
parent 393fe9339a
commit 852f1b8417
20 changed files with 35 additions and 138 deletions

View File

@ -158,7 +158,7 @@ struct SchemaParser {
// note: an array with a size hint can only occur at the Argument level
fake_type = ListType::create(std::move(fake_type));
real_type = ListType::create(std::move(real_type));
N = c10::stoll(L.expect(TK_NUMBER).text());
N = std::stoll(L.expect(TK_NUMBER).text());
L.expect(']');
auto container = type_parser.parseAliasAnnotation();
if (alias_info) {
@ -245,14 +245,14 @@ struct SchemaParser {
n = L.expect(TK_NUMBER).text();
if (kind == TypeKind::ComplexType || n.find('j') != std::string::npos) {
auto imag = c10::stod(n.substr(0, n.size() - 1));
auto imag = std::stod(n.substr(0, n.size() - 1));
return c10::complex<double>(0, imag);
} else if (
kind == TypeKind::FloatType || n.find('.') != std::string::npos ||
n.find('e') != std::string::npos) {
return c10::stod(n);
return std::stod(n);
} else {
int64_t v = c10::stoll(n);
int64_t v = std::stoll(n);
return v;
}
}