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

Apply isort to theano top-level modules

上级 5b6f20c0
......@@ -54,6 +54,7 @@ def disable_log_handler(logger=theano_logger, handler=logging_default_handler):
# Version information.
from theano.version import version as __version__
# Raise a meaningful warning/error if the theano directory is in the Python
# path.
rpath = os.path.realpath(__path__[0])
......@@ -65,6 +66,7 @@ for p in sys.path:
from theano.configdefaults import config
from theano.configparser import change_flags
# This is the api version for ops that generate C code. External ops
# might need manual changes if this number goes up. An undefined
# __api_version__ can be understood to mean api version 0.
......@@ -73,59 +75,53 @@ from theano.configparser import change_flags
# very rarely.
__api_version__ = 1
from theano import scalar, tensor
from theano.compile import (
FunctionMaker,
In,
Mode,
OpFromGraph,
Out,
Param,
ProfileStats,
SymbolicInput,
SymbolicOutput,
as_op,
function,
function_dump,
predefined_linkers,
predefined_modes,
predefined_optimizers,
shared,
)
from theano.gof import (
Apply,
CLinker,
OpWiseCLinker,
Constant,
Container,
DualLinker,
FunctionGraph,
Generic,
InconsistencyError,
Linker,
LocalLinker,
PerformLinker,
Container,
InconsistencyError,
FunctionGraph,
Apply,
Variable,
Constant,
Op,
OpenMPOp,
opt,
toolbox,
OpWiseCLinker,
PerformLinker,
Type,
Generic,
Variable,
generic,
object2,
opt,
toolbox,
utils,
)
from theano.compile import (
SymbolicInput,
In,
SymbolicOutput,
Out,
Mode,
predefined_modes,
predefined_linkers,
predefined_optimizers,
FunctionMaker,
function,
function_dump,
OpFromGraph,
ProfileStats,
Param,
shared,
as_op,
)
from theano.gradient import Lop, Rop, grad, subgraph_grad
from theano.misc.safe_asarray import _asarray
from theano.printing import pprint, pp
from theano import tensor
from theano import scalar
from theano.printing import pp, pprint
from theano.updates import OrderedUpdates
from theano.gradient import Rop, Lop, grad, subgraph_grad
if (
config.device.startswith("cuda")
......@@ -139,6 +135,7 @@ if (
# Use config.numpy to call numpy.seterr
import numpy as np
if config.numpy.seterr_all == "None":
_all = None
else:
......@@ -219,5 +216,4 @@ def sparse_grad(var):
import theano.tensor.shared_randomstreams
from theano.scan_module import scan, map, reduce, foldl, foldr, clone, scan_checkpoints
from theano.scan_module import clone, foldl, foldr, map, reduce, scan, scan_checkpoints
......@@ -2,8 +2,7 @@ import numpy as np
import theano
import theano.tensor as tt
from theano.gof import Op, Apply
from theano.gof import Apply, Op
from theano.gradient import DisconnectedType
......
......@@ -2,31 +2,25 @@
"""
from collections import OrderedDict
# Python 3.x compatibility
from six import PY3, b, BytesIO, next
from six import PY3, BytesIO, b, next
from six.moves import configparser
from six.moves import reload_module as reload
from collections import OrderedDict
try:
from collections.abc import (
Callable,
Iterable,
Mapping,
ValuesView,
MutableMapping as DictMixin,
)
from collections.abc import Callable, Iterable, Mapping
from collections.abc import MutableMapping as DictMixin
from collections.abc import ValuesView
except ImportError:
# this raises an DeprecationWarning on py37 and will become
# and Exception in py39. Importing from collections.abc
# won't work on py27
from collections import (
Callable,
Iterable,
Mapping,
ValuesView,
MutableMapping as DictMixin,
)
from collections import Callable, Iterable, Mapping
from collections import MutableMapping as DictMixin
from collections import ValuesView
__all__ = ["PY3", "b", "BytesIO", "next", "configparser", "reload"]
......@@ -66,9 +60,10 @@ if PY3:
else:
from six import get_unbound_function
from operator import div as operator_div
from six import get_unbound_function
def exc_message(e):
return e[0]
......
import errno
import os
import sys
import logging
import numpy as np
import os
import platform
import textwrap
import re
import socket
import struct
import sys
import textwrap
import warnings
import numpy as np
from six import string_types
import theano
from theano.compat import maybe_add_to_os_environ_pathlist
from theano.configparser import (
THEANO_FLAGS_DICT,
AddConfigVar,
BoolParam,
ConfigParam,
......@@ -22,11 +24,9 @@ from theano.configparser import (
IntParam,
StrParam,
TheanoConfigParser,
THEANO_FLAGS_DICT,
)
from theano.misc.cpucount import cpuCount
from theano.misc.windows import call_subprocess_Popen, output_subprocess_Popen
from theano.compat import maybe_add_to_os_environ_pathlist
_logger = logging.getLogger("theano.configdefaults")
......@@ -1668,6 +1668,7 @@ def default_blas_ldflags():
# ignored"
# This happen with Python 2.7.3 |EPD 7.3-1 and numpy 1.8.1
# isort: off
import numpy.distutils.system_info # noqa
# We need to catch warnings as in some cases NumPy print
......
......@@ -8,14 +8,14 @@ import os
import shlex
import sys
import warnings
import theano
from functools import wraps
from six import StringIO, PY3, string_types
from six import PY3, StringIO, string_types
import theano
from theano.compat import configparser as ConfigParser
_logger = logging.getLogger("theano.configparser")
......
......@@ -3,20 +3,20 @@
import logging
import time
import warnings
from collections import OrderedDict
from functools import reduce
import numpy as np # for numeric_grad
import numpy as np
import theano
from functools import reduce
from collections import OrderedDict
from theano import gof
from theano.gof import utils, Variable
from theano.compile.debugmode import DebugMode
from theano.compile.mode import FAST_RUN, get_mode
from theano.compile.ops import ViewOp
from theano.gof import Variable, utils
from theano.gof.null_type import NullType, null_type
from theano.gof.op import get_test_values
from theano.compile import ViewOp, FAST_RUN, DebugMode, get_mode
__authors__ = "James Bergstra, Razvan Pascanu, Arnaud Bergeron, Ian Goodfellow"
__copyright__ = "(c) 2011, Universite de Montreal"
......@@ -1790,9 +1790,9 @@ def verify_grad(
"""
# The import is here to prevent circular import.
from theano import compile, shared
import theano.tensor
from theano.tensor import as_tensor_variable, TensorType
from theano import compile, shared
from theano.tensor import TensorType, as_tensor_variable
assert isinstance(pt, (list, tuple))
pt = [np.array(p) for p in pt]
......
......@@ -12,20 +12,16 @@ is a global operation with a scalar condition.
"""
import logging
from copy import deepcopy
import numpy as np
import theano.tensor
from copy import deepcopy
from theano.tensor import TensorType
from theano import gof
from theano.gof import Op, Apply
from theano.compile import optdb
from theano.tensor import opt
from theano.gof import Apply, Op
from theano.scan_module.scan_utils import clone
from theano.tensor import TensorType, opt
__docformat__ = "restructedtext en"
......
......@@ -4,26 +4,22 @@ They all allow different way to print a graph or the result of an Op
in a graph(Print Op)
"""
import hashlib
import logging
import os
import sys
import hashlib
from copy import copy
from functools import reduce
import numpy as np
from six import integer_types, string_types
from six.moves import StringIO
import theano
from theano import config, gof
from theano.compile import Function, SharedVariable, debugmode
from theano.gof import Apply, Op
from functools import reduce
from copy import copy
from six import string_types, integer_types
from six.moves import StringIO
from theano import gof
from theano import config
from theano.gof import Op, Apply
from theano.compile import Function, debugmode, SharedVariable
pydot_imported = False
pydot_imported_msg = ""
......
......@@ -2,6 +2,7 @@
from theano import gof
__authors__ = "James Bergstra"
__copyright__ = "(c) 2011, Universite de Montreal"
__license__ = "3-clause BSD License"
......
......@@ -3,7 +3,6 @@
"""
import logging
import warnings
from collections import OrderedDict
from theano.compile.sharedvalue import SharedVariable
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论