示例#1
0
# especially constant merge
optdb.register("merge2", gof.MergeOptimizer(), 49, "fast_run", "merge")

optdb.register("add_destroy_handler", AddDestroyHandler(), 49.5, "fast_run", "inplace")

# final pass just to make sure
optdb.register("merge3", gof.MergeOptimizer(), 100, "fast_run", "merge")

if theano.config.check_stack_trace in ["raise", "warn", "log"]:
    _tags = ("fast_run", "fast_compile")

if theano.config.check_stack_trace == "off":
    _tags = ()

optdb.register("CheckStackTrace", gof.CheckStackTraceOptimization(), -1, *_tags)
del _tags


class Mode:
    """
    The Mode represents a way to optimize and then link a computation graph.

    Parameters
    ----------
    optimizer : a structure of type Optimizer
        An Optimizer may simplify the math, put similar computations together,
        improve numerical stability and various other improvements.
    linker : a structure of type Linker
        A Linker decides which implementations to use (C or Python, for example)
        and how to string them together to perform the computation.
示例#2
0
# especially constant merge
optdb.register('merge2', gof.MergeOptimizer(), 49, 'fast_run', 'merge')

optdb.register('add_destroy_handler', AddDestroyHandler(), 49.5, 'fast_run',
               'inplace')

# final pass just to make sure
optdb.register('merge3', gof.MergeOptimizer(), 100, 'fast_run', 'merge')

if theano.config.check_stack_trace in ['raise', 'warn', 'log']:
    _tags = ('fast_run', 'fast_compile')

if theano.config.check_stack_trace == 'off':
    _tags = ()

optdb.register('CheckStackTrace', gof.CheckStackTraceOptimization(), -1,
               *_tags)
del _tags


class Mode(object):
    """
    The Mode represents a way to optimize and then link a computation graph.

    Parameters
    ----------
    optimizer : a structure of type Optimizer
        An Optimizer may simplify the math, put similar computations together,
        improve numerical stability and various other improvements.
    linker : a structure of type Linker
        A Linker decides which implementations to use (C or Python, for example)