-
Notifications
You must be signed in to change notification settings - Fork 19.7k
Verify GPU memory consistency for Huber loss (delta=0.5) #21814
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1972,7 +1972,9 @@ def huber(y_true, y_pred, delta=1.0): | |
| delta = ops.convert_to_tensor(delta, dtype=y_pred.dtype) | ||
| error = ops.subtract(y_pred, y_true) | ||
| abs_error = ops.abs(error) | ||
| half = ops.convert_to_tensor(0.5, dtype=abs_error.dtype) | ||
| half = ops.cast(ops.convert_to_tensor(0.5), dtype=abs_error.dtype) | ||
| delta = ops.cast(delta, dtype=abs_error.dtype) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This explicit cast on
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is correct. Everything is cast to |
||
|
|
||
| return ops.mean( | ||
| ops.where( | ||
| abs_error <= delta, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert, this does not change anything. The
dtypeargument ofconvert_to_tensordoes a cast.