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

I got some problems about when I want to change time_steps about feature map! #59

Open
lmolhw5252 opened this issue Dec 19, 2017 · 0 comments

Comments

@lmolhw5252
Copy link

I want to change the feature after the output about CNN in cnn.py. When I use the input of shape[batch_size, 1, 32, 100], I got the shape of CNN output is [batch_size, 24, 512],and then, I want to change the time_step about 24, but I got some problems.

[[Node: model_with_buckets/embedding_attention_decoder_2/embedding_lookup_1 = Gather[Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@embedding_attention_decoder/embedding"], validate_indices=true, _device="/job:localhost/replica:0/task:0/cpu:0"](embedding_attention_decoder/embedding/read, _arg_decoder1_0_11)]]
2017-12-19 23:42:15.960688: W tensorflow/core/framework/op_kernel.cc:1192] Invalid argument: indices[0] = 52 is not in [0, 40)
[[Node: model_with_buckets/embedding_attention_decoder_2/embedding_lookup_1 = Gather[Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@embedding_attention_decoder/embedding"], validate_indices=true, _device="/job:localhost/replica:0/task:0/cpu:0"](embedding_attention_decoder/embedding/read, _arg_decoder1_0_11)]]

Traceback (most recent call last):
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call
return fn(*args)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1306, in _run_fn
status, run_metadata)
File "/home/user/anaconda3/lib/python3.5/contextlib.py", line 66, in exit
next(self.gen)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0] = 52 is not in [0, 40)
[[Node: model_with_buckets/embedding_attention_decoder_2/embedding_lookup_1 = Gather[Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@embedding_attention_decoder/embedding"], validate_indices=true, _device="/job:localhost/replica:0/task:0/cpu:0"](embedding_attention_decoder/embedding/read, _arg_decoder1_0_11)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "src/launcher.py", line 148, in
main(sys.argv[1:], ExpConfig)
File "src/launcher.py", line 144, in main
model.launch()
File "/home/user/PycharmProjects/Attention-OCR-master/src/source/model.py", line 322, in launch
self.forward_only)
File "/home/user/PycharmProjects/Attention-OCR-master/src/source/model.py", line 435, in step
outputs = self.sess.run(output_feed, input_feed)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 895, in run
run_metadata_ptr)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1124, in _run
feed_dict_tensor, options, run_metadata)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
options, run_metadata)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0] = 52 is not in [0, 40)
[[Node: model_with_buckets/embedding_attention_decoder_2/embedding_lookup_1 = Gather[Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@embedding_attention_decoder/embedding"], validate_indices=true, _device="/job:localhost/replica:0/task:0/cpu:0"](embedding_attention_decoder/embedding/read, _arg_decoder1_0_11)]]

Caused by op 'model_with_buckets/embedding_attention_decoder_2/embedding_lookup_1', defined at:
File "src/launcher.py", line 148, in
main(sys.argv[1:], ExpConfig)
File "src/launcher.py", line 143, in main
session=sess)
File "/home/user/PycharmProjects/Attention-OCR-master/src/source/model.py", line 167, in init
use_gru=use_gru)
File "/home/user/PycharmProjects/Attention-OCR-master/src/source/seq2seq_model.py", line 180, in init
softmax_loss_function=softmax_loss_function)
File "/home/user/PycharmProjects/Attention-OCR-master/src/source/seq2seq.py", line 1033, in model_with_buckets
decoder_inputs[:int(bucket[1])], int(bucket[0]))
File "/home/user/PycharmProjects/Attention-OCR-master/src/source/seq2seq_model.py", line 179, in
self.target_weights, buckets, lambda x, y, z: seq2seq_f(x, y, z, False),
File "/home/user/PycharmProjects/Attention-OCR-master/src/source/seq2seq_model.py", line 155, in seq2seq_f
attn_num_hidden=attn_num_hidden)
File "/home/user/PycharmProjects/Attention-OCR-master/src/source/seq2seq.py", line 701, in embedding_attention_decoder
embedding_ops.embedding_lookup(embedding, i) for i in decoder_inputs]
File "/home/user/PycharmProjects/Attention-OCR-master/src/source/seq2seq.py", line 701, in
embedding_ops.embedding_lookup(embedding, i) for i in decoder_inputs]
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/embedding_ops.py", line 294, in embedding_lookup
transform_fn=None)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/embedding_ops.py", line 123, in _embedding_lookup_and_transform
result = _gather_and_clip(params[0], ids, max_norm, name=name)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/embedding_ops.py", line 57, in _gather_and_clip
embs = array_ops.gather(params, ids, name=name)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py", line 2409, in gather
validate_indices=validate_indices, name=name)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 1219, in gather
validate_indices=validate_indices, name=name)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2630, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/home/user/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1204, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): indices[0] = 52 is not in [0, 40)
[[Node: model_with_buckets/embedding_attention_decoder_2/embedding_lookup_1 = Gather[Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@embedding_attention_decoder/embedding"], validate_indices=true, _device="/job:localhost/replica:0/task:0/cpu:0"](embedding_attention_decoder/embedding/read, _arg_decoder1_0_11)]]

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