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

Apply isort to theano.compile sub-package modules

上级 bfcd85cc
from theano.compile.builders import *
from theano.compile.debugmode import DebugMode
from theano.compile.function import function, function_dump
from theano.compile.function_module import *
from theano.compile.io import *
from theano.compile.mode import *
from theano.compile.monitormode import MonitorMode
from theano.compile.ops import ( from theano.compile.ops import (
DeepCopyOp, DeepCopyOp,
deep_copy_op, FromFunctionOp,
register_deep_copy_op_c_code, Rebroadcast,
Shape, Shape,
shape,
register_shape_c_code,
Shape_i, Shape_i,
register_shape_i_c_code, SpecifyShape,
ViewOp, ViewOp,
view_op,
register_view_op_c_code,
FromFunctionOp,
as_op, as_op,
Rebroadcast, deep_copy_op,
register_deep_copy_op_c_code,
register_rebroadcast_c_code, register_rebroadcast_c_code,
SpecifyShape, register_shape_c_code,
specify_shape, register_shape_i_c_code,
register_specify_shape_c_code, register_specify_shape_c_code,
register_view_op_c_code,
shape,
specify_shape,
view_op,
) )
from theano.compile.pfunc import Param, pfunc, rebuild_collect_shared
from theano.compile.function_module import *
from theano.compile.mode import *
from theano.compile.io import *
from theano.compile.debugmode import DebugMode
from theano.compile.monitormode import MonitorMode
from theano.compile.profiling import ProfileStats, ScanProfileStats from theano.compile.profiling import ProfileStats, ScanProfileStats
from theano.compile.sharedvalue import SharedVariable, shared, shared_constructor
from theano.compile.sharedvalue import shared, shared_constructor, SharedVariable
from theano.compile.pfunc import pfunc, Param, rebuild_collect_shared
from theano.compile.builders import *
from theano.compile.function import function, function_dump
"""Define new Ops from existing Ops""" """Define new Ops from existing Ops"""
from functools import reduce, partial
from collections import OrderedDict from collections import OrderedDict
from functools import partial, reduce
import theano import theano
from theano import gof from theano import gof
from theano.compile.function_module import orig_function from theano.compile.function_module import orig_function
from theano.compile import SharedVariable, rebuild_collect_shared, optdb from theano.compile.mode import optdb
from theano.compile.pfunc import rebuild_collect_shared
from theano.compile.sharedvalue import SharedVariable
from theano.gof import Variable, ops_with_inner_function from theano.gof import Variable, ops_with_inner_function
from theano.gof.graph import io_connection_pattern from theano.gof.graph import io_connection_pattern
from theano.gof.null_type import NullType from theano.gof.null_type import NullType
......
...@@ -7,32 +7,28 @@ TODO: add support for IfElse Op, LazyLinker, PureOp, etc. ...@@ -7,32 +7,28 @@ TODO: add support for IfElse Op, LazyLinker, PureOp, etc.
import copy import copy
import sys
import gc import gc
import logging import logging
import sys
from itertools import chain
from itertools import product as itertools_product
import numpy as np import numpy as np
import theano
from itertools import chain, product as itertools_product
from six.moves import StringIO from six.moves import StringIO
from theano import gof, config import theano
from theano import change_flags, config, gof
from theano.compat import get_unbound_function from theano.compat import get_unbound_function
from theano.gof import graph, utils, link, ops_with_inner_function
from theano.gof.link import raise_with_op
from theano.compile.function_module import ( from theano.compile.function_module import (
FunctionMaker,
Function, Function,
FunctionMaker,
infer_reuse_pattern, infer_reuse_pattern,
std_fgraph, std_fgraph,
) )
from theano.compile.mode import Mode, register_mode from theano.compile.mode import Mode, register_mode
from theano.compile.ops import OutputGuard, _output_guard from theano.compile.ops import OutputGuard, _output_guard
from theano import change_flags from theano.gof import graph, link, ops_with_inner_function, utils
from theano.gof.link import raise_with_op
__docformat__ = "restructuredtext en" __docformat__ = "restructuredtext en"
...@@ -1197,8 +1193,8 @@ def _get_preallocated_maps( ...@@ -1197,8 +1193,8 @@ def _get_preallocated_maps(
""" """
# To avoid circular imports # To avoid circular imports
from theano.tensor import TensorType
from theano.gpuarray import GpuArrayType from theano.gpuarray import GpuArrayType
from theano.tensor import TensorType
try: try:
import pygpu import pygpu
......
...@@ -5,15 +5,16 @@ Define the `function` function. ...@@ -5,15 +5,16 @@ Define the `function` function.
import logging import logging
import traceback as tb
import re import re
import traceback as tb
import warnings
from six import string_types from six import string_types
from theano import compat
from theano.compile.function_module import orig_function from theano.compile.function_module import orig_function
from theano.compile.pfunc import pfunc from theano.compile.pfunc import pfunc
import warnings
from theano import compat
__docformat__ = "restructuredtext en" __docformat__ = "restructuredtext en"
_logger = logging.getLogger("theano.compile.function") _logger = logging.getLogger("theano.compile.function")
......
...@@ -4,28 +4,25 @@ Driver of graph construction, optimization, and linking. ...@@ -4,28 +4,25 @@ Driver of graph construction, optimization, and linking.
""" """
import copy import copy
import time
import logging import logging
import time
import warnings import warnings
from itertools import chain
import numpy as np
import six.moves.copyreg as copyreg import six.moves.copyreg as copyreg
import six.moves.cPickle as pickle import six.moves.cPickle as pickle
from six import string_types
import numpy as np
import theano import theano
import theano.compile.profiling import theano.compile.profiling
from itertools import chain
from six import string_types
from theano import config, gof from theano import config, gof
from theano.gof import graph
from theano.compile.io import In, SymbolicInput, SymbolicOutput from theano.compile.io import In, SymbolicInput, SymbolicOutput
from theano.compile.ops import deep_copy_op, view_op from theano.compile.ops import deep_copy_op, view_op
from theano.gof.toolbox import is_same_graph from theano.gof import graph
from theano.gof.op import ops_with_inner_function from theano.gof.op import ops_with_inner_function
from theano.gof.toolbox import is_same_graph
_logger = logging.getLogger("theano.compile.function_module") _logger = logging.getLogger("theano.compile.function_module")
...@@ -1369,9 +1366,10 @@ class FunctionMaker(object): ...@@ -1369,9 +1366,10 @@ class FunctionMaker(object):
def optimize_graph_with_cache(self, optimizer, inputs, outputs): def optimize_graph_with_cache(self, optimizer, inputs, outputs):
# This function is not finished # This function is not finished
from theano.gof.compilelock import get_lock, release_lock
import os.path import os.path
from theano.gof.compilelock import get_lock, release_lock
graph_db_file = os.path.join(theano.config.compiledir, "optimized_graphs.pkl") graph_db_file = os.path.join(theano.config.compiledir, "optimized_graphs.pkl")
# the inputs, outputs, and size of the graph to be optimized # the inputs, outputs, and size of the graph to be optimized
......
...@@ -4,12 +4,14 @@ Define `SymbolicInput`, `SymbolicOutput`, `In`, `Out`. ...@@ -4,12 +4,14 @@ Define `SymbolicInput`, `SymbolicOutput`, `In`, `Out`.
""" """
from theano import gof import logging
from .sharedvalue import SharedVariable
from six import string_types from six import string_types
import logging from theano import gof
from .sharedvalue import SharedVariable
_logger = logging.getLogger("theano.compile.io") _logger = logging.getLogger("theano.compile.io")
......
...@@ -6,15 +6,15 @@ WRITEME ...@@ -6,15 +6,15 @@ WRITEME
import logging import logging
import warnings import warnings
import theano
import theano.gof.vm
from six import string_types from six import string_types
import theano
import theano.gof.vm
from theano import config, gof from theano import config, gof
from theano.compile.function_module import Supervisor from theano.compile.function_module import Supervisor
from theano.sandbox.jax_linker import JAXLinker from theano.sandbox.jax_linker import JAXLinker
_logger = logging.getLogger("theano.compile.mode") _logger = logging.getLogger("theano.compile.mode")
......
import logging import logging
import numpy as np import numpy as np
from six.moves import StringIO
import theano import theano
import theano.tensor as tt import theano.tensor as tt
from six.moves import StringIO
from theano import config from theano import config
from theano.compat import ValuesView from theano.compat import ValuesView
from theano.compile.mode import get_mode, Mode from theano.compile.mode import Mode, get_mode
try: try:
from theano.gpuarray.type import GpuArrayType, _name_for_ctx
from pygpu.gpuarray import GpuArray from pygpu.gpuarray import GpuArray
from theano.gpuarray.type import GpuArrayType, _name_for_ctx
pygpu_available = True pygpu_available = True
except ImportError: except ImportError:
pygpu_available = False pygpu_available = False
......
...@@ -7,18 +7,14 @@ help make new Ops more rapidly. ...@@ -7,18 +7,14 @@ help make new Ops more rapidly.
import copy import copy
import warnings import warnings
import six.moves.cPickle as pickle
import numpy as np
import theano
from collections import OrderedDict from collections import OrderedDict
import numpy as np
import six.moves.cPickle as pickle
from six import integer_types from six import integer_types
from theano.gof import Op, Apply, ParamsType, Variable import theano
from theano.gof import Apply, Op, ParamsType, Variable
def register_view_op_c_code(type, code, version=()): def register_view_op_c_code(type, code, version=()):
......
...@@ -3,16 +3,16 @@ Provide a simple user friendly API. ...@@ -3,16 +3,16 @@ Provide a simple user friendly API.
""" """
import warnings
import logging import logging
import warnings
from theano import config from theano import config
from theano.compile.function_module import UnusedInputError, orig_function
from theano.compile import orig_function, In, Out from theano.compile.io import In, Out
from theano.compile import UnusedInputError
from theano.compile.sharedvalue import SharedVariable, shared
from theano.compile.profiling import ProfileStats from theano.compile.profiling import ProfileStats
from theano.gof import Variable, Constant from theano.compile.sharedvalue import SharedVariable, shared
from theano.gof import Constant, Variable
_logger = logging.getLogger("theano.compile.pfunc") _logger = logging.getLogger("theano.compile.pfunc")
......
...@@ -16,13 +16,11 @@ import os ...@@ -16,13 +16,11 @@ import os
import sys import sys
import time import time
import warnings import warnings
from collections import defaultdict
import numpy as np import numpy as np
import theano import theano
from collections import defaultdict
from theano.gof import graph from theano.gof import graph
...@@ -1701,9 +1699,9 @@ class ProfileStats(object): ...@@ -1701,9 +1699,9 @@ class ProfileStats(object):
printed_tip = True printed_tip = True
# tip 7 # tip 7
from theano.tensor.nnet import LogSoftmax
import theano.tensor.signal.pool as pool
import theano.gpuarray import theano.gpuarray
import theano.tensor.signal.pool as pool
from theano.tensor.nnet import LogSoftmax
for a in self.apply_time: for a in self.apply_time:
node = a node = a
......
...@@ -14,6 +14,7 @@ import numpy as np ...@@ -14,6 +14,7 @@ import numpy as np
# Theano imports # Theano imports
from theano.gof import Container, Variable, generic, utils from theano.gof import Container, Variable, generic, utils
_logger = logging.getLogger("theano.compile.sharedvalue") _logger = logging.getLogger("theano.compile.sharedvalue")
__docformat__ = "restructuredtext en" __docformat__ = "restructuredtext en"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论