-
Notifications
You must be signed in to change notification settings - Fork 74.2k
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
add Rint operation #4113
add Rint operation #4113
Conversation
Can one of the admins verify this patch? |
There are conflicts, have you rebased already? |
@@ -19373,6 +19373,27 @@ op { | |||
} | |||
} | |||
op { | |||
name: "Rint" |
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.
you can drop this file
3cacde5
to
fc5806b
Compare
@martinwicke @girving I addressed all the changes proposed. |
|
||
#include "tensorflow/core/kernels/cwise_ops_gpu_common.cu.h" | ||
|
||
|
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.
Only one blank line.
One thing to keep in mind is that std::round sets the rounding mode on every call and is significantly slower than std::rint, so it's nice to have this op. |
I think you have to add the added .cc files to the list of files compiled by makefile. @petewarden to confirm where exactly. |
Looks like 'tensorflow/core/platform/setround.cc' isn't being linked in by the makefile. This is surprising, because I would expect the wildcard here to include it in the sources: I also see other files in tensorflow/core/platform being compiled and linked in, looking at the logs: Can you try adding $(warning $TF_CC_SRCS) around line 467 in the Makefile to show what we've calculated? If that's tricky, I can dig into it myself later today. |
ping for @petewarden and @Mistobaan |
Friendly ping -- it would be lovely to get this in. |
0f8f661
to
651fae9
Compare
@vrv I was able to reproduce and fix the error ( setround.cc had to be manually added to a dependency text file). |
@tensorflow-jenkins test this please (WoohoooooO!) |
now the windows cmake build is failing ... I can't help with that. I don't have a win machine. |
Strange, it cannot import tensorflow. Let's see if it was a transient issue. Jenkins, test this please. |
For example: | ||
|
||
``` | ||
rint(-1.5) ==> 0.0 |
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.
Is this right?
@@ -1790,9 +1798,15 @@ def _compare(self, x, use_gpu): | |||
self.assertShapeEqual(np_ceil, oceil) | |||
|
|||
def _testDtype(self, dtype): | |||
data = (np.arange(-3, 3) / 4.).reshape([1, 3, 2]).astype(dtype) |
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.
How come we have to modify current test behavior?
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.
see previous comments. the test is unchanged.
@@ -59,6 +59,7 @@ | |||
@@log1p | |||
@@ceil | |||
@@floor | |||
@@rint |
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.
We're trying to have numpy behavior @aselle
Could you add this example to the unit test?
https://docs.scipy.org/doc/numpy/reference/generated/numpy.rint.html
651fae9
to
9696341
Compare
@drpngx rebased and addressed the proposed changes. |
Jenkins, test this please. |
Something broken with the makefile, will have to try again later. |
@gunan it looks like the makefile issue is unrelated. Can we merge this? |
Yes, the failure looks like a flake. We can go ahead and merge. |
Is it really I received the following ERROR when building.
EDIT: |
Based on previous work: https://github.com/tensorflow/tensorflow/pull/1288/files
and from a comment on #3730. Fixes #3730.