Skip to content

Add floatValue to ExecuTorch value #10823

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

Merged
merged 1 commit into from
May 13, 2025

Conversation

f-meloni
Copy link
Contributor

@f-meloni f-meloni commented May 12, 2025

Summary:
I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Differential Revision: D74603334

cc @mergennachin @byjlw

@f-meloni f-meloni requested a review from shoumikhin as a code owner May 12, 2025 20:38
Copy link

pytorch-bot bot commented May 12, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/10823

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⏳ No Failures, 4 Pending

As of commit 4120a69 with merge base e7ec913 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 12, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74603334

@f-meloni
Copy link
Contributor Author

@pytorchbot label "module: user experience"

@pytorch-bot pytorch-bot bot added the module: user experience Issues related to reducing friction for users label May 12, 2025
@f-meloni f-meloni force-pushed the export-D74603334 branch from f31e8ed to 8b5d2b0 Compare May 12, 2025 20:54
f-meloni pushed a commit to f-meloni/executorch that referenced this pull request May 12, 2025
Summary:

I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Reviewed By: shoumikhin

Differential Revision: D74603334
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74603334

@@ -40,6 +40,8 @@ typedef NSInteger ExecuTorchIntegerValue
NS_SWIFT_BRIDGED_TYPEDEF NS_SWIFT_NAME(IntegerValue);
typedef double ExecuTorchDoubleValue
NS_SWIFT_BRIDGED_TYPEDEF NS_SWIFT_NAME(DoubleValue);
typedef double ExecuTorchFloatValue
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
typedef double ExecuTorchFloatValue
typedef float ExecuTorchFloatValue

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be float?

/**
* Returns YES if the value is a float.
*
* @return A BOOL indicating whether the value is a double.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @return A BOOL indicating whether the value is a double.
* @return A BOOL indicating whether the value is a float.

Comment on lines 106 to 108
* The integer value if the tag is ExecuTorchValueTagFloat.
*
* @return An NSInteger representing the float value.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* The integer value if the tag is ExecuTorchValueTagFloat.
*
* @return An NSInteger representing the float value.
* The float value if the tag is ExecuTorchValueTagDouble.
*
* @return A float representing the float value.

@f-meloni f-meloni force-pushed the export-D74603334 branch from 8b5d2b0 to 6bcb611 Compare May 13, 2025 12:57
f-meloni pushed a commit to f-meloni/executorch that referenced this pull request May 13, 2025
Summary:

I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Reviewed By: shoumikhin

Differential Revision: D74603334
f-meloni pushed a commit to f-meloni/executorch that referenced this pull request May 13, 2025
Summary:

I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Reviewed By: shoumikhin

Differential Revision: D74603334
@f-meloni f-meloni force-pushed the export-D74603334 branch from 6bcb611 to 0a46aaa Compare May 13, 2025 12:58
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74603334

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74603334

f-meloni pushed a commit to f-meloni/executorch that referenced this pull request May 13, 2025
Summary:
Pull Request resolved: pytorch#10823

I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Reviewed By: shoumikhin

Differential Revision: D74603334
@f-meloni f-meloni force-pushed the export-D74603334 branch 2 times, most recently from 1e80fec to 3d0b1af Compare May 13, 2025 14:23
f-meloni pushed a commit to f-meloni/executorch that referenced this pull request May 13, 2025
Summary:

I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Reviewed By: shoumikhin

Differential Revision: D74603334
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74603334

@@ -40,6 +40,8 @@ typedef NSInteger ExecuTorchIntegerValue
NS_SWIFT_BRIDGED_TYPEDEF NS_SWIFT_NAME(IntegerValue);
typedef double ExecuTorchDoubleValue
NS_SWIFT_BRIDGED_TYPEDEF NS_SWIFT_NAME(DoubleValue);
typedef float ExecuTorchFloatValue
Copy link
Contributor

@shoumikhin shoumikhin May 13, 2025

Choose a reason for hiding this comment

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

nit: fix indentation?

@@ -88,6 +88,12 @@ - (ExecuTorchDoubleValue)doubleValue {
return [(ExecuTorchScalarValue)_value doubleValue];
}

- (ExecuTorchFloatValue)floatValue {
ET_CHECK(self.isFloat);
// EValue does not have a separate tag for float.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment belongs to isFloat implementation?

f-meloni pushed a commit to f-meloni/executorch that referenced this pull request May 13, 2025
Summary:

I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Reviewed By: shoumikhin

Differential Revision: D74603334
@f-meloni f-meloni force-pushed the export-D74603334 branch from 3d0b1af to 2405f6f Compare May 13, 2025 14:40
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74603334

f-meloni pushed a commit to f-meloni/executorch that referenced this pull request May 13, 2025
Summary:
Pull Request resolved: pytorch#10823

I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Reviewed By: shoumikhin

Differential Revision: D74603334
@f-meloni f-meloni force-pushed the export-D74603334 branch from 2405f6f to e33b392 Compare May 13, 2025 14:43
@f-meloni
Copy link
Contributor Author

@pytorchbot label "release notes: api"

@pytorch-bot pytorch-bot bot added the release notes: api Changes to public facing apis (any interfaces, pybinded runtime methods, etc.) label May 13, 2025
f-meloni pushed a commit to f-meloni/executorch that referenced this pull request May 13, 2025
Summary:

I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Reviewed By: shoumikhin

Differential Revision: D74603334
@f-meloni f-meloni force-pushed the export-D74603334 branch from e33b392 to 2adfa17 Compare May 13, 2025 15:54
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74603334

f-meloni pushed a commit to f-meloni/executorch that referenced this pull request May 13, 2025
Summary:
Pull Request resolved: pytorch#10823

I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Reviewed By: shoumikhin

Differential Revision: D74603334
@f-meloni f-meloni force-pushed the export-D74603334 branch from 2adfa17 to 1f167ca Compare May 13, 2025 15:58
Summary:

I think we can have an utility to return floats back.
I would not create a new tag, but just use the double value and return it as float if the user needs float

Reviewed By: shoumikhin

Differential Revision: D74603334
@f-meloni f-meloni force-pushed the export-D74603334 branch from 1f167ca to 4120a69 Compare May 13, 2025 15:58
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74603334

@facebook-github-bot facebook-github-bot merged commit 3ffe697 into pytorch:main May 13, 2025
87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported module: user experience Issues related to reducing friction for users release notes: api Changes to public facing apis (any interfaces, pybinded runtime methods, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants