mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
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
This commit is contained in:
parent
8444fe019a
commit
3f63f2bced
2 changed files with 4 additions and 4 deletions
|
|
@ -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<at::Tensor>, toOptional<at::Tensor>)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue