Seq2CNN
Seq2CNN copied to clipboard
InvalidArgumentError while running the code
Hi, I get the following error while running with yelp_review_polarity, I'm quite new to ML. Kindly look into the error and help me, thanks in advance! I'm using tensorflow: 1.13.1 and python 3.7
2020-02-18 19:43:36.158943: W tensorflow/core/framework/op_kernel.cc:1401] OP_REQUIRES failed at conv_ops.cc:437 : Invalid argument: Computed output size would be negative: -2 [input_size: 2, effective_filter_size: 5, stride: 1] Traceback (most recent call last): File "/home/ice/anaconda3/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call return fn(*args) File "/home/ice/anaconda3/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/ice/anaconda3/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: Computed output size would be negative: -47 [input_size: 0, effective_filter_size: 48, stride: 1] [[{{node textCNN/conv-maxpool-3/pool}}]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train.py", line 312, in
Caused by op 'textCNN/conv-maxpool-3/pool', defined at:
File "train.py", line 312, in
InvalidArgumentError (see above for traceback): Computed output size would be negative: -47 [input_size: 0, effective_filter_size: 48, stride: 1] [[node textCNN/conv-maxpool-3/pool (defined at /home/ice/fyp/Seq2CNN-master/seq2CNN/model.py:75) ]]
First thing worth trying might be downgrading Tensorflow version. Since this repo is really outdated, version difference can cause serious problems. Around version 0.5.0 ~ 1.5.0 may be working but I recommend rewriting the code from the scratch.
Thank you for reaching out regarding this, I just tried running it using tf 1.5.0 and python 3.5 and still got the following error:
2020-02-20 12:23:22.170039: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA 2020-02-20 12:23:25.707186: W tensorflow/core/framework/op_kernel.cc:1198] Invalid argument: computed output size would be negative 2020-02-20 12:23:25.707278: W tensorflow/core/framework/op_kernel.cc:1198] Invalid argument: computed output size would be negative 2020-02-20 12:23:25.707365: W tensorflow/core/framework/op_kernel.cc:1198] Invalid argument: computed output size would be negative Traceback (most recent call last): File "/home/ice/anaconda3/envs/ven/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _do_call return fn(*args) File "/home/ice/anaconda3/envs/ven/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1329, in _run_fn status, run_metadata) File "/home/ice/anaconda3/envs/ven/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: computed output size would be negative [[Node: textCNN/conv-maxpool-5/conv = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](textCNN/BatchNorm/cond/Merge, textCNN/conv-maxpool-5/W/read)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train.py", line 312, in
Caused by op 'textCNN/conv-maxpool-5/conv', defined at:
File "train.py", line 312, in
InvalidArgumentError (see above for traceback): computed output size would be negative [[Node: textCNN/conv-maxpool-5/conv = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](textCNN/BatchNorm/cond/Merge, textCNN/conv-maxpool-5/W/read)]]
I also tried using tf 0.5.0 using python 2.7 ,but, it throws no module named layers.core