未验证 提交 81349970 编写于 作者: F Feiyu Chan 提交者: GitHub

use ShareBufferWith instead of ShareDataWith for ops with view mechanism (#37464)

上级 e91141fb
...@@ -188,7 +188,7 @@ static inline void HandleViewBetweenInputAndOutput( ...@@ -188,7 +188,7 @@ static inline void HandleViewBetweenInputAndOutput(
auto* view_output_tensor = auto* view_output_tensor =
view_output_var->MutableVar()->GetMutable<framework::LoDTensor>(); view_output_var->MutableVar()->GetMutable<framework::LoDTensor>();
view_output_tensor->ShareDataWith(input_tensor); view_output_tensor->ShareBufferWith(input_tensor);
view_output_tensor->ShareInplaceVersionCounterWith(input_tensor); view_output_tensor->ShareInplaceVersionCounterWith(input_tensor);
VLOG(3) << "Perform View between Output Var(" << view_output_var->Name() VLOG(3) << "Perform View between Output Var(" << view_output_var->Name()
...@@ -314,7 +314,7 @@ static inline void CastPyArg2AttrString( ...@@ -314,7 +314,7 @@ static inline void CastPyArg2AttrString(
Py_ssize_t size; Py_ssize_t size;
const char* data; const char* data;
data = PyUnicode_AsUTF8AndSize(obj, &size); data = PyUnicode_AsUTF8AndSize(obj, &size);
attrs[key] = std::string(data, (size_t)size); attrs[key] = std::string(data, static_cast<size_t>(size));
} else { } else {
PADDLE_THROW(platform::errors::InvalidArgument( PADDLE_THROW(platform::errors::InvalidArgument(
"%s(): argument (position %d) must be " "%s(): argument (position %d) must be "
...@@ -674,7 +674,7 @@ static inline void CastPyArg2AttrStrings( ...@@ -674,7 +674,7 @@ static inline void CastPyArg2AttrStrings(
Py_ssize_t size; Py_ssize_t size;
const char* data; const char* data;
data = PyUnicode_AsUTF8AndSize(item, &size); data = PyUnicode_AsUTF8AndSize(item, &size);
value.emplace_back(std::string(data, (size_t)size)); value.emplace_back(std::string(data, static_cast<size_t>(size)));
} else { } else {
PADDLE_THROW(platform::errors::InvalidArgument( PADDLE_THROW(platform::errors::InvalidArgument(
"%s(): argument (position %d) must be " "%s(): argument (position %d) must be "
...@@ -737,7 +737,7 @@ static inline void ConstructAttrMapFromPyArgs( ...@@ -737,7 +737,7 @@ static inline void ConstructAttrMapFromPyArgs(
op_type, arg_pos, ((PyTypeObject*)obj->ob_type)->tp_name)); // NOLINT op_type, arg_pos, ((PyTypeObject*)obj->ob_type)->tp_name)); // NOLINT
} }
std::string key(key_ptr, (size_t)key_len); std::string key(key_ptr, static_cast<size_t>(key_len));
auto iter = attr_type_map->find(key); auto iter = attr_type_map->find(key);
if (iter == attr_type_map->end()) { if (iter == attr_type_map->end()) {
continue; continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册