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

Apply isort to theano.scan_module sub-package modules

上级 969cf83c
...@@ -44,5 +44,5 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>" ...@@ -44,5 +44,5 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
from theano.scan_module import scan_opt from theano.scan_module import scan_opt
from theano.scan_module.scan import scan from theano.scan_module.scan import scan
from theano.scan_module.scan_checkpoints import scan_checkpoints from theano.scan_module.scan_checkpoints import scan_checkpoints
from theano.scan_module.scan_views import map, reduce, foldl, foldr
from theano.scan_module.scan_utils import clone, until from theano.scan_module.scan_utils import clone, until
from theano.scan_module.scan_views import foldl, foldr, map, reduce
...@@ -43,23 +43,20 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>" ...@@ -43,23 +43,20 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import logging import logging
import numpy as np
import theano.tensor as tt
from collections import OrderedDict from collections import OrderedDict
import numpy as np
from six import integer_types from six import integer_types
from theano import compile, gof, config import theano.tensor as tt
from theano import compile, config, gof
from theano.compile import SharedVariable, function, ops from theano.compile import SharedVariable, function, ops
from theano.tensor import opt
from theano.updates import OrderedUpdates
from theano.gof.utils import TestValueError from theano.gof.utils import TestValueError
from theano.scan_module import scan_op, scan_utils from theano.scan_module import scan_op, scan_utils
from theano.scan_module.scan_utils import safe_new, traverse from theano.scan_module.scan_utils import safe_new, traverse
from theano.tensor import opt
from theano.updates import OrderedUpdates
_logger = logging.getLogger("theano.scan_module.scan") _logger = logging.getLogger("theano.scan_module.scan")
......
...@@ -52,29 +52,25 @@ import copy ...@@ -52,29 +52,25 @@ import copy
import itertools import itertools
import logging import logging
import time import time
import numpy as np
import theano
from collections import OrderedDict from collections import OrderedDict
import numpy as np
from six import integer_types, raise_from, string_types from six import integer_types, raise_from, string_types
from theano.compile import function, In, Out import theano
from theano import compile, config, gof, gradient, tensor
from theano.compile import In, Out, function
from theano.compile.mode import AddFeatureOptimizer from theano.compile.mode import AddFeatureOptimizer
from theano import compile, config, gradient, gof, tensor from theano.compile.profiling import ScanProfileStats
from theano.gof import PureOp, Apply from theano.gof import Apply, PureOp
from theano.gof.graph import io_connection_pattern, equal_computations from theano.gof.graph import equal_computations, io_connection_pattern
from theano.gof.toolbox import NoOutputFromInplace from theano.gof.toolbox import NoOutputFromInplace
from theano.gradient import DisconnectedType, NullType, grad_undefined
from theano.tensor import as_tensor_variable, TensorType from theano.scan_module import scan_utils
from theano.scan_module.scan_utils import forced_replace, safe_new
from theano.tensor import TensorType, as_tensor_variable
from theano.tensor.opt import Shape_i from theano.tensor.opt import Shape_i
from theano.gradient import grad_undefined, DisconnectedType, NullType
from theano.compile.profiling import ScanProfileStats
from theano.scan_module import scan_utils
from theano.scan_module.scan_utils import safe_new, forced_replace
__docformat__ = "restructedtext en" __docformat__ = "restructedtext en"
__authors__ = "Razvan Pascanu " "Frederic Bastien " "James Bergstra " "Pascal Lamblin " __authors__ = "Razvan Pascanu " "Frederic Bastien " "James Bergstra " "Pascal Lamblin "
......
...@@ -50,29 +50,25 @@ scan_eqopt2 -> They are all global optimizer. (in2out convert local to global). ...@@ -50,29 +50,25 @@ scan_eqopt2 -> They are all global optimizer. (in2out convert local to global).
in2out(remove_constants_and_unused_inputs_scan3) in2out(remove_constants_and_unused_inputs_scan3)
""" """
import logging
import copy import copy
import logging
import numpy as np
import theano
from sys import maxsize
from collections import OrderedDict from collections import OrderedDict
from sys import maxsize
import numpy as np
from six import integer_types from six import integer_types
from theano import gof, tensor, scalar import theano
from theano.tensor import opt, get_scalar_constant_value, Alloc, AllocEmpty from theano import gof, scalar, tensor
from theano.compile import optdb from theano.compile import optdb
from theano.compile.function_module import deep_copy_op from theano.compile.function_module import deep_copy_op
from theano.gof import toolbox, DestroyHandler, InconsistencyError from theano.gof import DestroyHandler, InconsistencyError, toolbox
from theano.gof.opt import Optimizer, pre_constant_merge, pre_greedy_local_optimizer
from theano.gof.graph import equal_computations from theano.gof.graph import equal_computations
from theano.gof.opt import Optimizer, pre_constant_merge, pre_greedy_local_optimizer
from theano.scan_module import scan_op, scan_utils from theano.scan_module import scan_op, scan_utils
from theano.scan_module.scan_utils import scan_args from theano.scan_module.scan_utils import scan_args
from theano.tensor import Alloc, AllocEmpty, get_scalar_constant_value, opt
__docformat__ = "restructedtext en" __docformat__ = "restructedtext en"
__authors__ = ( __authors__ = (
......
...@@ -53,12 +53,14 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>" ...@@ -53,12 +53,14 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import cython import cython
import numpy import numpy
cimport numpy cimport numpy
from theano import gof
import time
import copy import copy
import time
from theano import gof
def get_version(): def get_version():
......
...@@ -17,8 +17,8 @@ import numpy as np ...@@ -17,8 +17,8 @@ import numpy as np
import theano import theano
from theano import config from theano import config
from theano.compat import reload from theano.compat import reload
from theano.gof.compilelock import get_lock, release_lock
from theano.gof import cmodule from theano.gof import cmodule
from theano.gof.compilelock import get_lock, release_lock
_logger = logging.getLogger("theano.scan_module.scan_perform") _logger = logging.getLogger("theano.scan_module.scan_perform")
...@@ -148,5 +148,5 @@ except ImportError: ...@@ -148,5 +148,5 @@ except ImportError:
# To fix it completly, we would need to modify Cython to use the new API. # To fix it completly, we would need to modify Cython to use the new API.
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="numpy.ndarray size changed") warnings.filterwarnings("ignore", message="numpy.ndarray size changed")
from scan_perform.scan_perform import perform, get_version # noqa: F401 from scan_perform.scan_perform import get_version, perform # noqa: F401
assert version == get_version() assert version == get_version()
...@@ -21,19 +21,16 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>" ...@@ -21,19 +21,16 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import copy import copy
import logging import logging
import warnings import warnings
import numpy as np
import theano
from collections import OrderedDict from collections import OrderedDict
import numpy as np
from six import string_types from six import string_types
from theano import gof, compat, tensor, scalar import theano
from theano import compat, gof, scalar, tensor
from theano.compile.pfunc import rebuild_collect_shared from theano.compile.pfunc import rebuild_collect_shared
from theano.tensor.basic import get_scalar_constant_value
from theano.gof.utils import TestValueError from theano.gof.utils import TestValueError
from theano.tensor.basic import get_scalar_constant_value
# Logging function for sending warning or info # Logging function for sending warning or info
...@@ -149,8 +146,8 @@ def traverse(out, x, x_copy, d, visited=None): ...@@ -149,8 +146,8 @@ def traverse(out, x, x_copy, d, visited=None):
if out in visited: if out in visited:
return d return d
visited.add(out) visited.add(out)
from theano.gpuarray.basic_ops import GpuFromHost, host_from_gpu
from theano.gpuarray import pygpu_activated from theano.gpuarray import pygpu_activated
from theano.gpuarray.basic_ops import GpuFromHost, host_from_gpu
from theano.gpuarray.type import GpuArrayType from theano.gpuarray.type import GpuArrayType
if out == x: if out == x:
...@@ -327,8 +324,8 @@ def map_variables(replacer, graphs, additional_inputs=None): ...@@ -327,8 +324,8 @@ def map_variables(replacer, graphs, additional_inputs=None):
return False return False
# importing Scan into module scope would be circular # importing Scan into module scope would be circular
from theano.scan_module.scan_op import Scan
from theano.compile import OpFromGraph from theano.compile import OpFromGraph
from theano.scan_module.scan_op import Scan
if isinstance(node.op, (Scan, OpFromGraph)): if isinstance(node.op, (Scan, OpFromGraph)):
# recurse on the inner graph # recurse on the inner graph
...@@ -389,9 +386,10 @@ def _map_variables_inner( ...@@ -389,9 +386,10 @@ def _map_variables_inner(
extra_inner_inputs = [] extra_inner_inputs = []
extra_outer_inputs = [] extra_outer_inputs = []
from theano.scan_module import scan_utils
from itertools import chain from itertools import chain
from theano import gof from theano import gof
from theano.scan_module import scan_utils
def inner_replacer(graph): def inner_replacer(graph):
new_graph = replacer(graph) new_graph = replacer(graph)
......
...@@ -16,6 +16,7 @@ import logging ...@@ -16,6 +16,7 @@ import logging
from theano.scan_module import scan from theano.scan_module import scan
# Logging function for sending warning or info # Logging function for sending warning or info
_logger = logging.getLogger("theano.scan_module.scan_views") _logger = logging.getLogger("theano.scan_module.scan_views")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论