mode – controlling compilation

Guide

The mode parameter to theano.function() controls how theinputs-to-outputs graph is transformed into a callable object.

Theano defines the following modes by name:

  • 'FAST_COMPILE': Apply just a few graph optimizations and only use Python implementations.
  • 'FAST_RUN': Apply all optimizations, and use C implementations where possible.
  • 'DebugMode': A mode for debugging. See DebugMode for details.
  • 'NanGuardMode: Nan detector
  • 'DEBUG_MODE': Deprecated. Use the string DebugMode.

The default mode is typically FAST_RUN, but it can be controlled via theconfiguration variable config.mode, which can beoverridden by passing the keyword argument to theano.function().

Todo

For a finer level of control over which optimizations are applied, and whetherC or Python implementations are used, read…. what exactly?

Reference

  • theano.compile.mode.FAST_COMPILE[source]
  • class theano.compile.mode.Mode(object)[source]
  • Compilation is controlled by two attributes: the optimizer controls howan expression graph will be transformed; the linker controls how theoptimized expression graph will be evaluated.

    • optimizer[source]
    • An optimizer instance.

    • linker[source]

    • A linker instance.

    • including(*tags)[source]

    • Return a new Mode instance like this one, but with anoptimizer modified by including the given tags.

    • excluding(*tags)[source]

    • Return a new Mode instance like this one, but with anoptimizer modified by excluding the given tags.

    • requiring(*tags)[source]

    • Return a new Mode instance like this one, but with anoptimizer modified by requiring the given tags.