Skip to content

[moco] Do not use reference for dangling variable#15243

Merged
seanshpark merged 1 commit into
Samsung:masterfrom
seanshpark:moco_notuse_ref
Apr 28, 2025
Merged

[moco] Do not use reference for dangling variable#15243
seanshpark merged 1 commit into
Samsung:masterfrom
seanshpark:moco_notuse_ref

Conversation

@seanshpark

Copy link
Copy Markdown
Contributor

This will fix not to use reference for dangling variable inside callee.

This will fix not to use reference for dangling variable inside callee.

ONE-DCO-1.0-Signed-off-by: SaeHie Park <saehie.park@gmail.com>
@seanshpark

seanshpark commented Apr 28, 2025

Copy link
Copy Markdown
Contributor Author

inside callee, local variable is used so using reference would be dangling

  const auto &attr = node.attr().at(attr_name);
  assert(attr.value_case() == tensorflow::AttrValue::kShape);
  return attr.shape();

@seanshpark seanshpark requested a review from a team April 28, 2025 04:31

@shs-park shs-park left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a question, PTAL
=)

if (!plier::tf::has_attrs(node, {"dtype", "value"}))
return false;

const auto &input_tensor = plier::tf::get_tensor_attr(node, "value");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question,
Did this old code trigger a dangling variable error in Ubuntu 24.04?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup :)

@seanshpark seanshpark merged commit a7dd852 into Samsung:master Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants