Skip to content

added image patch grad - #3672

Merged
benoitsteiner merged 3 commits into
tensorflow:masterfrom
nikhilmishra000:extract_image_patches_grad
Aug 10, 2016
Merged

benoitsteiner merged 3 commits into
tensorflow:masterfrom
nikhilmishra000:extract_image_patches_grad

Conversation

@nikhilmishra000

Copy link
Copy Markdown
Contributor

This solves: #2921

I ran unit tests using tensorflow.python.ops.gradient_checker to verify that it works :D

@tensorflow-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?



@ops.RegisterGradient("ExtractImagePatches")
def _ExtractImagePatchesGrad(op, grad):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contribution, this looks pretty good. Can you add a regression test to make sure the code is correct? You can use https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/kernel_tests/conv2d_backprop_filter_grad_test.py#L25 as an example.

@nikhilmishra000

Copy link
Copy Markdown
Contributor Author

added the tests, let me know if there's anything else

@teamdandelion

Copy link
Copy Markdown

@tensorflow-jenkins test this please

@teamdandelion teamdandelion added the awaiting review Pull request awaiting review label Aug 8, 2016
@benoitsteiner

Copy link
Copy Markdown
Contributor

Jenkins, test this please.

@teamdandelion teamdandelion added stat:awaiting response Status - Awaiting response from author and removed awaiting review Pull request awaiting review labels Aug 8, 2016
@teamdandelion

Copy link
Copy Markdown

The tests are failing :(

@nikhilmishra000

nikhilmishra000 commented Aug 8, 2016 •

Copy link
Copy Markdown
Contributor Author

I'm looking at the logs, and the one that's failing is //tensorflow/tools/test:check_futures_test.
I think it's because my test file "tensorflow/python/kernel_tests/extract_image_patches_grad_test.py" doesn't import "absolute_import"?

Should we let the other two tests finish, and then I'll push the fix? or should I push it now?

@teamdandelion

Copy link
Copy Markdown

Push the fix, and I'll re-trigger the tests.

@teamdandelion

Copy link
Copy Markdown

@tensorflow-jenkins test this please

@teamdandelion teamdandelion added awaiting review Pull request awaiting review and removed stat:awaiting response Status - Awaiting response from author labels Aug 9, 2016
@teamdandelion

Copy link
Copy Markdown

@benoitsteiner Can you LGTM this now that tests were added?

@benoitsteiner
benoitsteiner merged commit 83fe2a5 into tensorflow:master Aug 10, 2016
pad_rows = ((rows_out - 1) * stride_r + ksize_r_eff - rows_in) // 2
pad_cols = ((cols_out - 1) * stride_h + ksize_c_eff - cols_in) // 2

elif padding == 'VALID':

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@gunan

gunan commented Aug 16, 2016

Copy link
Copy Markdown
Contributor

Looks like the BUILD file change for the test is missing from this PR.
Therefore Jenkins did not run the new feature, and I suspect this is broken.
I am investigating now.

@gunan

gunan commented Aug 17, 2016

Copy link
Copy Markdown
Contributor

I am preparing a fix for the issue.
It will be pushed to github later today, or tomorrow.

@mohamedadaly

Copy link
Copy Markdown
Contributor

The current gradient seems to have a problem when batches is None i.e. when using a variable size batches using Keras. Simply added this line

  batch_size = array_ops.shape(op.inputs[0])[0]

after this

  batch_size, rows_in, cols_in, channels = [
    dim.value for dim in op.inputs[0].get_shape()
  ]

and it seems to have fixed the problem. I am new to TensorFlow, so you probably have a better solution than this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review Pull request awaiting review cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants