mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
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:
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user