config – Theano Configuration

Guide

The config module contains many attributes that modify Theano’s behavior. Many of theseattributes are consulted during the import of the theano module and many are assumed to beread-only.

As a rule, the attributes in this module should not be modified by user code.

Theano’s code comes with default values for these attributes, but you canoverride them from your .theanorc file, and override those values in turn bythe THEANO_FLAGS environment variable.

The order of precedence is:

  • an assignment to theano.config.<property>
  • an assignment in THEANO_FLAGS
  • an assignment in the .theanorc file (or the file indicated in THEANORC) You can print out the current/effective configuration at any time by printingtheano.config. For example, to see a list of all active configurationvariables, type this from the command-line:
  1. python -c 'import theano; print(theano.config)' | less

Environment Variables

  • THEANO_FLAGS
  • This is a list of comma-delimited key=value pairs that controlTheano’s behavior.

For example, in bash, you can override your THEANORC defaultsfor .py by typing this:

  1. THEANO_FLAGS='floatX=float32,device=cuda0,lib.cnmem=1' python <myscript>.py

If a value is defined several times in THEANO_FLAGS,the right-most definition is used. So, for instance, ifTHEANO_FLAGS='device=cpu,device=cuda0', then cuda0 will be used.

  • THEANORC
  • The location[s] of the .theanorc file[s] in ConfigParser format.It defaults to $HOME/.theanorc. On Windows, it defaults to$HOME/.theanorc:$HOME/.theanorc.txt to make Windows users’ lifeeasier.

Here is the .theanorc equivalent to the THEANO_FLAGS in the example above:

  1. [global]
  2. floatX = float32
  3. device = cuda0
  4.  
  5. [lib]
  6. cnmem = 1

Configuration attributes that are available directly in config(e.g. config.device, config.mode) should be defined in the[global] section.Attributes from a subsection of config (e.g. config.lib.cnmem,config.dnn.conv.algo_fwd) should be defined in their correspondingsection (e.g. [nvcc], [dnn.conv]).

Multiple configuration files can be specified by separating them with ‘:’characters (as in $PATH). Multiple configuration files will be merged,with later (right-most) files taking priority over earlier files in thecase that multiple files specify values for a common configuration option.For example, to override system-wide settings with personal ones,set THEANORC=/etc/theanorc:~/.theanorc. To load configuration files inthe current working directory, append .theanorc to the list of configurationfiles, e.g. THEANORC=~/.theanorc:.theanorc.

Config Attributes

The list below describes some of the more common and important flagsthat you might want to use. For the complete list (including documentation),import theano and print the config variable, as in:

  1. python -c 'import theano; print(theano.config)' | less
  • config.device[source]
  • String value: either 'cpu', 'cuda', 'cuda0', 'cuda1','opencl0:0', 'opencl0:1', 'gpu', 'gpu0'

Default device for computations. If 'cuda, change the default to tryto move computation to the GPU using CUDA libraries. If 'opencl',the openCL libraries will be used. To let the driver select the device,use 'cuda' or 'opencl'. If 'gpu*', the old gpu backend willbe used, although users are encouraged to migrate to the new GpuArraybackend. If we are not able to use the GPU,either we fall back on the CPU, or an error is raised, dependingon the force_device flag.

This flag’s value cannot be modified during the program execution.

Do not use upper case letters, only lower case even if NVIDIA usescapital letters.

  • config.force_device[source]
  • Bool value: either True or False

Default: False

If True and device=gpu, we raise an error if we cannotuse the specified device. If True and device=cpu,we disable the GPU. If False and device=gpu, and if thespecified device cannot be used, we warn and fall back to the CPU.

This is useful to run Theano’s tests on a computer with a GPU, butwithout running the GPU tests.

This flag’s value cannot be modified during the program execution.

  • config.init_gpu_device[source]
  • String value: either '', 'cuda', 'cuda0', 'cuda1','opencl0:0', 'opencl0:1', 'gpu', 'gpu0'

Initialize the gpu device to use.When its value is 'cuda', 'opencl' or 'gpu', the theanoflag device must be 'cpu'.Unlike device, setting this flag to a specific GPU will nottry to use this device by default, in particular it will *not movecomputations, nor shared variables, to the specified GPU.

This flag is useful to run GPU-specific tests on a particular GPU, insteadof using the default one.

This flag’s value cannot be modified during the program execution.

  • config.pycuda.init[source]
  • Bool value: either True or False

Default: False

If True, always initialize PyCUDA when Theano want to initializethe GPU. With PyCUDA version 2011.2.2 or earlier, PyCUDA mustinitialize the GPU before Theano does it. Settingthis flag to True, ensure that, but always import PyCUDA. It canbe done manually by importing theano.misc.pycuda_init beforeTheano initialize the GPU device. Newer version of PyCUDA(currently only in the trunk) don’t have this restriction.

  • config.print_active_device[source]
  • Bool value: either True or False

Default: True

Print active device at when the GPU device is initialized.

  • config.enable_initial_driver_test[source]
  • Bool value: either True or False

Default: True

Tests the nvidia driver when a GPU device is initialized.

  • config.floatX[source]
  • String value: 'float64', 'float32', or 'float16' (with limited support)

Default: 'float64'

This sets the default dtype returned by tensor.matrix(), tensor.vector(),and similar functions. It also sets the default Theano bit width forarguments passed as Python floating-point numbers.

  • config.warn_float64[source]
  • String value: either 'ignore', 'warn', 'raise', or 'pdb'

Default: 'ignore'

When creating a TensorVariable with dtype float64, what should be done?This is useful to help find upcast to float64 in user code.

  • config.allow_gc[source]
  • Bool value: either True or False

Default: True

This sets the default for the use of the Theano garbage collectorfor intermediate results. To use less memory, Theano frees theintermediate results as soon as they are no longer needed.Disabling Theano garbage collection allows Theano to reuse buffersfor intermediate results between function calls. This speeds upTheano by no longer spending time reallocating space. This givessignificant speed up on functions with many ops that are fast toexecute, but this increases Theano’s memory usage.

  • config.scan.allow_output_prealloc[source]
  • Bool value, either True or False

Default: True

This enables, or not, an optimization in Scan in which it tries topre-allocate memory for its outputs. Enabling the optimization cangive a significant speed up with Scan at the cost of slightly increasedmemory usage.

  • config.scan.allow_gc[source]
  • Bool value, either True or False

Default: False

Allow/disallow gc inside of Scan.

If config.allow_gc is True, but config.scan.allow_gc isFalse, then we will gc the inner of scan after alliterations. This is the default.

  • config.scan.debug[source]
  • Bool value, either True or False

Default: False

If True, we will print extra scan debug information.

  • config.openmp[source]
  • Bool value: either True or False

Default: False

Enable or disable parallel computation on the CPU with OpenMP.It is the default value used when creating an Op that supports it.It is best to define it in .theanorcor in the environment variable THEANO_FLAGS.

  • config.openmp_elemwise_minsize[source]
  • Positive int value, default: 200000.

This specifies the vectors minimum size for which elemwise opsuse openmp, if openmp is enabled.

  • config.cast_policy[source]
  • String value: either 'numpy+floatX' or 'custom'

Default: 'custom'

This specifies how data types are implicitly figured out in Theano, e.g. forconstants or in the results of arithmetic operations. The ‘custom’ valuecorresponds to a set of custom rules originally used inTheano (which can be partially customized, see e.g. the in-code help oftensor.NumpyAutocaster), and will be deprecated in the future.The ‘numpy+floatX’ setting attempts to mimic the numpy casting rules,although it prefers to use float32 numbers instead of float64 whenconfig.floatX is set to ‘float32’ and the user uses data that is notexplicitly typed as float64 (e.g. regular Python floats).Note that ‘numpy+floatX’ is not currently behaving exactly as planned (itis a work-in-progress), and thus you should consider it as experimental.At the moment it behaves differently from numpy in the followingsituations:

  • Depending on the value of config.int_division, the resulting typeof a division of integer types with the / operator may not matchthat of numpy.
  • On mixed scalar / array operations, numpy tries to prevent the scalarfrom upcasting the array’s type unless it is of a fundamentallydifferent type. Theano does not attempt to do the same at this point,so you should be careful that scalars may upcast arrays when theywould not when using numpy. This behavior should change in the nearfuture.
  • config.int_division[source]
  • String value: either 'int', 'floatX', or 'raise'

