Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions paddle/fluid/pybind/op_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static inline void HandleViewBetweenInputAndOutput(

auto* view_output_tensor =
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);

VLOG(3) << "Perform View between Output Var(" << view_output_var->Name()
Expand Down Expand Up @@ -314,7 +314,7 @@ static inline void CastPyArg2AttrString(
Py_ssize_t size;
const char* data;
data = PyUnicode_AsUTF8AndSize(obj, &size);
attrs[key] = std::string(data, (size_t)size);
attrs[key] = std::string(data, static_cast<size_t>(size));
} else {
PADDLE_THROW(platform::errors::InvalidArgument(
"%s(): argument (position %d) must be "
Expand Down Expand Up @@ -674,7 +674,7 @@ static inline void CastPyArg2AttrStrings(
Py_ssize_t size;
const char* data;
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 {
PADDLE_THROW(platform::errors::InvalidArgument(
"%s(): argument (position %d) must be "
Expand Down Expand Up @@ -737,7 +737,7 @@ static inline void ConstructAttrMapFromPyArgs(
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);
if (iter == attr_type_map->end()) {
continue;
Expand Down