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

Training Error #15

Open
isadoramsouza opened this issue Sep 1, 2017 · 3 comments
Open

Training Error #15

isadoramsouza opened this issue Sep 1, 2017 · 3 comments

Comments

@isadoramsouza
Copy link

I am trying to reproduce you implementation, but i got this error:

LookupError: No gradient defined for operation 'pool4' (op type: MaxPoolWithArgmax)

How can I solve?

thanks

@okapi1125
Copy link

I also have got the same error.
How can I solve it?
(In the past recent version, this problem didn't occur?)
Thank you.

@isadoramsouza
Copy link
Author

add in model.py:

from tensorflow.python.framework import ops
from tensorflow.python.ops import gen_nn_ops
@ops.RegisterGradient("MaxPoolWithArgmax")
def _MaxPoolWithArgmaxGrad(op, grad, unused_argmax_grad):
  return gen_nn_ops._max_pool_grad(op.inputs[0],
                                   op.outputs[0],
                                   grad,
                                   op.get_attr("ksize"),
                                   op.get_attr("strides"),
                                   padding=op.get_attr("padding"),
                                   data_format='NHWC')

@boyob
Copy link

boyob commented Mar 25, 2019

add in model.py:

from tensorflow.python.framework import ops
from tensorflow.python.ops import gen_nn_ops
@ops.RegisterGradient("MaxPoolWithArgmax")
def _MaxPoolWithArgmaxGrad(op, grad, unused_argmax_grad):
  return gen_nn_ops._max_pool_grad(op.inputs[0],
                                   op.outputs[0],
                                   grad,
                                   op.get_attr("ksize"),
                                   op.get_attr("strides"),
                                   padding=op.get_attr("padding"),
                                   data_format='NHWC')

I did as you said, but I got this error, what should i do?
InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'MaxPoolWithArgmax' with these attrs. Registered devices: [CPU], Registered kernels:
device='GPU'; Targmax in [DT_INT64]; T in [DT_HALF]
device='GPU'; Targmax in [DT_INT64]; T in [DT_FLOAT]

 [[Node: pool1 = MaxPoolWithArgmax[T=DT_FLOAT, Targmax=DT_INT64, ksize=[1, 2, 2, 1], padding="SAME", strides=[1, 2, 2, 1]](conv1/Relu)]]

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

No branches or pull requests

3 participants