FFHT icon indicating copy to clipboard operation
FFHT copied to clipboard

Python wrapper not working

Open tgcsaba opened this issue 6 years ago • 6 comments

Hi, I am trying to use FFHT for one of my projects, as it is the fastest library for this purpose. I tried installing it with initially no success. I don't code much in C, and am not particularly familiar with the Python-C API, but after a day of googling I identified the following issues with the Python wrapper:

  • Py_InitModule3 seems to be deprecated and one should be using a combination of PyModuleDef and PyModule_Create instead. Okay, I rewrote the relevant parts of the _ffht.c file, and it installs seemingly fine, but
  • it seems like there is no return value implemented as the _ffht.c file ends with return Py_BuildValue("");

Again, I'm not really sure whether I am doing something wrong, or the second one is actually an issue. Any help is appreciated

tgcsaba avatar Jul 29 '18 19:07 tgcsaba

You're using the wrong version of python. This extension only supports Python 2, so I suggest using 2.7. Issue 19 had this problem as well. Perhaps the setup.py script should verify that sys.version_info[0] == 2 so that more people aren't confused with this error message.

dnbaker avatar Jul 30 '18 01:07 dnbaker

Ah, right, that. That's a shame. I would do the porting to Python 3 since it would surely come in handy, but I'm afraid I don't have time to learn about this right now

tgcsaba avatar Jul 30 '18 16:07 tgcsaba

Your other option is writing a Cython wrapper yourself, which would be quick and easy if you’re familiar with it.

dnbaker avatar Jul 30 '18 18:07 dnbaker

As I would like to use the transform as a Tensorflow op, I decided that I do not need a python function for it, which would kill the point due to the computational overhead caused by having to double wrap with TF. I am planning to write the op for it in C++ instead.

tgcsaba avatar Aug 03 '18 03:08 tgcsaba

@tgcsaba Do you want to make your tensorflow op public? Or even better, contribute it to the repo?

ilyaraz avatar Aug 03 '18 20:08 ilyaraz

@ilyaraz Sure. I don't know yet when I will actually get around to it because I also have a master's dissertation to write, but it should happen eventually.

tgcsaba avatar Aug 12 '18 03:08 tgcsaba