
.. _faq:

==========================
Frequently Asked Questions
==========================

TypeError: object of type 'TensorVariable' has no len()
-------------------------------------------------------

If you receive this error:

.. code-block:: python

   TypeError: object of type 'TensorVariable' has no len()

We can't implement the __len__ function on Theano Variables. This is
because Python requires that this function returns an integer, but we
can't do this as we are working with symbolic variables. You can use
`var.shape[0]` as a workaround.

Also we can't change the above error message into a more explicit one
because of some other Python internal behavior that can't be modified.


Faster gcc optimization
-----------------------

You can enable faster gcc optimization with the cxxflags. This list of flags was suggested on the mailing list::


    cxxflags=-march=native -O3 -ffast-math -ftree-loop-distribution -funroll-loops -ftracer

Use it at your own risk. Some people warned that the -ftree-loop-distribution optimization caused them wrong results in the past.
Also the -march=native must be used with care if you have NFS. In that case, you MUST set the compiledir to a local path of the computer.

Related Projects
----------------

We try to list in this `wiki page <https://github.com/Theano/Theano/wiki/Related-projects>`_ other Theano related projects.
