-
Notifications
You must be signed in to change notification settings - Fork 77
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
Some problems in running attention.py #5
Comments
Hello,
Thanks for your question!
If you notice this issue thread in tensorflow's git (
tensorflow/tensorflow#2660), they seem to point
out that NCHW format is supported only in GPU and not CPU. So you're
finding this error because I work on NCHW format (comes more naturally for
me from my theano roots) and you seem to run your code on CPU based on your
stack trace.
I'm sorry but I cannot help you more, but point you towards rewriting some
of the functions to make it NHCW format.
N-> No. of images / batch size
H-> Height
C-> Channels
W-> Width.
If I remember correctly, you'd have to change the data format in pool-2d op
and conv2d op to NHCW format, and also preprocess the data such that you
follow this order. Shouldn't be very hard to do.
Hope this helps. Good luck!
Best,
Rithesh
…On Fri, Feb 24, 2017, 1:20 PM JoySiTHU ***@***.***> wrote:
Hi, I cloned your project and try to use it. Your code is fabulous.
However when I run python attention.py
there's always an error appear:
Caused by op 'pool1', defined at:
File ".\attention.py", line 37, in
ctx = tflib.network.im2latex_cnn(X,NUM_FEATS_START,True)
File "D:\THU\challengeCup\im2latex-tensorflow-master\tflib\network.py",
line 77, in im2latex_cnn
X = tflib.ops.max_pool('pool1', X, k=2, s=2)
File "D:\THU\challengeCup\im2latex-tensorflow-master\tflib\ops.py", line
239, in max_pool
padding='SAME', name=name, data_format='NCHW')
File
"C:\Users\Ellen\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_ops.py",
line 1617, in max_pool
name=name)
File
"C:\Users\Ellen\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py",
line 1598, in _max_pool
data_format=data_format, name=name)
File
"C:\Users\Ellen\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py",
line 759, in apply_op
op_def=op_def)
File
"C:\Users\Ellen\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py",
line 2240, in create_op
original_op=self._default_original_op, op_def=op_def)
File
"C:\Users\Ellen\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py",
line 1128, in *init*
self._traceback = _extract_stack()
InvalidArgumentError (see above for traceback): Default MaxPoolingOp only
supports NHWC.
[[Node: pool1 = MaxPoolT=DT_FLOAT, data_format="NCHW", ksize=[1, 1, 2,
2], padding="SAME", strides=[1, 1, 2, 2
], _device="/job:localhost/replica:0/task:0/cpu:0" <http://Relu>]]
Does this mean I'm not preprocess the data properly? Or is there any
possible reasons for this? How can I correct it?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#5>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AG7s5Yk3FaQ4j0XQUQT2TOsYje2dcaLiks5rfovhgaJpZM4MK6yf>
.
|
ghost
closed this as completed
Feb 26, 2017
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I cloned your project and try to use it. Your code is fabulous.
However when I run
python attention.py
there's always an error appear:
Caused by op 'pool1', defined at:
File ".\attention.py", line 37, in
ctx = tflib.network.im2latex_cnn(X,NUM_FEATS_START,True)
File "D:\THU\challengeCup\im2latex-tensorflow-master\tflib\network.py", line 77, in im2latex_cnn
X = tflib.ops.max_pool('pool1', X, k=2, s=2)
File "D:\THU\challengeCup\im2latex-tensorflow-master\tflib\ops.py", line 239, in max_pool
padding='SAME', name=name, data_format='NCHW')
File "C:\Users\Ellen\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 1617, in max_pool
name=name)
File "C:\Users\Ellen\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1598, in _max_pool
data_format=data_format, name=name)
File "C:\Users\Ellen\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 759, in apply_op
op_def=op_def)
File "C:\Users\Ellen\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2240, in create_op
original_op=self._default_original_op, op_def=op_def)
File "C:\Users\Ellen\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1128, in init
self._traceback = _extract_stack()
InvalidArgumentError (see above for traceback): Default MaxPoolingOp only supports NHWC.
[[Node: pool1 = MaxPoolT=DT_FLOAT, data_format="NCHW", ksize=[1, 1, 2, 2], padding="SAME", strides=[1, 1, 2, 2
], _device="/job:localhost/replica:0/task:0/cpu:0"]]
Does this mean I'm not preprocess the data properly? Or is there any possible reasons for this? How can I correct it?
The text was updated successfully, but these errors were encountered: