Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32
realmyth opened this issue · 1 comments
Hi ,
when I running : python attention.py , there is some thing wrong as bellow, Could you pls tell me, Is this code can run under tf 1.0 or not ?
Traceback (most recent call last):
File "attention.py", line 37, in
out,state = tflib.ops.im2latexAttention('AttLSTM',emb_seqs,ctx,EMB_DIM,ENC_DIM,DEC_DIM,D,H,W)
File "/home/xuxiduo/paper_ocr/im2latex-tensorflow/tflib/ops.py", line 521, in im2latexAttention
V_cap = tf.scan(fn,tf.range(tf.shape(V)[1]), initializer=tf.placeholder(shape=(None,None,2*ENC_DIM),dtype=tf.int32))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/functional_ops.py", line 584, in scan
back_prop=back_prop, swap_memory=swap_memory)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2623, in while_loop
result = context.BuildLoop(cond, body, loop_vars, shape_invariants)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2456, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2406, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/functional_ops.py", line 574, in compute
a_out = fn(packed_a, packed_elems)
File "/home/xuxiduo/paper_ocr/im2latex-tensorflow/tflib/ops.py", line 518, in fn
return tflib.ops.BiLSTM(name+'.BiLSTMEncoder',V[:,i],D,ENC_DIM,h0_i_1[:,i],h0_i_2[:,i])
File "/home/xuxiduo/paper_ocr/im2latex-tensorflow/tflib/ops.py", line 396, in BiLSTM
outputs = tf.nn.bidirectional_dynamic_rnn(cell1, cell2, inputs, sequence_length=seq_len, initial_state_fw=h0_1, initial_state_bw=h0_2, swap_memory=True)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 350, in bidirectional_dynamic_rnn
time_major=time_major, scope=fw_scope)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 553, in dynamic_rnn
dtype=dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 720, in _dynamic_rnn_loop
swap_memory=swap_memory)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2623, in while_loop
result = context.BuildLoop(cond, body, loop_vars, shape_invariants)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2456, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2406, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 703, in _time_step
skip_conditionals=True)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 177, in _rnn_step
new_output, new_state = call_cell()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 691, in
call_cell = lambda: cell(input_t, state)
File "/home/xuxiduo/paper_ocr/im2latex-tensorflow/tflib/ops.py", line 325, in call
c_tm1, h_tm1 = tf.split(1,2,state)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1198, in split
split_dim=axis, num_split=num_or_size_splits, value=value, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 3306, in _split
num_split=num_split, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 514, in apply_op
(prefix, dtypes.as_dtype(input_arg.type).name))
TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32.
and by tarcking the erro points, Found that:
in file tflibs/ ops.py, line 325 , c_tm1, h_tm1 = tf.split(1,2,state) puzzled me
Hi,
Unfortunately my codebase was in tf 0.9.0 and I haven't had the time to adapt to tf 1.0 yet.
Best,
Rithesh