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

[luci-interpreter] Add a feature to infer the output shape #12980

Merged
merged 2 commits into from May 13, 2024

Conversation

shs-park
Copy link
Contributor

@shs-park shs-park commented May 10, 2024

This PR makes a new interface getOutputTensorSize in the luci-interpreter.
This is to get the size of actual output size from the _runtime_module, which has the inferred and calculated output shape during the interprete process.


for issue #12979
from draft #12981

This PR allows the interpreter to determine the unknown output shape,
when it is able to infer the output shape.
As a result, the output value of the inferred unknown shape can also be output.

Signed-off-by: Seungho Henry Park <shs.park@samsung.com>
@shs-park shs-park requested a review from a team May 10, 2024 08:09
@shs-park shs-park self-assigned this May 10, 2024
Comment on lines 139 to 140
std::vector<char> output_data(getTensorSize(output_node));
size_t output_size = interpreter.getOutputTensorSize(output_node);
std::vector<char> output_data(output_size);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change to get the size of output_node from the runtime module, not from the shape of origin model.
The runtime module can have inferred shape which is determined in interpreting process.

@seanshpark
Copy link
Contributor

plz split circle-interpreter and luci-interpreter changes to separate PRs.

Signed-off-by: Seungho Henry Park <shs.park@samsung.com>
@shs-park
Copy link
Contributor Author

plz split circle-interpreter and luci-interpreter changes to separate PRs.

@seanshpark,
Now the luci-interpreter part was extracted.

if (tensor == nullptr)
{
const std::string &name = output_node->name();
throw std::runtime_error("Cannot find tensor size for output node named \"" + name + "\".");
Copy link
Contributor

Choose a reason for hiding this comment

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

NOTE other methods in this file uses throw std::runtime_error() for failure exit.

Copy link
Contributor

@seanshpark seanshpark left a comment

Choose a reason for hiding this comment

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

LGTM

@seanshpark seanshpark requested a review from a team May 10, 2024 09:18
@shs-park shs-park added the PR/ready for review It is ready to review. Please review it. label May 13, 2024
@shs-park shs-park requested review from a team and removed request for a team May 13, 2024 03:10
Copy link
Contributor

@zetwhite zetwhite left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jinevening
Copy link
Contributor

PTAL https://github.com/Samsung/ONE/pull/12981/files#r1598051074

Copy link
Contributor

@jinevening jinevening left a comment

Choose a reason for hiding this comment

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

@jinevening jinevening merged commit 06e888a into Samsung:master May 13, 2024
6 checks passed
@shs-park shs-park deleted the luci-interpreter-infer-shape branch May 14, 2024 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR/ready for review It is ready to review. Please review it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants