Coder Social home page Coder Social logo

ritheshkumar95 / im2latex-tensorflow Goto Github PK

View Code? Open in Web Editor NEW
287.0 287.0 76.0 30.02 MB

Tensorflow implementation of the HarvardNLP paper - What You Get Is What You See: A Visual Markup Decompiler (https://arxiv.org/pdf/1609.04938v1.pdf)

Jupyter Notebook 7.22% Python 10.06% JavaScript 1.15% Lua 11.91% HTML 69.67%
convolutional-neural-networks deep-learning neural-network recurrent-neural-networks tensorflow

im2latex-tensorflow's People

Contributors

phhang avatar ritheshkumar95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

im2latex-tensorflow's Issues

predict output every bad result

4cbdf71aaf

gt: E = v \sqrt { Q _ { M } ^ { 2 } + Q _ { E } ^ { 2 } } , , .
ret: \circ \circ \circ \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \a
lpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \r
ho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alp
ha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho
\alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho \alpha \rho

do anyone meet this question?

Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32

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

Some problems in running attention.py

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?

is_training=False

Thanks for releasing your pretrained weights checkpoint. I'm trying to use them to run the decompiler. When I set is_training=False in the call to tflib.network.im2latex_cnn, it outputs the wrong answer. Any advice on how to run it not in training mode?

For example, for 3e679e114e.png, I get

#START \begin{array} { l } & { \scriptscriptstyle } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } & { \bf } [truncated]

(originally was #START f _ { ( x , x _ { 0 } ) } ^ { c , L } \equiv f ^ { c } ( x , x _ { 0 } ) #END)

run python attention.py ,error is following. how to fix it ? thanks in advance!

WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
Traceback (most recent call last):
File "attention.py", line 37, in
out,state = tflib.ops.FreeRunIm2LatexAttention('AttLSTM',emb_seqs,ctx,EMB_DIM,ENC_DIM,DEC_DIM,D,H,W)
File "/home/rootx/me/im2latextensorflow/im2latex-tensorflow-master/tflib/ops.py", line 625, in FreeRunIm2LatexAttention
V = tf.transpose(ctx,[0,2,3,1]) # (B, H, W, D)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1420, in transpose
ret = transpose_fn(a, perm, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 8927, in transpose
"Transpose", x=x, perm=perm, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1792, in init
control_input_ops)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1631, in _create_c_op
raise ValueError(str(e))
ValueError: Dimension must be 3 but is 4 for 'transpose' (op: 'Transpose') with input shapes: [?,?,80], [4].

the weights files not works

I changed the attention.py # out,state = tflib.ops.FreeRunIm2LatexAttention('AttLSTM', ctx, emb_seqs, EMB_DIM, ENC_DIM, DEC_DIM, D, H, W) to out, state = tflib.ops.im2latexAttention('AttLSTM', emb_seqs, ctx, EMB_DIM, ENC_DIM, DEC_DIM, D, H, W) ,the net runs correctly but the weight files has an error NotFoundError (see above for traceback): Key rnn/while/AttLSTM.AttentionCell.Gates/AttLSTM.AttentionCell.Gates.W not found in checkpoint [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

Predict issue

Hi Rithesh,

I see you have included Predict function in the attention.py script, but I didnt see you use it anywhere. Can you indicate how to use it so I can predict my training result?
Thanks a lot

Robin

AttributeError

Whenever i am trying to run your code, i am getting an error in tflib folder in ops.py

AttributeError: module "tensorflow.python.ops.nn" has no attribute 'rnn_cell'

Got so many errors, but why raw input? and also can't decode 0xe7 in utf-8 codec

When I ran this code in Google colab, i got this error
How would I solve this? any ideas?
I dont know anything about ML and TF though

I just cloned the repository and ran the below code in colab:

%cd /content/
%cd /content/im2latex-tensorflow/im2markup

!python scripts/preprocessing/preprocess_images.py --input-dir ../formula_images --output-dir ../images_processed
!python scripts/preprocessing/preprocess_formulas.py --mode normalize --input-file ../im2latex_formulas.lst --output-file formulas.norm.lst

!python scripts/preprocessing/preprocess_filter.py --filter --image-dir ../images_processed --label-path formulas.norm.lst --data-
path ../im2latex_train.lst --output-path train.lst
!python scripts/preprocessing/preprocess_filter.py --filter --image-dir ../images_processed --label-path formulas.norm.lst --data-
path ../im2latex_validate.lst --output-path validate.lst
!python scripts/preprocessing/preprocess_filter.py --no-filter --image-dir ../images_processed --label-path formulas.norm.lst 
--data-path ../im2latex_test.lst --output-path test.lst
!python scripts/preprocessing/generate_latex_vocab.py --data-path train.lst --label-path formulas.norm.lst --output-file 
latex_vocab.txt

!python /content/attention.py

Output:

/content/im2latex-tensorflow/im2markup
2021-07-22 07:01:50,172 root  INFO     Script being executed: scripts/preprocessing/preprocess_images.py
[240, 100]
Traceback (most recent call last):
  File "scripts/preprocessing/preprocess_images.py", line 103, in <module>
    main(sys.argv[1:])
  File "scripts/preprocessing/preprocess_images.py", line 91, in main
    raw_input()
NameError: name 'raw_input' is not defined
2021-07-22 07:01:50,343 root  INFO     Script being executed: scripts/preprocessing/preprocess_formulas.py
Traceback (most recent call last):
  File "scripts/preprocessing/preprocess_formulas.py", line 86, in <module>
    main(sys.argv[1:])
  File "scripts/preprocessing/preprocess_formulas.py", line 64, in main
    fout.write(open(output_file).read().replace('\r', ' ')) # delete \r
  File "/usr/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 854238: invalid continuation byte
2021-07-22 07:01:50,724 root  INFO     Script being executed: scripts/preprocessing/preprocess_filter.py
Traceback (most recent call last):
  File "scripts/preprocessing/preprocess_filter.py", line 115, in <module>
    main(sys.argv[1:])
  File "scripts/preprocessing/preprocess_filter.py", line 78, in main
    labels = open(parameters.label_path).readlines()
  File "/usr/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 2270: invalid continuation byte
2021-07-22 07:01:51,033 root  INFO     Script being executed: scripts/preprocessing/preprocess_filter.py
Traceback (most recent call last):
  File "scripts/preprocessing/preprocess_filter.py", line 115, in <module>
    main(sys.argv[1:])
  File "scripts/preprocessing/preprocess_filter.py", line 78, in main
    labels = open(parameters.label_path).readlines()
  File "/usr/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 2270: invalid continuation byte
2021-07-22 07:01:51,362 root  INFO     Script being executed: scripts/preprocessing/preprocess_filter.py
2021-07-22 07:01:51,396 root  INFO     0 discarded. 0 not found in ../images_processed.
2021-07-22 07:01:51,397 root  INFO     Jobs finished
2021-07-22 07:01:51,532 root  INFO     Script being executed: scripts/preprocessing/generate_latex_vocab.py
Traceback (most recent call last):
  File "scripts/preprocessing/generate_latex_vocab.py", line 80, in <module>
    main(sys.argv[1:])
  File "scripts/preprocessing/generate_latex_vocab.py", line 49, in main
    formulas = open(label_path).readlines()
  File "/usr/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 2270: invalid continuation byte
python3: can't open file '/content/attention.py': [Errno 2] No such file or directory

InvalidArgumentError (see above for traceback): assertion failed: [Expected shape for Tensor rnn/sequence_length:0 is ] [20] [ but saw shape: ] [8]

Hello!
Thank you for sharing your code!
I have some wrong with that code when run file attention.py . I replaced FreeRunIm2LatexAttention by im2latexAttention.
My error:
InvalidArgumentError (see above for traceback): assertion failed: [Expected shape for Tensor rnn/sequence_length:0 is ] [20] [ but saw shape: ] [8]
I don't know what is wrong and how can I fix it. Can you help me, please? Thanks

Fulll:
Traceback (most recent call last):
File "attention.py", line 157, in
_ , _loss = sess.run([train_step,loss],feed_dict={X:train_img,seqs:train_seq,mask:train_mask,learn_rate:lr})
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1152, in _run
feed_dict_tensor, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1328, in _do_run
run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1348, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: [Expected shape for Tensor rnn/sequence_length:0 is ] [20] [ but saw shape: ] [8]
[[node rnn/Assert/Assert (defined at /root/im2latex-tensorflow/tflib/ops.py:533) = Assert[T=[DT_STRING, DT_INT32, DT_STRING, DT_INT32], summarize=3, _device="/job:localhost/replica:0/task:0/device:CPU:0"](rnn/All/_99, rnn/Assert/Assert/data_0, rnn/stack/_101, rnn/Assert/Assert/data_2, rnn/Shape_1/_103)]]
[[{{node rnn/while/PyFunc/_278}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_2593_rnn/while/PyFunc", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

Caused by op u'rnn/Assert/Assert', defined at:
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 "/root/im2latex-tensorflow/tflib/ops.py", line 533, in im2latexAttention
out = tf.nn.dynamic_rnn(cell, inputs, initial_state=h0_dec, sequence_length=seq_len, swap_memory=True)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 651, in dynamic_rnn
[_assert_has_shape(sequence_length, [batch_size])]):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/rnn.py", line 646, in _assert_has_shape
packed_shape, " but saw shape: ", x_shape])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/tf_should_use.py", line 189, in wrapped
return _add_should_use_warning(fn(*args, **kwargs))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 159, in Assert
return gen_logging_ops._assert(condition, data, summarize, name="Assert")
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_logging_ops.py", line 52, in _assert
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1770, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): assertion failed: [Expected shape for Tensor rnn/sequence_length:0 is ] [20] [ but saw shape: ] [8]
[[node rnn/Assert/Assert (defined at /root/im2latex-tensorflow/tflib/ops.py:533) = Assert[T=[DT_STRING, DT_INT32, DT_STRING, DT_INT32], summarize=3, _device="/job:localhost/replica:0/task:0/device:CPU:0"](rnn/All/_99, rnn/Assert/Assert/data_0, rnn/stack/_101, rnn/Assert/Assert/data_2, rnn/Shape_1/_103)]]
[[{{node rnn/while/PyFunc/_278}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_2593_rnn/while/PyFunc", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

ValueError: Depth of input (32) is not a multiple of input depth of filter (64) for 'conv2/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,32], [3,3,64,128].

Hey there,
Thanks for sharing your code with us . I tried my best to remove all the glitches that occured in ops.py , predict.py .
Things I changed

  1. According to the official tensorflow documentation tf.split() function has changed in attributes postion in the recent versions (https://www.tensorflow.org/api_docs/python/tf/split) .However the code you shared contains the definition from the previous version so changed that to the new one.

  2. There were some areas where the state variable in ops.py is splitted in such dimensions that they were not matching with the input dimension when concatenating.So i changed that somehow and got that to run .

  3. I converted the data format argument in ops.py from "NCHW" to "NHWC" because the latex one only supports the CPU.

However after all these Solving of errors , I was able to start the frontend which was from this repo https://github.com/yixuanzhou/image2latex . But when I run predict.py i am still getting an error from network.py in tflib folder.

The Error is as Follows :

Traceback (most recent call last):
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1864, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Depth of input (32) is not a multiple of input depth of filter (64) for 'conv2/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,32], [3,3,64,128].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\scanner\image2latex\predict.py", line 31, in
ctx = tflib.network.im2latex_cnn(X,NUM_FEATS_START,True)
File "c:\scanner\image2latex\tflib\network.py", line 79, in im2latex_cnn
X = tf.nn.relu(tflib.ops.conv2d('conv2', X, 3, 1, num_feats, num_feats*2, pad = 'SAME', bias=True))
File "c:\scanner\image2latex\tflib\ops.py", line 203, in conv2d
out = tf.nn.conv2d(input,filters=filters, strides=[1, 1, stride, stride], padding=pad, data_format='NHWC')
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\nn_ops.py", line 1953, in conv2d
name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1160, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 2027, in init
control_input_ops)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1867, in _create_c_op
raise ValueError(str(e))
ValueError: Depth of input (32) is not a multiple of input depth of filter (64) for 'conv2/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,32], [3,3,64,128].

(base) C:\Users\Sarthak>python -u "c:\scanner\image2latex\predict.py"
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING: Logging before flag parsing goes to stderr.
W1127 19:41:30.626686 17720 configdefaults.py:515] g++ not available, if using conda: conda install m2w64-toolchain
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
warnings.warn("DeprecationWarning: there is no c++ compiler."
W1127 19:41:30.636664 17720 configdefaults.py:580] g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
W1127 19:41:31.051667 17720 blas_headers.py:988] Using NumPy C-API based implementation for BLAS functions.
W1127 19:41:31.224253 17720 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:258: The name tf.nn.rnn_cell.RNNCell is deprecated. Please use tf.compat.v1.nn.rnn_cell.RNNCell instead.

W1127 19:41:31.309074 17720 deprecation_wrapper.py:119] From c:\scanner\image2latex\predict.py:23: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W1127 19:41:31.390878 17720 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:245: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

Traceback (most recent call last):
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1864, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Depth of input (64) is not a multiple of input depth of filter (128) for 'conv3/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,64], [3,3,128,256].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\scanner\image2latex\predict.py", line 31, in
ctx = tflib.network.im2latex_cnn(X,NUM_FEATS_START,True)
File "c:\scanner\image2latex\tflib\network.py", line 82, in im2latex_cnn
X = tf.nn.relu(tflib.ops.conv2d('conv3', X, 3, 1, num_feats2, num_feats4, batchnorm=bn, is_training=train_mode, pad = 'SAME', bias=False))
File "c:\scanner\image2latex\tflib\ops.py", line 203, in conv2d
out = tf.nn.conv2d(input,filters=filters, strides=[1, 1, stride, stride], padding=pad, data_format='NHWC')
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\nn_ops.py", line 1953, in conv2d
name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1160, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 2027, in init
control_input_ops)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1867, in _create_c_op
raise ValueError(str(e))
ValueError: Depth of input (64) is not a multiple of input depth of filter (128) for 'conv3/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,64], [3,3,128,256].

(base) C:\Users\Sarthak>python -u "c:\scanner\image2latex\predict.py"
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING: Logging before flag parsing goes to stderr.
W1127 19:42:26.482462 16544 configdefaults.py:515] g++ not available, if using conda: conda install m2w64-toolchain
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
warnings.warn("DeprecationWarning: there is no c++ compiler."
W1127 19:42:26.492436 16544 configdefaults.py:580] g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
W1127 19:42:26.897433 16544 blas_headers.py:988] Using NumPy C-API based implementation for BLAS functions.
W1127 19:42:27.063021 16544 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:258: The name tf.nn.rnn_cell.RNNCell is deprecated. Please use tf.compat.v1.nn.rnn_cell.RNNCell instead.

W1127 19:42:27.112899 16544 deprecation_wrapper.py:119] From c:\scanner\image2latex\predict.py:23: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W1127 19:42:27.169785 16544 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:245: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

Traceback (most recent call last):
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1864, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Depth of input (32) is not a multiple of input depth of filter (64) for 'conv2/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,32], [3,3,64,64].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\scanner\image2latex\predict.py", line 31, in
ctx = tflib.network.im2latex_cnn(X,NUM_FEATS_START,True)
File "c:\scanner\image2latex\tflib\network.py", line 79, in im2latex_cnn
X = tf.nn.relu(tflib.ops.conv2d('conv2', X, 3, 1, num_feats, num_feats, pad = 'SAME', bias=False))
File "c:\scanner\image2latex\tflib\ops.py", line 203, in conv2d
out = tf.nn.conv2d(input,filters=filters, strides=[1, 1, stride, stride], padding=pad, data_format='NHWC')
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\nn_ops.py", line 1953, in conv2d
name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1160, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 2027, in init
control_input_ops)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1867, in _create_c_op
raise ValueError(str(e))
ValueError: Depth of input (32) is not a multiple of input depth of filter (64) for 'conv2/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,32], [3,3,64,64].

(base) C:\Users\Sarthak>python -u "c:\scanner\image2latex\predict.py"
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING: Logging before flag parsing goes to stderr.
W1127 19:43:06.639282 15456 configdefaults.py:515] g++ not available, if using conda: conda install m2w64-toolchain
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
warnings.warn("DeprecationWarning: there is no c++ compiler."
W1127 19:43:06.650255 15456 configdefaults.py:580] g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
W1127 19:43:07.080190 15456 blas_headers.py:988] Using NumPy C-API based implementation for BLAS functions.
W1127 19:43:07.251765 15456 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:258: The name tf.nn.rnn_cell.RNNCell is deprecated. Please use tf.compat.v1.nn.rnn_cell.RNNCell instead.

W1127 19:43:07.301639 15456 deprecation_wrapper.py:119] From c:\scanner\image2latex\predict.py:23: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W1127 19:43:07.359498 15456 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:245: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

W1127 19:43:08.680222 15456 lazy_loader.py:50]
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:

Traceback (most recent call last):
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1864, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Depth of input (128) is not a multiple of input depth of filter (256) for 'conv5/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,128], [3,3,256,512].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\scanner\image2latex\predict.py", line 31, in
ctx = tflib.network.im2latex_cnn(X,NUM_FEATS_START,True)
File "c:\scanner\image2latex\tflib\network.py", line 87, in im2latex_cnn
X = tf.nn.relu(tflib.ops.conv2d('conv5', X, 3, 1, num_feats4, num_feats8, batchnorm=bn, is_training=train_mode, pad = 'SAME', bias=False))
File "c:\scanner\image2latex\tflib\ops.py", line 203, in conv2d
out = tf.nn.conv2d(input,filters=filters, strides=[1, 1, stride, stride], padding=pad, data_format='NHWC')
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\nn_ops.py", line 1953, in conv2d
name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1160, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 2027, in init
control_input_ops)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1867, in _create_c_op
raise ValueError(str(e))
ValueError: Depth of input (128) is not a multiple of input depth of filter (256) for 'conv5/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,128], [3,3,256,512].

(base) C:\Users\Sarthak>python -u "c:\scanner\image2latex\predict.py"
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING: Logging before flag parsing goes to stderr.
W1127 19:43:39.413293 15844 configdefaults.py:515] g++ not available, if using conda: conda install m2w64-toolchain
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
warnings.warn("DeprecationWarning: there is no c++ compiler."
W1127 19:43:39.424278 15844 configdefaults.py:580] g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
W1127 19:43:39.838238 15844 blas_headers.py:988] Using NumPy C-API based implementation for BLAS functions.
W1127 19:43:40.012807 15844 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:258: The name tf.nn.rnn_cell.RNNCell is deprecated. Please use tf.compat.v1.nn.rnn_cell.RNNCell instead.

W1127 19:43:40.063678 15844 deprecation_wrapper.py:119] From c:\scanner\image2latex\predict.py:23: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W1127 19:43:40.124533 15844 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:245: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

W1127 19:43:41.438272 15844 lazy_loader.py:50]
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:

W1127 19:43:41.997882 15844 deprecation.py:323] From c:\scanner\image2latex\tflib\ops.py:411: bidirectional_dynamic_rnn (from tensorflow.python.ops.rnn) is deprecated and will be removed in a future version.
Instructions for updating:
Please use keras.layers.Bidirectional(keras.layers.RNN(cell)), which is equivalent to this API
W1127 19:43:41.999880 15844 deprecation.py:323] From C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\rnn.py:464: dynamic_rnn (from tensorflow.python.ops.rnn) is deprecated and will be removed in a future version.
Instructions for updating:
Please use keras.layers.RNN(cell), which is equivalent to this API
Traceback (most recent call last):
File "c:\scanner\image2latex\predict.py", line 32, in
out,state = tflib.ops.im2latexAttention('AttLSTM',emb_seqs,ctx,EMB_DIM,ENC_DIM,DEC_DIM,D,H,W)
File "c:\scanner\image2latex\tflib\ops.py", line 541, in im2latexAttention
V_cap = tf.scan(fn,tf.range(tf.shape(V)[1]), initializer=tf.placeholder(shape=(None,None,2*ENC_DIM),dtype=tf.float32))
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\functional_ops.py", line 505, in scan
maximum_iterations=n)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3501, in while_loop
return_same_structure)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3012, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2937, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3456, in
body = lambda i, lv: (i + 1, orig_body(*lv))
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\functional_ops.py", line 482, in compute
a_out = fn(packed_a, packed_elems)
File "c:\scanner\image2latex\tflib\ops.py", line 539, in fn
return tflib.ops.BiLSTM(name+'.BiLSTMEncoder',V[:,i],D,ENC_DIM,h0_i_1[:,i],h0_i_2[:,i])
File "c:\scanner\image2latex\tflib\ops.py", line 411, 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)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\util\deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\rnn.py", line 464, in bidirectional_dynamic_rnn
scope=fw_scope)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\util\deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\rnn.py", line 707, in dynamic_rnn
dtype=dtype)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\rnn.py", line 781, in _dynamic_rnn_loop
"Input size (depth of inputs) must be accessible via shape inference,"
ValueError: Input size (depth of inputs) must be accessible via shape inference, but saw value None.

(base) C:\Users\Sarthak>python -u "c:\scanner\image2latex\predict.py"
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING: Logging before flag parsing goes to stderr.
W1128 01:03:32.984935 2240 configdefaults.py:515] g++ not available, if using conda: conda install m2w64-toolchain
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
warnings.warn("DeprecationWarning: there is no c++ compiler."
W1128 01:03:33.014869 2240 configdefaults.py:580] g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
W1128 01:03:34.820028 2240 blas_headers.py:988] Using NumPy C-API based implementation for BLAS functions.
W1128 01:03:35.324705 2240 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:258: The name tf.nn.rnn_cell.RNNCell is deprecated. Please use tf.compat.v1.nn.rnn_cell.RNNCell instead.

W1128 01:03:36.316025 2240 deprecation_wrapper.py:119] From c:\scanner\image2latex\predict.py:23: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W1128 01:03:36.379881 2240 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:245: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

Traceback (most recent call last):
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1864, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Depth of input (32) is not a multiple of input depth of filter (64) for 'conv2/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,32], [3,3,64,128].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\scanner\image2latex\predict.py", line 31, in
ctx = tflib.network.im2latex_cnn(X,NUM_FEATS_START,True)
File "c:\scanner\image2latex\tflib\network.py", line 79, in im2latex_cnn
X = tf.nn.relu(tflib.ops.conv2d('conv2', X, 3, 1, num_feats, num_feats*2, pad = 'SAME', bias=False))
File "c:\scanner\image2latex\tflib\ops.py", line 203, in conv2d
out = tf.nn.conv2d(input,filters=filters, strides=[1, 1, stride, stride], padding=pad, data_format='NHWC')
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\nn_ops.py", line 1953, in conv2d
name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1160, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)

