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

Incompatible shapes: [64,98] vs. [64,2997] #117

Open
Joe-zsc opened this issue May 31, 2020 · 0 comments
Open

Incompatible shapes: [64,98] vs. [64,2997] #117

Joe-zsc opened this issue May 31, 2020 · 0 comments

Comments

@Joe-zsc
Copy link

Joe-zsc commented May 31, 2020

when I am training my own dataset(english), a bug occurred
my dataset have 24 tags

发生异常: InvalidArgumentError
Incompatible shapes: [64,98] vs. [64,2997]
[[Node: add_1 = Add[T=DT_INT32, _device="/job:localhost/replica:0/task:0/gpu:0"](add, _recv_labels_0/_15)]]
[[Node: rnn/All/_67 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_1046_rnn/All", tensor_type=DT_BOOL, _device="/job:localhost/replica:0/task:0/cpu:0"]]

Caused by op 'add_1', defined at:
File "D:\Anaconda3\envs\tf\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "D:\Anaconda3\envs\tf\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "c:\Users\Think.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\lib\python\debugpy\no_wheels\debugpy_main
.py", line 45, in
cli.main()
File "c:\Users\Think.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\lib\python\debugpy\no_wheels\debugpy/..\debugpy\server\cli.py", line 430, in main
run()
File "c:\Users\Think.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\lib\python\debugpy\no_wheels\debugpy/..\debugpy\server\cli.py", line 267, in run_file
runpy.run_path(options.target, run_name=compat.force_str("main"))
File "D:\Anaconda3\envs\tf\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "D:\Anaconda3\envs\tf\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "D:\Anaconda3\envs\tf\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "f:\Experiments\NERexperiments\zh-NER-TF-master\main.py", line 78, in
model.build_graph()
File "f:\Experiments\NERexperiments\zh-NER-TF-master\model.py", line 39, in build_graph
self.loss_op()
File "f:\Experiments\NERexperiments\zh-NER-TF-master\model.py", line 96, in loss_op
sequence_lengths=self.sequence_lengths)
File "D:\Anaconda3\envs\tf\lib\site-packages\tensorflow\contrib\crf\python\ops\crf.py", line 155, in crf_log_likelihood
transition_params)
File "D:\Anaconda3\envs\tf\lib\site-packages\tensorflow\contrib\crf\python\ops\crf.py", line 91, in crf_sequence_score
unary_scores = crf_unary_score(tag_indices, sequence_lengths, inputs)
File "D:\Anaconda3\envs\tf\lib\site-packages\tensorflow\contrib\crf\python\ops\crf.py", line 182, in crf_unary_score
flattened_tag_indices = array_ops.reshape(offsets + tag_indices, [-1])
File "D:\Anaconda3\envs\tf\lib\site-packages\tensorflow\python\ops\math_ops.py", line 821, in binary_op_wrapper
return func(x, y, name=name)
File "D:\Anaconda3\envs\tf\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 73, in add
result = _op_def_lib.apply_op("Add", x=x, y=y, name=name)
File "D:\Anaconda3\envs\tf\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 768, in apply_op
op_def=op_def)
File "D:\Anaconda3\envs\tf\lib\site-packages\tensorflow\python\framework\ops.py", line 2336, in create_op
original_op=self._default_original_op, op_def=op_def)
File "D:\Anaconda3\envs\tf\lib\site-packages\tensorflow\python\framework\ops.py", line 1228, in init
self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): Incompatible shapes: [64,98] vs. [64,2997]
[[Node: add_1 = Add[T=DT_INT32, _device="/job:localhost/replica:0/task:0/gpu:0"](add, _recv_labels_0/_15)]]
[[Node: rnn/All/_67 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_1046_rnn/All", tensor_type=DT_BOOL, _device="/job:localhost/replica:0/task:0/cpu:0"]]
File "F:\Experiments\NERexperiments\zh-NER-TF-master\model.py", line 209, in run_one_epoch
feed_dict=feed_dict)
File "F:\Experiments\NERexperiments\zh-NER-TF-master\model.py", line 161, in train
self.run_one_epoch(sess, train, dev, self.tag2label, epoch, saver)
File "F:\Experiments\NERexperiments\zh-NER-TF-master\main.py", line 88, in
model.train(train=train_data, dev=test_data) # use test_data as the dev_data to see overfitting phenomena

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

1 participant