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

Adding support for Big Endian in decode_raw_op_test #6689

Merged
merged 1 commit into from
Jan 24, 2017

Conversation

Nayana-ibm
Copy link
Contributor

Adding support for Big Endian in decode_raw_op_test

@tensorflow-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@Nayana-ibm
Copy link
Contributor Author

Decode_raw_op test fails on big endian with an error "Unimplemented support for little_endian=true".
As per comments, we have made changes in decode_raw and created a new PR for ongoing discussion on this.

@rohan100jain
Copy link
Member

I took a quick look at this PR and my only concern is that there doesn't seem to be any handling of the little_endian_ attribute in the OP code. What if little_endian_ is false (indicating that the data is little endian) but the system is different (say big endian). I think that case isn't perhaps handled. If the type of the data and system match then I think this code should do the job.

Adding Andrew as well.

@drpngx drpngx added the stat:awaiting response Status - Awaiting response from author label Jan 9, 2017
@Nayana-ibm
Copy link
Contributor Author

@rohan100jain @drpngx Other solution we could think is to add check for little endian platform.
Below is the patch:

--- a/tensorflow/core/kernels/decode_raw_op.cc
+++ b/tensorflow/core/kernels/decode_raw_op.cc
@@ -69,6 +69,15 @@ class DecodeRawOp : public OpKernel {
         context, context->allocate_output("output", out_shape, &output_tensor));
     auto out = output_tensor->flat_inner_dims<T>();
     DCHECK_EQ(flat_in.size(), out.dimensions()[0]);
+
+    if (::tensorflow::port::kLittleEndian) {
      OP_REQUIRES(
        context,
        little_endian_ == ::tensorflow::port::kLittleEndian || sizeof(T) == 1,
        errors::Unimplemented("Unimplemented support for little_endian=",
                              little_endian_ ? "true" : "false"));
+    }
   // Endianness matches, so just copy each string byte-for-byte.

@drpngx
Copy link
Contributor

drpngx commented Jan 13, 2017

Patch look strange, there's a sizeof = 1 that's not used because of the if conditional?

@Nayana-ibm
Copy link
Contributor Author

@drpngx
Decode_raw_op test was failing on big endian due to following assert:

OP_REQUIRES(
        context,
        little_endian_ == ::tensorflow::port::kLittleEndian || sizeof(T) == 1,
        errors::Unimplemented("Unimplemented support for little_endian=",
                              little_endian_ ? "true" : "false"));

With our PR, we tried to remove the above assert assuming that type of data and the system match.
However, as @rohan100jain commented, we could think of above patch. Through if condition, assert will be skipped only on big endian and would not hamper original functionality.

Can you think of better way to handle the above scenario?

@drpngx
Copy link
Contributor

drpngx commented Jan 16, 2017

The test basically says that it's not implemented. Maybe it's stale. Does it pass all tests?

@Nayana-ibm
Copy link
Contributor Author

@drpngx All tests are passing at our end with above mentioned patch.
Should we modify PR so that you could trigger a build?

@drpngx
Copy link
Contributor

drpngx commented Jan 17, 2017

Jenkins, test this please.

@drpngx
Copy link
Contributor

drpngx commented Jan 17, 2017

Not sure if @aselle has more context. The test was written to mean that anything other than little endian doesn't work, but I guess if it works for you, then I am for removing the check altogether, if it also has a reasonable chance of working with middle endian.

@Nayana-ibm
Copy link
Contributor Author

@aselle @drpngx Please let me know your comments.

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

drpngx commented Jan 24, 2017

Sorry for the delay. Thinking about this, it's the right thing to delete the test since you have tested it and it's obsolete. The case we don't cover is middle endian but I don't think we need to worry about this now.

@drpngx drpngx merged commit bd970e0 into tensorflow:master Jan 24, 2017
benoitsteiner pushed a commit to benoitsteiner/tensorflow that referenced this pull request Jan 27, 2017
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.

5 participants