(base) C:\Users\Sarthak>python -u "c:\scanner\image2latex\predict.py"
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING: Logging before flag parsing goes to stderr.
W1128 01:15:01.867676 17600 configdefaults.py:515] g++ not available, if using conda: conda install m2w64-toolchain
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
warnings.warn("DeprecationWarning: there is no c++ compiler."
W1128 01:15:01.891614 17600 configdefaults.py:580] g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
W1128 01:15:03.140272 17600 blas_headers.py:988] Using NumPy C-API based implementation for BLAS functions.
W1128 01:15:03.627967 17600 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:258: The name tf.nn.rnn_cell.RNNCell is deprecated. Please use tf.compat.v1.nn.rnn_cell.RNNCell instead.

W1128 01:15:04.468720 17600 deprecation_wrapper.py:119] From c:\scanner\image2latex\predict.py:23: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W1128 01:15:04.606352 17600 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:245: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

(base) C:\Users\Sarthak>python -u "c:\scanner\image2latex\predict.py"
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING: Logging before flag parsing goes to stderr.
W1128 01:15:43.846421 10204 configdefaults.py:515] g++ not available, if using conda: conda install m2w64-toolchain
C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
warnings.warn("DeprecationWarning: there is no c++ compiler."
W1128 01:15:43.850411 10204 configdefaults.py:580] g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
W1128 01:15:44.360051 10204 blas_headers.py:988] Using NumPy C-API based implementation for BLAS functions.
W1128 01:15:44.552536 10204 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:258: The name tf.nn.rnn_cell.RNNCell is deprecated. Please use tf.compat.v1.nn.rnn_cell.RNNCell instead.

