From 3f63f2bcedf86e0c0b48f0e0ebf86554b08d4998 Mon Sep 17 00:00:00 2001 From: cyy Date: Tue, 4 Feb 2025 09:51:36 +0000 Subject: [PATCH] Use std::string_view in tests (#146120) Fixes #ISSUE_NUMBER Pull Request resolved: https://github.com/pytorch/pytorch/pull/146120 Approved by: https://github.com/albanD --- test/edge/Evalue.h | 6 +++--- test/test_overrides.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/edge/Evalue.h b/test/edge/Evalue.h index 7e265756c7e..7038a7bdaa6 100644 --- a/test/edge/Evalue.h +++ b/test/edge/Evalue.h @@ -283,9 +283,9 @@ struct EValue { return tag == Tag::String; } - at::string_view toString() const { + std::string_view toString() const { ET_CHECK_MSG(isString(), "EValue is not a String."); - return at::string_view( + return std::string_view( payload.copyable_union.as_string.data(), payload.copyable_union.as_string.size()); } @@ -452,7 +452,7 @@ EVALUE_DEFINE_TO(at::Scalar, toScalar) EVALUE_DEFINE_TO(int64_t, toInt) EVALUE_DEFINE_TO(bool, toBool) EVALUE_DEFINE_TO(double, toDouble) -EVALUE_DEFINE_TO(at::string_view, toString) +EVALUE_DEFINE_TO(std::string_view, toString) EVALUE_DEFINE_TO(at::ScalarType, toScalarType) EVALUE_DEFINE_TO(at::MemoryFormat, toMemoryFormat) EVALUE_DEFINE_TO(std::optional, toOptional) diff --git a/test/test_overrides.py b/test/test_overrides.py index c2e08df2280..901d652970e 100644 --- a/test/test_overrides.py +++ b/test/test_overrides.py @@ -689,7 +689,7 @@ def generate_tensor_like_override_tests(cls): return torch.float32 elif arg_type == "c10::string_view": return "" - elif arg_type == "std::string_view": + elif arg_type in ("std::string_view", "::std::string_view"): return "" elif arg_type == "SymInt": # TODO: generate actual SymbolicInt