diff --git a/test/cpp/jit/source_range_test.cpp b/test/cpp/jit/source_range_test.cpp index 16c7f850bf2..4cbb58ddda6 100644 --- a/test/cpp/jit/source_range_test.cpp +++ b/test/cpp/jit/source_range_test.cpp @@ -9,7 +9,7 @@ TEST(SourceRangeTest, test_find) { strings.push_back(std::make_shared("hello world")); strings.push_back(std::make_shared("nihaoma")); - std::vector pieces{*strings[0], *strings[1]}; + std::vector pieces{*strings[0], *strings[1]}; StringCordView view(pieces, strings); @@ -22,7 +22,7 @@ TEST(SourceRangeTest, test_substr) { strings.push_back(std::make_shared("hello world")); strings.push_back(std::make_shared("nihaoma")); - std::vector pieces{*strings[0], *strings[1]}; + std::vector pieces{*strings[0], *strings[1]}; StringCordView view(pieces, strings); @@ -36,7 +36,7 @@ TEST(SourceRangeTest, test_iter) { strings.push_back(std::make_shared("hello world")); strings.push_back(std::make_shared("nihaoma")); - std::vector pieces{*strings[0], *strings[1]}; + std::vector pieces{*strings[0], *strings[1]}; StringCordView view(pieces, strings); diff --git a/test/cpp/jit/test_class_import.cpp b/test/cpp/jit/test_class_import.cpp index e16746c798a..08c0742a3ff 100644 --- a/test/cpp/jit/test_class_import.cpp +++ b/test/cpp/jit/test_class_import.cpp @@ -9,7 +9,7 @@ namespace torch { namespace jit { -static constexpr c10::string_view classSrcs1 = R"JIT( +static constexpr std::string_view classSrcs1 = R"JIT( class FooNestedTest: def __init__(self, y): self.y = y @@ -26,7 +26,7 @@ class FooTest: self.x = self.class_attr.y + self.class_attr2.y )JIT"; -static constexpr c10::string_view classSrcs2 = R"JIT( +static constexpr std::string_view classSrcs2 = R"JIT( class FooTest: def __init__(self, x): self.dx = x @@ -134,7 +134,7 @@ TEST(ClassImportTest, ClassDerive) { ASSERT_TRUE(newCls2->findMethod(method->name())); } -static constexpr c10::string_view torchbindSrc = R"JIT( +static constexpr std::string_view torchbindSrc = R"JIT( class FooBar1234(Module): __parameters__ = [] f : __torch__.torch.classes._TorchScriptTesting._StackString diff --git a/test/cpp/jit/test_class_parser.cpp b/test/cpp/jit/test_class_parser.cpp index 2cd08261d4b..141c1ba68af 100644 --- a/test/cpp/jit/test_class_parser.cpp +++ b/test/cpp/jit/test_class_parser.cpp @@ -5,7 +5,7 @@ namespace torch { namespace jit { -constexpr c10::string_view testSource = R"JIT( +constexpr std::string_view testSource = R"JIT( class FooTest: def __init__(self, x): self.x = x diff --git a/test/cpp/jit/test_interface.cpp b/test/cpp/jit/test_interface.cpp index 8f6648fdcb6..7ec06ae1d5a 100644 --- a/test/cpp/jit/test_interface.cpp +++ b/test/cpp/jit/test_interface.cpp @@ -23,7 +23,7 @@ def forward(self, x: Tensor) -> Tensor: return self.subMod.forward(x) )JIT"; -static constexpr c10::string_view moduleInterfaceSrc = R"JIT( +static constexpr std::string_view moduleInterfaceSrc = R"JIT( class OneForward(ModuleInterface): def one(self, x: Tensor, y: Tensor) -> Tensor: pass diff --git a/test/cpp/jit/test_module_api.cpp b/test/cpp/jit/test_module_api.cpp index 5341885dd66..2300014eceb 100644 --- a/test/cpp/jit/test_module_api.cpp +++ b/test/cpp/jit/test_module_api.cpp @@ -13,7 +13,7 @@ namespace torch { namespace jit { -static constexpr c10::string_view moduleInterfaceSrc = R"JIT( +static constexpr std::string_view moduleInterfaceSrc = R"JIT( class OneInterface(ModuleInterface): def one(self, x: Tensor, y: Tensor) -> Tensor: pass diff --git a/torch/csrc/jit/frontend/source_range.cpp b/torch/csrc/jit/frontend/source_range.cpp index 5e524aeae87..05067ac80f9 100644 --- a/torch/csrc/jit/frontend/source_range.cpp +++ b/torch/csrc/jit/frontend/source_range.cpp @@ -14,7 +14,7 @@ StringCordView::StringCordView() { } StringCordView::StringCordView( - std::vector inputs, + std::vector inputs, std::vector> ownerships) : pieces_(std::move(inputs)), owned_strings_(std::move(ownerships)) { accumulated_sizes_.push_back(0); @@ -70,7 +70,7 @@ size_t StringCordView::find_regex(const std::string& tok, size_t start) const { } StringCordView StringCordView::substr(size_t start, size_t size) const { - std::vector pieces; + std::vector pieces; std::vector> ownerships; if (start >= this->size()) { // out of bounds diff --git a/torch/csrc/jit/frontend/source_range.h b/torch/csrc/jit/frontend/source_range.h index bde2f1803ae..4e36f31f0e0 100644 --- a/torch/csrc/jit/frontend/source_range.h +++ b/torch/csrc/jit/frontend/source_range.h @@ -22,7 +22,7 @@ struct TORCH_API StringCordView { StringCordView(const StringCordView&) = default; StringCordView(StringCordView&&) noexcept = default; StringCordView( - std::vector inputs, + std::vector inputs, std::vector> ownerships); StringCordView& operator=(const StringCordView&) = default; @@ -171,7 +171,7 @@ struct TORCH_API StringCordView { Iterator iter_for_pos(size_t pos) const; private: - std::vector pieces_; + std::vector pieces_; std::vector accumulated_sizes_; std::vector> owned_strings_; }; diff --git a/torch/csrc/jit/frontend/tracer.cpp b/torch/csrc/jit/frontend/tracer.cpp index a913d2c3780..7049b681e7e 100644 --- a/torch/csrc/jit/frontend/tracer.cpp +++ b/torch/csrc/jit/frontend/tracer.cpp @@ -659,13 +659,13 @@ void addInputs( const std::optional& value) { detail::genericAddOptionalInput(n, name, value); } -void addInputs(Node* n, const char* name, const c10::string_view value) { +void addInputs(Node* n, const char* name, const std::string_view value) { detail::genericAddInput(n, std::string(value)); } void addInputs( Node* n, const char* name, - const std::optional& value) { + const std::optional& value) { detail::genericAddOptionalInput(n, name, value); } void addInputs(Node* n, const char* name, const at::Tensor& value) { diff --git a/torch/csrc/jit/frontend/tracer.h b/torch/csrc/jit/frontend/tracer.h index 885bb790fdf..dbfc6faa88c 100644 --- a/torch/csrc/jit/frontend/tracer.h +++ b/torch/csrc/jit/frontend/tracer.h @@ -305,11 +305,11 @@ TORCH_API void addInputs( TORCH_API void addInputs( Node* n, const char* name, - const c10::string_view value); + const std::string_view value); TORCH_API void addInputs( Node* n, const char* name, - const std::optional& value); + const std::optional& value); TORCH_API void addInputs(Node* n, const char* name, at::Device value); TORCH_API void addInputs(Node* n, const char* name, c10::Stream stream); TORCH_API void addInputs(Node* n, const char* name, at::Layout value); diff --git a/torch/csrc/jit/mobile/type_parser.cpp b/torch/csrc/jit/mobile/type_parser.cpp index 091a0dc1a69..de479c4fed8 100644 --- a/torch/csrc/jit/mobile/type_parser.cpp +++ b/torch/csrc/jit/mobile/type_parser.cpp @@ -182,7 +182,7 @@ TypePtr TypeParser::parse() { // ] // ]" TypePtr TypeParser::parseNamedTuple(const std::string& qualified_name) { - std::vector field_names; + std::vector field_names; std::vector field_types; expect(","); expect("["); @@ -282,7 +282,7 @@ void TypeParser::expect(const char* s) { advance(); } -// c10::string_view::operator== calls memcmp to compare against the target +// std::string_view::operator== calls memcmp to compare against the target // string; we can do better if we specialize for a single character. void TypeParser::expectChar(char c) { std::string_view token = cur(); diff --git a/torch/csrc/jit/runtime/static/ops.cpp b/torch/csrc/jit/runtime/static/ops.cpp index 99cd568754d..60fca2f8706 100644 --- a/torch/csrc/jit/runtime/static/ops.cpp +++ b/torch/csrc/jit/runtime/static/ops.cpp @@ -1900,7 +1900,7 @@ REGISTER_OPERATOR_FUNCTOR(aten::div, aten_div, [](Node* n) -> SROperator { const auto& in0_t = p_node->Input(0).toTensor(); std::optional rounding_mode = std::nullopt; if (p_node->num_inputs() > 2) { - rounding_mode = p_node->Input(2).toOptional(); + rounding_mode = p_node->Input(2).toOptional(); } const auto& in1_t = p_node->Input(1).isTensor() ? p_node->Input(1).toTensor()