W1128 01:15:44.609384 10204 deprecation_wrapper.py:119] From c:\scanner\image2latex\predict.py:23: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W1128 01:15:44.767959 10204 deprecation_wrapper.py:119] From c:\scanner\image2latex\tflib\ops.py:245: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

Traceback (most recent call last):
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1864, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Depth of input (32) is not a multiple of input depth of filter (64) for 'conv2/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,32], [3,3,64,128].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\scanner\image2latex\predict.py", line 31, in
ctx = tflib.network.im2latex_cnn(X,NUM_FEATS_START,True)
File "c:\scanner\image2latex\tflib\network.py", line 79, in im2latex_cnn
X = tf.nn.relu(tflib.ops.conv2d('conv2', X, 3, 1, num_feats, num_feats*2, pad = 'SAME', bias=False))
File "c:\scanner\image2latex\tflib\ops.py", line 203, in conv2d
out = tf.nn.conv2d(input,filters=filters, strides=[1, 1, stride, stride], padding=pad, data_format='NHWC')
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\nn_ops.py", line 1953, in conv2d
name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1160, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
op_def=op_def)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 2027, in init
control_input_ops)
File "C:\Users\Sarthak\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\ops.py", line 1867, in _create_c_op
raise ValueError(str(e))
ValueError: Depth of input (32) is not a multiple of input depth of filter (64) for 'conv2/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,32], [3,3,64,128].

Please help me resolve this issue ,
Thanks

How to get tflite file from this code?

I don't know anything about machine learning. i am just looking for tflite file which can used by my android device to perform img to latex. can i get it from this?
Anyone please help me with this

variables

could you please tell me the use of these variables in your program.?
EMB_DIM = 80
ENC_DIM = 256
DEC_DIM = ENC_DIM*2

output the whole sequence within TF

thanks much for the excellent code.

in the current predict, i saw it gets output idx one by one:
(Maybe it is for visualization purpose).
attention.py: line 86
for i in xrange(1,160):
inp_seqs[:,i] = sess.run(predictions,feed_dict={X:imgs,input_seqs:inp_seqs[:,:i]})

In my test, it takes quite a while on my GPU machine. My understanding is it goes back and forth between TF and Python.
Would it be more efficient to have one TF OP to output the whole sequence? I would be happy to work on it if there is some guidance?

wrong parameters

Hello,
when I run this code, there is a problem:
/home/yzl/anaconda2/lib/python2.7/site-packages/h5py/init.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "/home/yzl/cltdevelop/OCR/Formula/im2latex-tensorflow-master/attention.py", line 42, in
logits = tflib.ops.Linear('MLP.1',out,DEC_DIM,V)
File "/home/yzl/cltdevelop/OCR/Formula/im2latex-tensorflow-master/tflib/ops.py", line 138, in Linear
reshaped_inputs = tf.reshape(inputs, [-1, input_dim])
File "/home/yzl/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 3938, in reshape
"Reshape", tensor=tensor, shape=shape, name=name)
File "/home/yzl/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/yzl/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2958, in create_op
set_shapes_for_outputs(ret)
File "/home/yzl/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2209, in set_shapes_for_outputs
shapes = shape_func(op)
File "/home/yzl/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2159, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/home/yzl/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
require_shape_fn)
File "/home/yzl/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Dimension size must be evenly divisible by 512 but is 80320 for 'MLP.1/Reshape' (op: 'Reshape') with input shapes: [1,160,502], [2] and with input tensors computed as partial shapes: input[1] = [?,512].

AttributeError: module 'tensorflow_core._api.v2.nn' has no attribute 'rnn_cell'

Hi all,

I am having difficulty running the predict script. I think it is an error stemming from which distribution you use for tensorflow. I tried upgrading to the most recent version of tensorflow (2.3.0) but got this error still. Here is the issue again in Tensorflow. I am not sure if it is a matter of calling a separate TF function for better im2latex implementation or if it is a problem that must be solved on the tensorflow side of things. Or maybe im2latex needs to be updated to work with the latest version of tensorflow. Just curious! Seems like a cool project!

