Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to update scan Cython code in Theano?

when I use following ways to update ,there is some problem, system told me "missing header for unified diff at line 1 of patch

cd theano/scan_module/
cython scan_perform.pyx
patch scan_perform.c numpy_api_changes.diff

enter image description here

by the way, the reason I want to update is that when I used theano in windows anaconda environment, system told me "UserWarning: The file scan_perform.c is not available. This donot happen normally." I find the above method at:https://github.com/Theano/Theano/blob/master/theano/scan_module/scan_perform_ext.py then use following ways install patch command

conda install patch 

enter image description here

how to solve this problem?

like image 440
andy Avatar asked Nov 22 '18 03:11

andy


1 Answers

I was able to disable this warning by following these steps:

  1. Go to the releases page of Theano, click on the commit hash corresponding to the version of Theano you have installed, and then on "Browse Files". In my case, since I have Theano 1.0.3, I used the hash 65fefc3.
  2. Navigate to theano/scan_module/c_code in the github repo (corresponding to this URL in my case), and download the contents of the file scan_perform.c into a file with the same name.

  3. Go to wherever the Theano source files are located in your machine. In my case since I was using anaconda they were in:

    /home/<username>/miniconda3/envs/<env_name>/lib/python2.7/site-packages/theano
    
  4. Once there, navigate to the scan_module directory, create a directory called c_code, and cd into it.

  5. Paste the scan_perform.c file you just downloaded into this directory.

When executing Theano again you shouldn't see the warning anymore.

like image 135
jabalazs Avatar answered Nov 14 '22 21:11

jabalazs