jingli9111/EUNN-tensorflow

White space/formatting problems on permuted MNIST task

AjayTalati opened this issue ยท 4 comments

Hi Li,

this work is really cool, thank you very much for posting it! I ran the copy task, and it's great!

I just tried to run the MNIST task, but I seem to have some problems with white spaces/formatting. In particular I get lots of errors like this,

(pyphi) ajay@ajay-h8-1170uk:~/PythonProjects/EUNN-tensorflow-master$ python mnist_task.py EURNN -I 2000 -B 128 -H 128 -L 4 -C True 
  File "mnist_task.py", line 64
    ind = range(784)
                   ^
TabError: inconsistent use of tabs and spaces in indentation
(pyphi) ajay@ajay-h8-1170uk:~/PythonProjects/EUNN-tensorflow-master$ 

Could you please check the formatting of that file? I'd like to run it on your MNIST task, before trying to replace LSTM in other tasks. I don't like LSTM, it's too weird for me!

I'm using python 3.6.0 if that helps?

Thanks a lot for your help,

Aj

Hi Ajaj,

I fixed the indentation bug. It should work now.
BTW, I only tested everything in python 2.7. But it should work for python3, too.

Thank you so much for your interests in our work! Let me know if it helps!

Li

Hi Li,

thank you very much for fixing the indentation bug. It helps!

Also I tried to convert the directory using 2to3 with a command something like,

2to3 --output-dir=/home/ajay/PythonProjects/EUNN-tensorflow-master/EUNN -W -n /home/ajay/PythonProjects/EUNN-tensorflow-master

I get a new error now though when trying to run the permuted MNIST task, with

python mnist_task.py EURNN -I 2000 -B 128 -H 128 -L 4 -C True

Traceback (most recent call last):
  File "mnist_task.py", line 224, in <module>
    main(**kwargs)
  File "mnist_task.py", line 83, in main
    cell = EURNNCell(n_hidden, capacity, FFT, comp)
  File "/home/ajay/PythonProjects/EUNN-tensorflow-master/EUNN/EURNN.py", line 37, in __init__
    self.v1, self.v2, self.ind, self.diag, self._capacity = EUNN_param(hidden_size, capacity, FFT, comp)
  File "/home/ajay/PythonProjects/EUNN-tensorflow-master/EUNN/EUNN.py", line 173, in EUNN_param
    cos_list_1_re = array_ops.concat([np.ones((capacity/2,1)), cos_theta_1, math_ops.multiply(cos_theta_1, cos_phi_1), np.ones((capacity/2,1))], 1)
  File "/home/ajay/anaconda3/envs/pyphi/lib/python3.6/site-packages/numpy/core/numeric.py", line 192, in ones
    a = empty(shape, dtype, order)
TypeError: 'float' object cannot be interpreted as an integer

This seems strange because the copy task works fine ๐Ÿ‘ , and the MNIST task using LSTM starts to train using,

python mnist_task.py LSTM -I 2000 -B 128 -H 128 -L 4 -C True

Any help is gratefully recieved - I'm enjoying reading your paper and code - looking forward to experimenting with UNN on different tasks!

Best regards,

Aj

Hi Ajay,

I fixed the problem. It's all coming from the difference of python2 and python3.
In detail, it's just int/int will return float in python3 instead of int in python2.

It is now able to run for both python2 and 3.

Li.

Dear Li,

thank you very much for the solution.

I'm still going through the paper - it's fascinating ๐Ÿ‘ - really hope you guys get it published soon!

I'll try the code tomorrow, and close this issue.

Hopefully I'll be able to apply it to other datasets - I play around with a toy Markov chain generator, that the EUNN should be able to crush much faster than LSTM. Will let you know how it goes.

Kind regards,

Ajay.