I am using Windows 10 and PyCharm 2018.2

Tensorflow issue:
tensorflow/nmt#466

Traceback (most recent call last):
File "C:/Users/Owner/AppData/Local/Programs/Python/Python37/Lib/site-packages/im2latex_tensorflow/im2latex_tensorflow_master/predict.py", line 4, in
import tflib.ops
File "C:\Users\Owner\AppData\Local\Programs\Python\Python37\Lib\site-packages\im2latex_tensorflow\im2latex_tensorflow_master\tflib\ops.py", line 251, in
class GRUCell(tf.nn.rnn_cell.RNNCell):
AttributeError: module 'tensorflow_core._api.v2.nn' has no attribute 'rnn_cell'

Cannot run the program

Thanks a lot for your implementation.
I tried to rerun your program to train my own data, but I failed with the error messages as below:

W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
W tensorflow/core/framework/op_kernel.cc:975] Invalid argument: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
I tensorflow/core/common_runtime/gpu/pool_allocator.cc:247] PoolAllocator: After 17466 get requests, put_count=7522 evicted_count=1000 eviction_rate=0.132943 and unsatisfied allocation rate=0.632314
I tensorflow/core/common_runtime/gpu/pool_allocator.cc:259] Raising pool_size_limit
from 100 to 110
Traceback (most recent call last):
File "attention.py", line 157, in
_ , _loss = sess.run([train_step,loss],feed_dict={X:train_img,seqs:train_seq,mask:train_mask,learn_rate:lr})
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 766, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 964, in _run
feed_dict_string, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1014, in _do_run
target_list, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1034, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
[[Node: gradients/scan/while/BiRNN/FW/FW/while/TensorArrayWriteV2_grad/TensorArrayReadV2/StackPush/_693 = _SendT=DT_FLOAT, client_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_5093_gradients/scan/while/BiRNN/FW/FW/while/TensorArrayWriteV2_grad/TensorArrayReadV2/StackPush", _device="/job:localhost/replica:0/task:0/cpu:0"]]

Caused by op u'scan/while/strided_slice_1', defined at:
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/ccy/gui_learning/appUI/im2latex-tensorflow/tflib/ops.py", line 520, in im2latexAttention
V_cap = tf.scan(fn,tf.range(tf.shape(V)[1]), initializer=tf.placeholder(shape=(None,None,2*ENC_DIM),dtype=tf.float32))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/functional_ops.py", line 585, 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 2636, 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 2469, 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 2419, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/functional_ops.py", line 575, in compute
a_out = fn(packed_a, packed_elems)
File "/home/ccy/gui_learning/appUI/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 "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 436, in _SliceHelper
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 590, in strided_slice
shrink_axis_mask=shrink_axis_mask)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 3503, in strided_slice
shrink_axis_mask=shrink_axis_mask, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 759, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2240, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1128, in init
self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): slice index 20 of dimension 1 out of bounds.
[[Node: scan/while/strided_slice_1 = StridedSlice[Index=DT_INT32, T=DT_FLOAT, begin_mask=1, ellipsis_mask=0, end_mask=1, new_axis_mask=0, shrink_axis_mask=2, _device="/job:localhost/replica:0/task:0/gpu:0"](scan/while/strided_slice_1/Enter, scan/while/strided_slice_1/stack, scan/while/strided_slice_1/stack_1, scan/while/strided_slice_1/stack_2)]]
[[Node: gradients/scan/while/BiRNN/FW/FW/while/TensorArrayWriteV2_grad/TensorArrayReadV2/StackPush/_693 = _SendT=DT_FLOAT, client_terminated=false, recv_device="/job:localhost/replica:0/task:0/gpu:0", send_device="/job:localhost/replica:0/task:0/cpu:0", send_device_incarnation=1, tensor_name="edge_5093_gradients/scan/while/BiRNN/FW/FW/while/TensorArrayWriteV2_grad/TensorArrayReadV2/StackPush", _device="/job:localhost/replica:0/task:0/cpu:0"]]

Could you please help me solve this problem?
Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.