.. _libdoc_cuda_dnn:

================================
:mod:`sandbox.cuda.dnn` -- cuDNN
================================

.. moduleauthor:: LISA

Normally you should not call directly GPU Ops, but the CPU interface
currently do not allow all options supported by cuDNN ops. So it is
possible that you need to call them manually.

`cuDNN <https://developer.nvidia.com/cuDNN>`_ is NVIDIA library with
functionality used by deep neural network. It provide faster
implementation of some operation like the convolution. cuDNN currently
is not installed with CUDA 6.5. You must download it and install it
yourself.

To install it, decompress the downloaded file and make the ``*.h`` and
``*.so*`` files available to the compilation environment. On Linux,
this can be done by setting the environment variable
``LD_LIBRARY_PATH``, ``LIBRARY_PATH`` and ``CPATH`` to the
uncompressed directory path. They work the same way as ``PATH``. Or
you can copy the ``*.h`` files to ``/usr/include`` and the files
``*.so*`` to ``/lib64``.

By default, Theano will detect if it can use cuDNN. If so, it will use
it.  If not, Theano optimization will not introduce cuDNN op. So
Theano will still work if the user did not introduce them manually.

To get an error if Theano can not use cuDNN, use this Theano flags:
``optimizer_including=cudnn``.


Functions
=========

.. automodule:: theano.sandbox.cuda.dnn
    :members: dnn_conv, dnn_pool

Convolution Ops
===============

.. automodule:: theano.sandbox.cuda.dnn
    :members: GpuDnnConvDesc, GpuDnnConv, GpuDnnConvGradW, GpuDnnConvGradI,

Pooling Ops
===========

.. automodule:: theano.sandbox.cuda.dnn
    :members: GpuDnnPoolDesc, GpuDnnPool, GpuDnnPoolGrad,

Softmax Ops
===========

.. automodule:: theano.sandbox.cuda.dnn
    :members: GpuDnnSoftmax, GpuDnnSoftmaxGrad
