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

add Rint operation #4113

Merged
merged 4 commits into from
Nov 16, 2016
Merged

add Rint operation #4113

merged 4 commits into from
Nov 16, 2016

Conversation

Mistobaan
Copy link
Contributor

@Mistobaan Mistobaan commented Aug 31, 2016

Based on previous work: https://github.com/tensorflow/tensorflow/pull/1288/files
and from a comment on #3730. Fixes #3730.

@tensorflow-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@martinwicke
Copy link
Member

There are conflicts, have you rebased already?

@@ -19373,6 +19373,27 @@ op {
}
}
op {
name: "Rint"
Copy link

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

@Mistobaan Mistobaan force-pushed the features/rint-op branch 2 times, most recently from 3cacde5 to fc5806b Compare September 1, 2016 21:09
@Mistobaan
Copy link
Contributor Author

@martinwicke @girving I addressed all the changes proposed.


#include "tensorflow/core/kernels/cwise_ops_gpu_common.cu.h"


Copy link
Contributor

Choose a reason for hiding this comment

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

Only one blank line.

@rmlarsen
Copy link
Member

rmlarsen commented Sep 3, 2016

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.

@teamdandelion teamdandelion added the stat:awaiting response Status - Awaiting response from author label Sep 6, 2016
@vrv vrv added stat:awaiting response Status - Awaiting response from author and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Nov 3, 2016
@martinwicke
Copy link
Member

I think you have to add the added .cc files to the list of files compiled by makefile.

@petewarden to confirm where exactly.

@petewarden
Copy link
Contributor

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:
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/makefile/Makefile#L423

I also see other files in tensorflow/core/platform being compiled and linked in, looking at the logs:
https://ci.tensorflow.org/job/tensorflow-pull-requests-makefile/6255/consoleFull

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.

@vrv
Copy link

vrv commented Nov 4, 2016

ping for @petewarden and @Mistobaan

@vrv
Copy link

vrv commented Nov 9, 2016

Friendly ping -- it would be lovely to get this in.

@Mistobaan
Copy link
Contributor Author

@vrv I was able to reproduce and fix the error ( setround.cc had to be manually added to a dependency text file).

@vrv
Copy link

vrv commented Nov 13, 2016

@tensorflow-jenkins test this please

(WoohoooooO!)

@Mistobaan
Copy link
Contributor Author

now the windows cmake build is failing ... I can't help with that. I don't have a win machine.

@drpngx
Copy link
Contributor

drpngx commented Nov 14, 2016

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
Copy link
Contributor

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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

@rmlarsen rmlarsen assigned drpngx and unassigned rmlarsen Nov 14, 2016
@Mistobaan
Copy link
Contributor Author

@drpngx rebased and addressed the proposed changes.

@drpngx
Copy link
Contributor

drpngx commented Nov 16, 2016

Jenkins, test this please.

@drpngx drpngx added awaiting testing (then merge) and removed stat:awaiting response Status - Awaiting response from author labels Nov 16, 2016
@drpngx
Copy link
Contributor

drpngx commented Nov 16, 2016

Something broken with the makefile, will have to try again later.

@rmlarsen
Copy link
Member

@gunan it looks like the makefile issue is unrelated. Can we merge this?

@gunan
Copy link
Contributor

gunan commented Nov 16, 2016

Yes, the failure looks like a flake. We can go ahead and merge.

@rmlarsen rmlarsen merged commit 8f32013 into tensorflow:master Nov 16, 2016
@Mistobaan Mistobaan deleted the features/rint-op branch January 22, 2017 19:49
@carlorosati
Copy link

carlorosati commented Feb 6, 2017

Is it really std::fesetround or is it just fesetround?

I received the following ERROR when building.

ERROR: /local/tmp/tensorflow/tensorflow/core/BUILD:1036:1: C++ compilation of rule '//tensorflow/core:lib_internal' failed: gcc failed: error executing command /local2/tmp/brew/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/local2/tmp/brew/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 ... (remaining 104 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
tensorflow/core/platform/setround.cc: In constructor 'tensorflow::port::ScopedSetRound::ScopedSetRound()':
tensorflow/core/platform/setround.cc:27:4: error: 'fesetround' is not a member of 'std'
    std::fesetround(FE_TONEAREST);
    ^
tensorflow/core/platform/setround.cc:27:4: note: suggested alternative:
In file included from tensorflow/core/platform/setround.cc:19:0:
/local2/tmp/brew/include/fenv.h:88:12: note:   'fesetround'
 extern int fesetround (int __rounding_direction) __THROW;
            ^
Target //tensorflow/tools/pip_package:build_pip_package failed to build

EDIT:
On further inspection, the problem seems to be that gcc is being used to compile a C++ file.. I have opened issue #7289

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.