Default: 'int'

Specifies what to do when one tries to compute x / y, where both x andy are of integer types (possibly unsigned). ‘int’ means an integer isreturned (as in Python 2.X), but this behavior is deprecated. ‘floatX’returns a number of type given by config.floatX. ‘raise’ is the safestchoice (and will become default in a future release of Theano) and raisesan error when one tries to do such an operation, enforcing the use of theinteger division operator (//) (if a float result is intended, eithercast one of the arguments to a float, or use x.truediv(y)).

  • config.mode[source]
  • String value: 'Mode', 'DebugMode', 'FAST_RUN','FAST_COMPILE'

Default: 'Mode'

This sets the default compilation mode for theano functions. By default themode Mode is equivalent to FAST_RUN. See Config attribute linker and optimizer.

  • config.profile[source]
  • Bool value: either True or False

Default: False

Do the vm/cvm linkers profile the execution time of Theano functions?

See Profiling Theano function for examples.

  • config.profile_memory[source]
  • Bool value: either True or False

Default: False

Do the vm/cvm linkers profile the memory usage of Theano functions?It only works when profile=True.

  • config.profile_optimizer[source]
  • Bool value: either True or False

Default: False

Do the vm/cvm linkers profile the optimization phase when compiling a Theano function?It only works when profile=True.

  • config.profiling.n_apply[source]
  • Positive int value, default: 20.

The number of Apply nodes to print in the profiler output

  • config.profiling.n_ops[source]
  • Positive int value, default: 20.

The number of Ops to print in the profiler output

  • config.profiling.min_memory_size[source]
  • Positive int value, default: 1024.

For the memory profile, do not print Apply nodes if the sizeof their outputs (in bytes) is lower than this.

  • config.profiling.min_peak_memory[source]
  • Bool value: either True or False

Default: False

Does the memory profile print the min peak memory usage?It only works when profile=True, profile_memory=True

  • config.profiling.destination[source]
  • String value: 'stderr', 'stdout', or a name of afile to be created

Default: 'stderr'

Name of the destination file for the profiling output.The profiling output can be either directed to stderr(default), or stdout or an arbitrary file.

  • config.profiling.debugprint[source]
  • Bool value: either True or False

Default: False

Do a debugprint of the profiled functions

  • config.profiling.ignore_first_call[source]
  • Bool value: either True or False

Default: False

Do we ignore the first call to a Theano function while profiling.

  • config.lib.amdlibm[source]
  • Bool value: either True or False

Default: False

This makes the compilation use theamdlibmlibrary, which is faster than the standard libm.

  • config.gpuarray.preallocate[source]
  • Float value

Default: 0 (Preallocation of size 0, only cache the allocation)

Controls the preallocation of memory with the gpuarray backend.

The value represents the start size (either in MB or the fractionof total GPU memory) of the memory pool. If more memory is needed,Theano will try to obtain more, but this can cause memoryfragmentation.

A negative value will completely disable the allocation cache.This can have a severe impact on performance and so should not bedone outside of debugging.

  • < 0: disabled
  • 0 <= N <= 1: use this fraction of the total GPU memory (clipped to .95 for driver memory).
  • > 1: use this number in megabytes (MB) of memory.

Note

This value allocates GPU memory ONLY when using (GpuArray Backend).For the old backend, please see config.lib.cnmem

Note

This could cause memory fragmentation. So if you have a memoryerror while using the cache, try to allocate more memory atthe start or disable it. If you try this, report your resulton :reftheano-dev.

Note

The clipping at 95% can be bypassed by specifing the exactnumber of megabytes. If more then 95% are needed, it will tryautomatically to get more memory. But this can causefragmentation, see note above.

Note

This value allocates GPU memory ONLY when using (CUDA backend)and has no effect when the GPU backend is (GpuArray Backend).For the new backend, please see config.gpuarray.preallocate

Float value: >= 0

Controls the use of CNMeM (afaster CUDA memory allocator). Applies to the old GPU backendCUDA backend up to Theano release 0.8.

The CNMeM library is included in Theano and does not need to beseparately installed.

The value represents the start size (either in MB or the fraction of total GPUmemory) of the memory pool. If more memory is needed, Theano willtry to obtain more, but this can cause memory fragmentation.

  • 0: not enabled.
  • 0 < N <= 1: use this fraction of the total GPU memory (clipped to .95 for driver memory).
  • > 1: use this number in megabytes (MB) of memory.

Default: 0

Note

This could cause memory fragmentation. So if you have amemory error while using CNMeM, try to allocate more memory atthe start or disable it. If you try this, report your resulton :reftheano-dev.

Note

The clipping at 95% can be bypassed by specifing the exactnumber of megabytes. If more then 95% are needed, it will tryautomatically to get more memory. But this can causefragmentation, see note above.

  • config.gpuarray.sched[source]
  • String value: 'default', 'multi', 'single'

Default: 'default'

Control the stream mode of contexts.

The sched parameter passed for context creation to pygpu. WithCUDA, using “multi” mean using the parametercudaDeviceScheduleYield. This is useful to lower the CPU overheadwhen waiting for GPU. One user found that it speeds up his otherprocesses that was doing data augmentation.

  • config.gpuarray.single_stream[source]
  • Boolean value

Default: True

Control the stream mode of contexts.

If your computations are mostly lots of small elements, usingsingle-stream will avoid the synchronization overhead and usuallybe faster. For larger elements it does not make a difference yet.In the future when true multi-stream is enabled in libgpuarray,this may change. If you want to make sure to have optimalperformance, check both options.

  • config.linker[source]
  • String value: 'c|py', 'py', 'c', 'c|py_nogc'

Default: 'c|py'

When the mode is Mode, it sets the default linker used.See Configuration Settings and Compiling Modes for a comparison of the different linkers.

  • config.optimizer[source]
  • String value: 'fast_run', 'merge', 'fast_compile', 'None'

Default: 'fast_run'

When the mode is Mode, it sets the default optimizer used.

String value: 'warn', 'raise', 'pdb' or 'ignore'

Default: 'warn'

When a crash occurs while trying to apply some optimization, either warn the user and skip this optimization (‘warn’), raise the exception (‘raise’), fall into the pdb debugger (‘pdb’) or ignore it (‘ignore’). We suggest to never use ‘ignore’ except in tests.

If you encounter a warning, report it on theano-dev.

  • config.assert_no_cpu_op[source]
  • String value: 'ignore' or 'warn' or 'raise' or 'pdb'

Default: 'ignore'

If there is a CPU op in the computational graph, depending on its value;this flag can either raise a warning, an exception or stop thecompilation with pdb.

  • config.on_shape_error[source]
  • String value: 'warn' or 'raise'

Default: 'warn'

When an exception is raised when inferring the shape of some applynode, either warn the user and use a default value (‘warn’), orraise the exception (‘raise’).

  • config.warn.ignore_bug_before[source]
  • String value: 'None', 'all', '0.3', '0.4', '0.4.1', '0.5','0.6', '0.7', '0.8', '0.8.1', '0.8.2', '0.9'

Default: '0.7'

When we fix a Theano bug that generated bad results under somecircumstances, we also make Theano raise a warning when it encountersthe same circumstances again. This helps to detect if said bughad affected your past experiments, as you only need to run yourexperiment again with the new version, and you do not have tounderstand the Theano internal that triggered the bug. A betterway to detect this will be implemented. See this ticket.

This flag allows new users not to get warnings about old bugs, that werefixed before their first checkout of Theano.You can set its value to the first version of Theanothat you used (probably 0.3 or higher)

'None' means that all warnings will be displayed.'all' means all warnings will be ignored.

It is recommended that you put a version, so that you will see futurewarnings.It is also recommended you put this into your .theanorc, so this settingwill always be used.

This flag’s value cannot be modified during the program execution.

  • config.base_compiledir[source]
  • Default: On Windows: $LOCALAPPDATA\Theano if $LOCALAPPDATA is defined,otherwise and on other systems: ~/.theano.

This directory stores the platform-dependent compilation directories.

This flag’s value cannot be modified during the program execution.

  • config.compiledir_format[source]
  • Default: "compiledir_%(platform)s-%(processor)s-%(python_version)s-%(python_bitwidth)s"

This is a Python format string that specifies the subdirectoryof config.base_compiledir in which to store platform-dependentcompiled modules. To see a list of all available substitution keys,run python -c "import theano; print(theano.config)", and lookfor compiledir_format.

This flag’s value cannot be modified during the program execution.

  • config.compiledir[source]
  • Default: config.base_compiledir/config.compiledir_format

This directory stores dynamically-compiled modules for a particularplatform.

This flag’s value cannot be modified during the program execution.

  • config.blas.ldflags[source]
  • Default: '-lblas'

Link arguments to link against a (Fortran) level-3 blasimplementation. The default will test if '-lblas' works. If not,we will disable our C code for BLAS.

  • config.experimental.local_alloc_elemwise_assert[source]
  • Bool value: either True or False

Default: True

When the local_alloc_optimization is applied, add an assert to highlightshape errors.

Without such asserts this optimization could hide errors in the user code.We add the assert only if we can’t infer that the shapes are equivalent.As such this optimization does not always introduce an assert in the graph.Removing the assert could speed up execution.

  • config.cuda.root[source]
  • Default: $CUDA_ROOT or failing that, "/usr/local/cuda"

A directory with bin/, lib/, include/ folders containing cuda utilities.

  • config.cuda.enabled[source]
  • Bool value: either True of False

Default: True

If set to False, C code in old backend is not compiled.

  • config.dnn.enabled[source]
  • String value: 'auto', 'True', 'False'

Default: 'auto'

If 'auto', automatically detect and usecuDNN if it is available.If cuDNN is unavailable, raise no error.

If 'True', require the use of cuDNN. If cuDNN is unavailable, raise an error.

If 'False', do not use cuDNN or check if it is available.

  • config.conv.assert_shape[source]
  • If True, AbstractConv* ops will verify that user-providedshapes match the runtime shapes (debugging option,may slow down compilation)
  • config.dnn.conv.algo_fwd[source]
  • String value:'small', 'none', 'large', 'fft', 'fft_tiling','winograd', 'guess_once', 'guess_on_shape_change','time_once', 'time_on_shape_change'.

Default: 'small'

3d convolution only support 'none', 'winograd', 'guess_once','guess_on_shape_change', 'time_once', 'time_on_shape_change'.

  • config.dnn.conv.algo_bwd_filter[source]
  • String value:'none', 'deterministic', 'fft', 'small', 'guess_once','guess_on_shape_change', 'time_once', 'time_on_shape_change'.

Default: 'none'

3d convolution only supports 'none', 'guess_once','guess_on_shape_change', 'time_once', 'time_on_shape_change'.

  • config.dnn.conv.algo_bwd_data[source]
  • String value:'none', 'deterministic', 'fft', 'fft_tiling', 'winograd','guess_once', 'guess_on_shape_change', 'time_once','time_on_shape_change'.

Default: 'none'

3d convolution only support 'none', 'winograd','guess_once', 'guess_on_shape_change', 'time_once','time_on_shape_change'.

Extra parameters to pass to gcc when compiling. Extra include paths,library paths, configuration options, etc.

  • config.cxx[source]
  • Default: Full path to g++ if g++ is present. Empty string otherwise.

Indicates which C++ compiler to use. If empty, no C++ code iscompiled. Theano automatically detects whether g++ is present anddisables C++ compilation when it is not. On darwin systems (MacOS X), it preferably looks for clang++ and uses that if available.

We print a warning if we detect that no compiler is present. It isrecommended to run with C++ compilation as Theano will be muchslower otherwise.

This can be any compiler binary (full path or not) but things maybreak if the interface is not g++-compatible to some degree.

  • config.nvcc.fastmath[source]
  • Bool value, default: False

If true, this will enable fastmath (—use-fast-math)mode for compiled cuda code which makes div and sqrt faster at thecost of precision. This also disables support for denormalnumbers. This can cause NaN. So if you have NaN and use this flag,try to disable it.

  • config.optimizer_excluding[source]
  • Default: ""

A list of optimizer tags that we don’t want included in the default Mode.If multiple tags, separate them by ‘:’.Ex: to remove the elemwise inplace optimizer(slow for big graph),use the flags: optimizer_excluding:inplace_opt, whereinplace_opt is the name of that optimization.

This flag’s value cannot be modified during the program execution.

  • config.optimizer_including[source]
  • Default: ""

A list of optimizer tags that we want included in the default Mode.If multiple tags, separate them by ‘:’.

This flag’s value cannot be modified during the program execution.

  • config.optimizer_requiring[source]
  • Default: ""

A list of optimizer tags that we require for optimizer in the default Mode.If multiple tags, separate them by ‘:’.

This flag’s value cannot be modified during the program execution.

  • config.optimizer_verbose[source]
  • Bool value: either True or False

Default: False

When True, we print on the stdout the optimization applied.

  • config.nocleanup[source]
  • Bool value: either True or False

Default: False

If False, source code files are removed when they are not needed anymore.This means files whose compilation failed are deleted.Set to True to keep those files in order to debug compilation errors.

  • config.compile[source]
  • This section contains attributes which influence the compilation ofC code for ops. Due to historical reasons many attributes outsideof this section also have an influence over compilation, mostnotably ‘cxx’. This is not expected to change any time soon.
  • config.compile.timeout[source]
  • Positive int value, default: compile.wait * 24

Time to wait before an unrefreshed lock is broken and stolen. Thisis in place to avoid manual cleanup of locks in case a processcrashed and left a lock in place.

The refresh time is automatically set to half the timeout value.

  • config.compile.wait[source]
  • Positive int value, default: 5

Time to wait between attempts at grabbing the lock if the firstattempt is not successful. The actual time will be betweencompile.wait and compile.wait * 2 to avoid acrowding effect on lock.

  • config.DebugMode[source]
  • This section contains various attributes configuring the behaviourof mode DebugMode. See directly this sectionfor the documentation of more configuration options.
  • config.DebugMode.check_preallocated_output[source]
  • Default: ''

A list of kinds of preallocated memory to use as output buffers foreach Op’s computations, separated by :. Implemented modes are:

  • "initial": initial storage present in storage map(for instance, it can happen in the inner function of Scan),
  • "previous": reuse previously-returned memory,
  • "c_contiguous": newly-allocated C-contiguous memory,
  • "f_contiguous": newly-allocated Fortran-contiguous memory,
  • "strided": non-contiguous memory with various stride patterns,
  • "wrong_size": memory with bigger or smaller dimensions,
  • "ALL": placeholder for all of the above. In order not to test with preallocated memory, use an empty string, "".
  • config.DebugMode.check_preallocated_output_ndim[source]
  • Positive int value, default: 4.

When testing with “strided” preallocated output memory, testall combinations of strides over that number of (inner-most)dimensions. You may want to reduce that number to reduce memory ortime usage, but it is advised to keep a minimum of 2.

  • config.DebugMode.warn_input_not_reused[source]
  • Bool value, default: True

Generate a warning when the destroy_map or view_map tell that an op workinplace, but the op did not reuse the input for its output.

  • config.NanGuardMode.nan_is_error[source]
  • Bool value, default: True

Controls whether NanGuardMode generates an error when it sees a nan.

  • config.NanGuardMode.inf_is_error[source]
  • Bool value, default: True

Controls whether NanGuardMode generates an error when it sees an inf.

  • config.NanGuardMode.big_is_error[source]
  • Bool value, default: True

Controls whether NanGuardMode generates an error when it sees abig value (>1e10).

  • config.numpy[source]
  • This section contains different attributes for configuring NumPy’sbehaviour, described by numpy.seterr.
  • config.numpy.seterr_all[source]
  • String Value: 'ignore', 'warn', 'raise', 'call','print', 'log', 'None'

Default: 'ignore'

Set the default behaviour described by numpy.seterr.

'None' means that numpy’s default behaviour will not be changed (unlessone of the other config.numpy.seterr_* overrides it), but this behaviourcan change between numpy releases.

This flag sets the default behaviour for all kinds of floating-ponterrors, and it can be overriden for specific errors by setting one(or more) of the flags below.

This flag’s value cannot be modified during the program execution.

  • config.numpy.seterr_divide[source]
  • String Value: 'None', 'ignore', 'warn', 'raise','call', 'print', 'log'

Default: 'None'

Sets numpy’s behavior for division by zero. 'None' means using thedefault, defined by config.numpy.seterr_all.

This flag’s value cannot be modified during the program execution.

  • config.numpy.seterr_over[source]
  • String Value: 'None', 'ignore', 'warn', 'raise','call', 'print', 'log'

Default: 'None'

Sets numpy’s behavior for floating-point overflow. 'None' meansusing the default, defined by config.numpy.seterr_all.

This flag’s value cannot be modified during the program execution.

  • config.numpy.seterr_under[source]
  • String Value: 'None', 'ignore', 'warn', 'raise','call', 'print', 'log'

Default: 'None'

Sets numpy’s behavior for floating-point underflow. 'None' meansusing the default, defined by config.numpy.seterr_all.

This flag’s value cannot be modified during the program execution.

  • config.numpy.seterr_invalid[source]
  • String Value: 'None', 'ignore', 'warn', 'raise','call', 'print', 'log'

Default: 'None'

Sets numpy’s behavior for invalid floating-point operation. 'None'means using the default, defined by config.numpy.seterr_all.

This flag’s value cannot be modified during the program execution.

  • config.compute_test_value[source]
  • String Value: 'off', 'ignore', 'warn', 'raise'.

Default: 'off'

Setting this attribute to something other than 'off' activates adebugging mechanism, where Theano executes the graph on-the-fly, as it isbeing built. This allows the user to spot errors early on (such asdimension mis-match), before optimizations are applied.

Theano will execute the graph using the Constants and/or shared variablesprovided by the user. Purely symbolic variables (e.g. x = T.dmatrix()) can beaugmented with test values, by writing to their 'tag.test_value'attribute (e.g. x.tag.test_value = numpy.random.rand(5, 4)).

When not 'off', the value of this option dictates what happens whenan Op’s inputs do not provide appropriate test values:

  • 'ignore' will silently skip the debug mechanism for this Op
  • 'warn' will raise a UserWarning and skip the debug mechanism for this Op
  • 'raise' will raise an Exception
  • config.compute_test_value_opt[source]
  • As compute_test_value, but it is the value used during Theanooptimization phase. Theano user’s do not need to use this. This isto help debug shape error in Theano optimization.
  • config.print_test_value[source]
  • Bool value, default: False

If 'True', Theano will override the str method of its variablesto also print the tag.test_value when this is available.

  • config.reoptimize_unpickled_function[source]
  • Bool value, default: False (changed in master after Theano 0.7 release)

Theano users can use the standard python pickle tools to save a compiledtheano function. When pickling, both graph before and after the optimizationare saved, including shared variables. When set to True, the graph isreoptimized when being unpickled. Otherwise, skip the graph optimization anduse directly the optimized graph.

  • config.exception_verbosity[source]
  • String Value: 'low', 'high'.

Default: 'low'

If 'low', the text of exceptions will generally refer to apply nodeswith short names such as 'Elemwise{add_no_inplace}'. If 'high',some exceptions will also refer to apply nodes with long descriptions like:

  1. A. Elemwise{add_no_inplace}
  2. B. log_likelihood_v_given_h
  3. C. log_likelihood_h
  • config.cmodule.warn_no_version[source]
  • Bool value, default: False

If True, will print a warning when compiling one or more Op with Ccode that can’t be cached because there is no c_code_cache_version()function associated to at least one of those Ops.

  • config.cmodule.remove_gxx_opt[source]
  • Bool value, default: False

If True, will remove the -O* parameter passed to g++.This is useful to debug in gdb modules compiled by Theano.The parameter -g is passed by default to g++.

  • config.cmodule.compilation_warning[source]
  • Bool value, default: False

If True, will print compilation warnings.

  • config.cmodule.preload_cache[source]
  • Bool value, default: False

If set to True, will preload the C module cache at import time

  • config.cmodule.age_thresh_use[source]
  • Int value, default: 60 60 24 * 24 # 24 days

In seconds. The time after which a compiled c module won’t bereused by Theano. Automatic deletion of those c module 7 daysafter that time.

  • config.traceback.limit[source]
  • Int value, default: 8

The number of user stack level to keep for variables.

  • config.traceback.compile_limit[source]
  • Bool value, default: 0

The number of user stack level to keep for variables during Theanocompilation. If higher then 0, will make us keep Theano internalstack trace.