Skip to content

Latest commit

 

History

History
 
 

python

Table of Contents generated with DocToc

PyDeepCL

Python wrapper for DeepCL

How to use

See test_clconvolve.py for an example of:

  • creating a network, with several layers
  • loading mnist data
  • training the network using a higher-level interface (NetLearner)

For examples of using lower-level entrypoints, see test_lowlevel.py:

  • creating layers directly
  • running epochs and forward/backprop directly

Notes on how the wrapper works

  • cDeepCL.pxd contains the definitions of the underlying DeepCL c++ libraries classes
  • PyDeepCL.pyx contains Cython wrapper classes around the underlying c++ classes
  • setup.py is a setup file for compiling the PyDeepCL.pyx Cython file

To install from pip

pip install DeepCL 

To build directly

Pre-requisites:

Compilers

Python packages

  • Need the following python packages installed, eg via pip install:
    • cython

To build:

cd python
python setup.py build_ext -i

Considerations for Python wrapper developers

  • By default, cython disables ctrl-c, so need to handle this ourselves somehow, eg see NetLearner.learn for an example
  • To handle ctrl-c, we need to use nogil, which means we cant use the except + syntax, I think, hence need to handle this ourselves too :-) see again `Netlearner.learn for an example