Skip to content

Commit

Permalink
c10::string_view -> std::string_view in executorch
Browse files Browse the repository at this point in the history
Differential Revision: D67312326

Pull Request resolved: #7375
  • Loading branch information
r-barnes authored Dec 19, 2024
1 parent c337bef commit f341da8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion backends/vulkan/test/op_tests/utils/aten_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
OPT_LAYOUT = "::std::optional<at::Layout>"
OPT_MEMORY_FORMAT = "::std::optional<at::MemoryFormat>"
OPT_SCALAR_TYPE = "::std::optional<at::ScalarType>"
STRING = "c10::string_view"
STRING = "std::string_view"
OLD_STRING = "c10::string_view"
TWO_TENSOR_TUPLE = "::std::tuple<at::Tensor,at::Tensor>"
THREE_TENSOR_TUPLE = "::std::tuple<at::Tensor,at::Tensor,at::Tensor>"
TENSOR_VECTOR = "::std::vector<at::Tensor>"
3 changes: 2 additions & 1 deletion backends/vulkan/test/op_tests/utils/gen_computegraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
BOOL,
DOUBLE,
INT,
OLD_STRING,
OPT_AT_DOUBLE_ARRAY_REF,
OPT_AT_INT_ARRAY_REF,
OPT_AT_TENSOR,
Expand Down Expand Up @@ -398,7 +399,7 @@ def create_value_for( # noqa: C901
or ref.src_cpp_type == OPT_MEMORY_FORMAT
):
ret_str += "add_none(); \n"
elif ref.src_cpp_type == STRING:
elif ref.src_cpp_type == STRING or ref.src_cpp_type == OLD_STRING:
ret_str += f"add_string(std::string({ref.src_cpp_name})); \n"
elif ref.src_cpp_type == TWO_TENSOR_TUPLE:
ret_str += f"add_value_list({{{ref.name}_first, {ref.name}_second}}); \n"
Expand Down
5 changes: 3 additions & 2 deletions backends/vulkan/test/op_tests/utils/gen_correctness_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
BOOL,
DOUBLE,
INT,
OLD_STRING,
OPT_AT_DOUBLE_ARRAY_REF,
OPT_AT_INT_ARRAY_REF,
OPT_AT_TENSOR,
Expand Down Expand Up @@ -192,8 +193,8 @@ def create_input_data(self, arg: Argument, data: Any) -> str: # noqa: C901
ret_str += "std::nullopt;"
else:
ret_str += f"{str(data)};"
elif cpp_type == STRING:
ret_str += f'c10::string_view("{data}");'
elif cpp_type == STRING or cpp_type == OLD_STRING:
ret_str += f'std::string_view("{data}");'
elif (
cpp_type == OPT_SCALAR_TYPE
or cpp_type == OPT_LAYOUT
Expand Down
2 changes: 1 addition & 1 deletion runtime/core/exec_aten/exec_aten.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ using TensorShapeDynamism = executorch::runtime::TensorShapeDynamism;
using Tensor = at::Tensor;
using TensorList = at::TensorList;
using TensorImpl = at::TensorImpl;
using string_view = c10::string_view;
using string_view = std::string_view;
template <typename T>
using ArrayRef = c10::ArrayRef<T>;
template <typename T>
Expand Down

0 comments on commit f341da8

Please sign in to comment.