提交 6796db42 authored 作者: Brandon T. Willard's avatar Brandon T. Willard

Apply isort to theano.gof sub-package modules

上级 1c28df91
"""Graph optimization framework"""
from theano.gof.cc import CLinker, OpWiseCLinker, DualLinker, HideC
from theano.gof.fg import (
InconsistencyError,
MissingInputError,
FunctionGraph,
)
import theano
from theano.gof.cc import CLinker, DualLinker, HideC, OpWiseCLinker
from theano.gof.destroyhandler import DestroyHandler
from theano.gof.graph import Apply, Variable, Constant, view_roots
from theano.gof.fg import FunctionGraph, InconsistencyError, MissingInputError
from theano.gof.graph import Apply, Constant, Variable, view_roots
from theano.gof.link import (
Container,
Linker,
......@@ -21,58 +13,48 @@ from theano.gof.link import (
WrapLinker,
WrapLinkerMany,
)
from theano.gof.op import (
COp,
Op,
OpenMPOp,
PureOp,
COp,
ops_with_inner_function,
get_test_value,
ops_with_inner_function,
)
from theano.gof.type import EnumType, EnumList, CEnumType
from theano.gof.opt import (
Optimizer,
optimizer,
inplace_optimizer,
SeqOptimizer,
MergeOptimizer,
LocalOptimizer,
local_optimizer,
CheckStackTraceOptimization,
EquilibriumOptimizer,
LocalOptGroup,
OpSub,
LocalOptimizer,
MergeOptimizer,
NavigatorOptimizer,
OpKeyOptimizer,
OpRemove,
OpSub,
Optimizer,
PatternSub,
NavigatorOptimizer,
SeqOptimizer,
TopoOptimizer,
EquilibriumOptimizer,
OpKeyOptimizer,
CheckStackTraceOptimization,
inplace_optimizer,
local_optimizer,
optimizer,
)
from theano.gof.optdb import DB, LocalGroupDB, Query, EquilibriumDB, SequenceDB, ProxyDB
from theano.gof.optdb import DB, EquilibriumDB, LocalGroupDB, ProxyDB, Query, SequenceDB
from theano.gof.params_type import Params, ParamsType
from theano.gof.toolbox import (
Feature,
Bookkeeper,
Feature,
History,
Validator,
ReplaceValidate,
NodeFinder,
NoOutputFromInplace,
PrintListener,
ReplacementDidntRemovedError,
NoOutputFromInplace,
ReplaceValidate,
Validator,
)
from theano.gof.type import CEnumType, EnumList, EnumType, Generic, Type, generic
from theano.gof.utils import MethodNotDefined, hashtype, object2
from theano.gof.type import Type, Generic, generic
from theano.gof.utils import hashtype, object2, MethodNotDefined
from theano.gof.params_type import ParamsType, Params
import theano
if theano.config.cmodule.preload_cache:
from theano.gof.cc import get_module_cache
......
import logging
import six.moves.cPickle as pickle
_logger = logging.getLogger("theano.gof.callcache")
......
......@@ -2,25 +2,21 @@
Defines Linkers that deal with C implementations.
"""
import logging
import os
import sys
import logging
import numpy as np
import theano
from copy import copy
from six import string_types, reraise
import numpy as np
from six import reraise, string_types
from six.moves import StringIO
import theano
from theano import config
from theano.compat import PY3
from theano.gof import graph, link, utils, cmodule
from theano.gof.compilelock import get_lock, release_lock
from theano.gof import cmodule, graph, link, utils
from theano.gof.callcache import CallCache
from theano.gof.compilelock import get_lock, release_lock
_logger = logging.getLogger("theano.gof.cc")
......
......@@ -3,37 +3,34 @@ Generate and compile C modules for Python.
"""
import atexit
import textwrap
import six.moves.cPickle as pickle
import distutils.sysconfig
import logging
import os
import platform
import re
import shutil
import stat
import subprocess
import sys
import tempfile
import textwrap
import time
import platform
import distutils.sysconfig
import warnings
import numpy.distutils
import six.moves.cPickle as pickle
from six import BytesIO, StringIO, b, string_types
import theano
from six import b, BytesIO, StringIO, string_types
from theano import config
from theano.compat import PY3, decode, decode_iter
from theano.gof.utils import flatten
from theano.gof.utils import hash_from_code
from theano.misc.windows import subprocess_Popen, output_subprocess_Popen
from theano.configdefaults import gcc_version_str, local_bitwidth
# we will abuse the lockfile mechanism when reading and writing the registry
from theano.gof import compilelock
from theano.configdefaults import gcc_version_str, local_bitwidth
from theano.gof.utils import flatten, hash_from_code
from theano.misc.windows import output_subprocess_Popen, subprocess_Popen
importlib = None
try:
......
import logging
import os
import shutil
import logging
import six.moves.cPickle as pickle
import numpy as np
import theano
import six.moves.cPickle as pickle
from six import string_types
import theano
from theano import config
from theano.gof.utils import flatten
......
......@@ -3,20 +3,18 @@ Locking mechanism to ensure no two compilations occur simultaneously
in the same compilation directory (which can cause crashes).
"""
import atexit
import logging
import os
import socket # only used for gethostname()
import time
import logging
from contextlib import contextmanager
import numpy as np
from six import PY3
from contextlib import contextmanager
from theano import config
random = np.random.RandomState([2015, 8, 2])
_logger = logging.getLogger("theano.gof.compilelock")
......
......@@ -2,11 +2,13 @@ import errno
import os
import sys
from theano import config
from theano.compat import PY3
from theano.gof.compilelock import get_lock, release_lock
from theano import config
from . import cmodule
# TODO These two lines may be removed in the future, when we are 100% sure
# no one has an old cutils_ext.so lying around anymore.
if os.path.exists(os.path.join(config.compiledir, "cutils_ext.so")):
......
......@@ -4,16 +4,13 @@ and inplace operations.
"""
import itertools
from collections import OrderedDict, deque
import theano
from collections import deque, OrderedDict
from theano import config
from theano.misc.ordered_set import OrderedSet
from . import toolbox
from . import graph
from . import graph, toolbox
from .fg import InconsistencyError
......
......@@ -5,18 +5,17 @@ types that it can raise.
"""
import time
import theano
from collections import OrderedDict
from six.moves import StringIO
import theano
from theano import config
from theano.gof import graph, utils, toolbox
from theano.gof.utils import get_variable_trace_string, TestValueError
from theano.gof import graph, toolbox, utils
from theano.gof.utils import TestValueError, get_variable_trace_string
from theano.misc.ordered_set import OrderedSet
NullType = None
......
......@@ -3,27 +3,26 @@ Node classes (`Apply`, `Variable`) and expression graph algorithms.
"""
import contextlib
import warnings
import theano
from collections import deque
from copy import copy
from itertools import count
from six import string_types, integer_types
from six import integer_types, string_types
import theano
from theano import config
from theano.gof.utils import (
TestValueError,
object2,
MethodNotDefined,
Scratchpad,
TestValueError,
ValidatingScratchpad,
get_variable_trace_string,
add_tag_trace,
get_variable_trace_string,
object2,
)
from theano.misc.ordered_set import OrderedSet
__docformat__ = "restructuredtext en"
NoParams = object()
......
import errno
import logging
import os
from six.moves import reload_module as reload
import sys
import warnings
from six.moves import reload_module as reload
import theano
from theano import config
from theano.gof.compilelock import get_lock, release_lock
from theano.gof import cmodule
from theano.gof.compilelock import get_lock, release_lock
_logger = logging.getLogger("theano.gof.lazylinker_c")
......
import sys
import traceback
import numpy as np
import theano
from sys import getsizeof
from copy import copy, deepcopy
from sys import getsizeof
import numpy as np
from six import reraise
from six.moves import StringIO
from theano.gof import utils
from theano.gof import graph
import theano
from theano.gof import graph, utils
from theano.gof.type import Type
from .utils import undef
__excepthook = sys.excepthook
......
......@@ -5,29 +5,29 @@ The `Op` class is the base interface for all operations
compatible with `gof`'s :doc:`graph` routines.
"""
import inspect
import logging
import os
import re
import sys
import inspect
import logging
import warnings
import numpy as np
import theano
import theano.gof.cc
from theano import config
from theano.gof import graph
from theano.gof.cmodule import GCC_compiler
from theano.gof.fg import FunctionGraph
from theano.gof.utils import (
object2,
TestValueError,
get_variable_trace_string,
MethodNotDefined,
TestValueError,
add_tag_trace,
get_variable_trace_string,
object2,
)
from theano.gof.cmodule import GCC_compiler
from theano.gof.fg import FunctionGraph
__authors__ = "theano-dev"
__copyright__ = "(c) 2010, Universite de Montreal"
......
......@@ -3,7 +3,6 @@ Defines the base class for optimizations as well as a certain
amount of useful generic optimization tools.
"""
from collections import deque, defaultdict, OrderedDict
import contextlib
import copy
import inspect
......@@ -11,25 +10,23 @@ import logging
import pdb
import sys
import time
import warnings
import traceback
import warnings
from collections import OrderedDict, defaultdict, deque
from functools import reduce
import numpy as np
from six import integer_types, string_types
import theano
from functools import reduce
from six import string_types, integer_types
from theano import config
from theano.gof import graph, op, utils, unify, toolbox
from theano.gof import graph, op, toolbox, unify, utils
from theano.gof.fg import InconsistencyError
from theano.misc.ordered_set import OrderedSet
from . import destroyhandler as dh
_logger = logging.getLogger("theano.gof.opt")
_optimizer_idx = [0]
......
import copy
import sys
import math
import sys
from theano.compat import DefaultOrderedDict
from theano.misc.ordered_set import OrderedSet
from six import StringIO, integer_types
from theano.gof import opt
from theano import config
from theano.compat import DefaultOrderedDict
from theano.gof import opt
from theano.misc.ordered_set import OrderedSet
class DB(object):
......
......@@ -113,10 +113,11 @@ for more info about enumeration aliases).
"""
import re
import hashlib
import re
from theano.gof.type import EnumType, Type
from theano.gof.utils import MethodNotDefined, c_cpp_keywords
from theano.gof import Type, EnumType
class Params(dict):
......
......@@ -3,6 +3,7 @@ from collections import defaultdict
from theano.compat import cmp
from theano.gof.graph import list_of_nodes
# {{{ http://code.activestate.com/recipes/578231/ (r1)
# Copyright (c) Oren Tirosh 2012
#
......
import sys
import copy
import time
import inspect
import numpy as np
import theano
from functools import partial
import sys
import time
from collections import OrderedDict
from functools import partial
import numpy as np
from six.moves import StringIO
import theano
from theano import config
from theano.gof.graph import (
inputs,
io_toposort,
equal_computations,
variables,
)
from theano.gof.graph import equal_computations, inputs, io_toposort, variables
class AlreadyThere(Exception):
......
......@@ -8,19 +8,20 @@ Defines the `Type` class.
import ctypes
import platform
import re
from six import string_types
import re
import theano
from theano.gof import graph, utils
from theano.gof.utils import MethodNotDefined, object2
from theano import change_flags
from theano.gof import graph, utils
########
# Type #
########
from theano.gof.op import CLinkerObject, Op
from theano.gof.utils import MethodNotDefined, object2
__docformat__ = "restructuredtext en"
......@@ -643,8 +644,8 @@ class _make_cdata(Op):
return False
def make_node(self, val):
from theano.scalar import as_scalar
from theano import Apply
from theano.scalar import as_scalar
val = as_scalar(val).astype("uint64")
return Apply(self, [val], [self.rtype()])
......
......@@ -11,9 +11,10 @@ that satisfies the constraints. That's useful for pattern matching.
"""
from copy import copy
from functools import partial
from theano.gof.utils import ANY_TYPE, comm_guard, FALL_THROUGH
from theano.gof.utils import ANY_TYPE, FALL_THROUGH, comm_guard
################################
......
import sys
import linecache
import sys
import traceback
import numpy as np
from six import integer_types, string_types, with_metaclass
from six.moves import StringIO
......
......@@ -6,19 +6,18 @@ VM was a better name at some point.
"""
import logging
import platform
import sys
import time
import warnings
import platform
import theano.gof.cmodule
from collections import defaultdict
from theano.configparser import config, _config_var_list
import theano.gof.cmodule
from theano.configparser import _config_var_list, config
from . import link
logger = logging.getLogger(__name__)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论