提交 de05e842 authored 作者: lamblin's avatar lamblin

Merge pull request #1224 from abalkin/no-relative-imports

Issue #783: python3 compatible - remove relative imports.
......@@ -31,36 +31,28 @@ import logging
theano_logger = logging.getLogger("theano")
logging_default_handler = logging.StreamHandler()
logging_default_formatter = logging.Formatter(
fmt='%(levelname)s (%(name)s): %(message)s')
fmt='%(levelname)s (%(name)s): %(message)s')
logging_default_handler.setFormatter(logging_default_formatter)
theano_logger.addHandler(logging_default_handler)
theano_logger.setLevel(logging.WARNING)
import configparser
import configdefaults
config = configparser.TheanoConfigParser()
from theano.configdefaults import config
# Version information.
import theano.version
__version__ = theano.version.version
import gof
from gof import \
CLinker, OpWiseCLinker, DualLinker, Linker, LocalLinker, PerformLinker, \
Container, \
InconsistencyError, FunctionGraph, \
Apply, Variable, Constant, \
Op, OpenMPOp,\
opt, \
toolbox, \
Type, Generic, generic, \
object2, utils
import compile
from compile import \
from theano.version import version as __version__
from theano.gof import \
CLinker, OpWiseCLinker, DualLinker, Linker, LocalLinker, PerformLinker, \
Container, \
InconsistencyError, FunctionGraph, \
Apply, Variable, Constant, \
Op, OpenMPOp, \
opt, \
toolbox, \
Type, Generic, generic, \
object2, utils
from theano.compile import \
SymbolicInput, In, \
SymbolicOutput, Out, \
Mode, \
......@@ -71,43 +63,37 @@ from compile import \
ProfileMode, \
Param, shared
from misc.safe_asarray import _asarray
import theano.tests
if hasattr(theano.tests, "TheanoNoseTester"):
test = theano.tests.TheanoNoseTester().test
else:
def test():
raise ImportError("The nose module is not installed."
" It is needed for Theano tests.")
from theano.misc.safe_asarray import _asarray
FancyModule = Module
from printing import \
pprint, pp
import scan_module
from scan_module import scan, map, reduce, foldl, foldr, clone
from theano.printing import pprint, pp
from theano.scan_module import scan, map, reduce, foldl, foldr, clone
from updates import Updates, OrderedUpdates
from theano.updates import Updates, OrderedUpdates
import tensor
import scalar
# scan_module import above initializes tensor and scalar making these imports redundant
#import tensor
#import scalar
#we don't import by default as we don't want to force having scipy installed.
#import sparse
import gradient
from gradient import Rop, Lop, grad
from theano.gradient import Rop, Lop, grad
if config.device.startswith('gpu') or config.init_gpu_device.startswith('gpu'):
import theano.sandbox.cuda
# We can't test the driver during import of theano.sandbox.cuda as
# this cause circular import dependency. So we also test it manually
# after the import
# We can't test the driver during import of theano.sandbox.cuda as
# this cause circular import dependency. So we also test it manually
# after the import
if theano.sandbox.cuda.cuda_available:
import theano.sandbox.cuda.tests.test_driver
theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1()
# Use config.numpy to call numpy.seterr
import numpy
if config.numpy.seterr_all == 'None':
_all = None
else:
......@@ -129,11 +115,11 @@ if config.numpy.seterr_invalid == 'None':
else:
_invalid = config.numpy.seterr_invalid
numpy.seterr(
all=_all,
divide=_divide,
over=_over,
under=_under,
invalid=_invalid)
all=_all,
divide=_divide,
over=_over,
under=_under,
invalid=_invalid)
del _all, _divide, _over, _under, _invalid
## import scalar_opt
......@@ -174,10 +160,28 @@ def get_scalar_constant_value(v):
If `v` is not some view of constant data, then raise a
tensor.basic.NotScalarConstantError.
"""
if hasattr(theano, 'sparse') and isinstance(v.type,
theano.sparse.SparseType):
if v.owner is not None and isinstance(v.owner.op,
theano.sparse.CSM):
# Is it necessary to test for presence of theano.sparse at runtime?
if 'sparse' in globals() and isinstance(v.type, sparse.SparseType):
if v.owner is not None and isinstance(v.owner.op, sparse.CSM):
data = v.owner.inputs[0]
return tensor.get_scalar_constant_value(data)
return tensor.get_scalar_constant_value(v)
import theano.tests
if hasattr(theano.tests, "TheanoNoseTester"):
test = theano.tests.TheanoNoseTester().test
else:
def test():
raise ImportError("The nose module is not installed."
" It is needed for Theano tests.")
# This cannot be done in tensor/__init__.py due to a circular dependency -- randomstreams
# depends on raw_random which depends on tensor. As a work-around, we import RandomStreams
# here and inject an instance in tensor.
from theano import tensor
from theano.tensor.randomstreams import RandomStreams
# Imitate the numpy.random symbol with a tensor.random one
tensor.random = RandomStreams(seed=0xBAD5EED, no_warn=True)
del RandomStreams
__import__('theano.tensor.shared_randomstreams')
\ No newline at end of file
import ops
from ops import (
from theano.compile.ops import (
DeepCopyOp, deep_copy_op, register_deep_copy_op_c_code,
ViewOp, view_op, register_view_op_c_code)
import function_module
from function_module import *
from theano.compile.function_module import *
import mode
from mode import *
from theano.compile.mode import *
import io
from io import *
from theano.compile.io import *
import builders
from builders import *
from theano.compile.builders import *
import module
from module import *
from theano.compile.module import *
import debugmode # register DEBUG_MODE
from debugmode import DebugMode
from theano.compile.debugmode import DebugMode
from monitormode import MonitorMode
from theano.compile.monitormode import MonitorMode
from profilemode import ProfileMode
from theano.compile.profilemode import ProfileMode
from theano.compile.sharedvalue import shared, shared_constructor, SharedVariable
from theano.compile.pfunc import pfunc, Param, rebuild_collect_shared
from function import function
from theano.compile.function import function
......@@ -5,9 +5,9 @@ __docformat__ = "restructuredtext en"
import logging
_logger = logging.getLogger('theano.compile.function')
from io import In
from function_module import orig_function
from pfunc import pfunc
from theano.compile.io import In
from theano.compile.function_module import orig_function
from theano.compile.pfunc import pfunc
from numpy import any # to work in python 2.4
import warnings
from theano import gof
......
......@@ -15,8 +15,8 @@ import numpy
import theano
from theano import gof
from theano.gof.python25 import partial
import mode as mode_module
from io import In, SymbolicInput, SymbolicInputKit, SymbolicOutput
import theano.compile.mode
from theano.compile.io import In, SymbolicInput, SymbolicInputKit, SymbolicOutput
from theano.compile.ops import deep_copy_op, view_op
import logging
......@@ -945,7 +945,7 @@ class FunctionMaker(object):
- 'ignore': do not do anything
- None: Use the value in the Theano flags on_unused_input
"""
mode = mode_module.get_mode(mode)
mode = theano.compile.mode.get_mode(mode)
# figure out which profile object to use (if any)
# to help with forward-porting ProfileMode,
......@@ -1025,7 +1025,7 @@ class FunctionMaker(object):
# initialize the linker
if not hasattr(linker, 'accept'):
raise ValueError("'linker' parameter of FunctionFactory should be a Linker with an accept method " \
"or one of %s" % mode_module.predefined_linkers.keys())
"or one of %s" % theano.compile.mode.predefined_linkers.keys())
#the 'no_borrow' outputs are the ones for which that we can't return the internal storage pointer.
assert len(fgraph.outputs) == len(outputs + additional_outputs)
......@@ -1274,7 +1274,7 @@ def orig_function(inputs, outputs, mode=None, accept_inplace=False,
# instance if necessary:
t1 = time.time()
mode = mode_module.get_mode(mode)
mode = theano.compile.mode.get_mode(mode)
inputs = map(convert_function_input, inputs)
if outputs is not None:
......
......@@ -15,8 +15,8 @@ import warnings
from itertools import chain
import function_module as F
import mode as get_mode
import theano.compile.function_module
import theano.compile.mode
#This module is imported by other parts of theano, and worse still, other
......@@ -106,7 +106,7 @@ class Component(object):
be called.
"""
if mode is None:
mode = get_mode.get_default_mode()
mode = theano.compile.mode.get_default_mode()
memo = {}
self.allocate(memo)
rval = self.build(mode, memo)
......@@ -120,7 +120,7 @@ class Component(object):
arguments and the keyword arguments. If 'mode' is in the
keyword arguments it will be passed to build().
"""
mode = kwargs.pop('mode', get_mode.get_default_mode())
mode = kwargs.pop('mode', theano.compile.mode.get_default_mode())
rval = self.make_no_init(mode)
if hasattr(rval, 'initialize'):
rval.initialize(*args, **kwargs)
......@@ -503,7 +503,7 @@ class Method(Component):
effective_mode = self.mode
# We ignore unused inputs, since all the inputs are passed
rval = F.orig_function(inputs, outputs, effective_mode,
rval = theano.compile.function_module.orig_function(inputs, outputs, effective_mode,
on_unused_input='ignore')
memo[self] = rval
return rval
......@@ -1192,7 +1192,7 @@ class Module(ComponentDict):
"""
self.make_module_instance(args,kwargs)
mode = kwargs.pop('mode', get_mode.get_default_mode())
mode = kwargs.pop('mode', theano.compile.mode.get_default_mode())
rval = self.make_no_init(mode)
if hasattr(rval, 'initialize'):
rval.initialize(*args, **kwargs)
......
......@@ -3,12 +3,11 @@
__docformat__ = 'restructuredtext en'
from profiling import ProfileStats
from theano import config
from theano.compile import orig_function, In, Out
from theano.compile import UnusedInputError
from theano.compile.sharedvalue import SharedVariable, shared
from theano.compile.profiling import ProfileStats
from theano.gof import Variable, Constant
from theano.gof.python25 import any
......@@ -293,6 +292,7 @@ class Param(object):
`mutable` flag.
False: do not permit any output to be aliased to the input
False: do not permit any output to be aliased to the input
:param strict: False -> function arguments may be copied or cast to match the
type required by the parameter `variable`.
True -> function arguments must exactly match the type
......
......@@ -4,7 +4,6 @@ __docformat__ = 'restructuredtext en'
# Standard imports
import copy
import logging
import sys
# Third-party imports
import numpy
......
......@@ -35,29 +35,27 @@ For more details and discussion, see the theano-dev
e-mail thread "What is gof?"
"""
import sys
from cc import \
from theano.gof.cc import \
CLinker, OpWiseCLinker, DualLinker
import compiledir # adds config vars
import theano.gof.compiledir # adds config vars
from fg import \
from theano.gof.fg import \
InconsistencyError, MissingInputError, FunctionGraph
from destroyhandler import \
from theano.gof.destroyhandler import \
DestroyHandler
from graph import \
from theano.gof.graph import \
Apply, Variable, Constant, view_roots
from link import \
from theano.gof.link import \
Container, Linker, LocalLinker, PerformLinker, WrapLinker, WrapLinkerMany
from op import \
from theano.gof.op import \
Op, OpenMPOp, PureOp, ops_with_inner_function
from opt import (Optimizer, optimizer, SeqOptimizer,
from theano.gof.opt import (Optimizer, optimizer, SeqOptimizer,
MergeOptimizer, MergeOptMerge,
LocalOptimizer, local_optimizer, LocalOptGroup,
OpSub, OpRemove, PatternSub,
......@@ -65,18 +63,18 @@ from opt import (Optimizer, optimizer, SeqOptimizer,
InplaceOptimizer, PureThenInplaceOptimizer,
OpKeyOptimizer)
from optdb import \
from theano.gof.optdb import \
DB, Query, \
EquilibriumDB, SequenceDB, ProxyDB
from toolbox import \
from theano.gof.toolbox import \
Feature, \
Bookkeeper, History, Validator, ReplaceValidate, NodeFinder,\
PrintListener, ReplacementDidntRemovedError
from type import \
from theano.gof.type import \
Type, Generic, generic
from utils import \
from theano.gof.utils import \
object2, MethodNotDefined
......@@ -44,13 +44,13 @@ AddConfigVar('gcc.cxxflags',
StrParam(""))
# gof imports
import graph
import link
import utils
from theano.gof import graph
from theano.gof import link
from theano.gof import utils
from compilelock import get_lock, release_lock
from theano.gof.compilelock import get_lock, release_lock
import cmodule
from theano.gof import cmodule
import logging
......
......@@ -25,8 +25,8 @@ from theano.gof.cc import hash_from_code
from theano.misc.windows import call_subprocess_Popen
# we will abuse the lockfile mechanism when reading and writing the registry
import compilelock
from compiledir import gcc_version_str
from theano.gof import compilelock
from theano.gof.compiledir import gcc_version_str
from theano.configparser import AddConfigVar, BoolParam
......
import os
import sys
from compilelock import get_lock, release_lock
from theano.gof.compilelock import get_lock, release_lock
from theano import config
# TODO These two lines may be removed in the future, when we are 100% sure
......
......@@ -5,14 +5,15 @@ Contains the FunctionGraph class and exception
types that it can raise
"""
import sys
import graph
import utils
import toolbox
from python25 import all
from theano.gof import graph
from theano.gof import utils
from theano.gof import toolbox
from theano.gof.python25 import all
from theano import config
import warnings
NullType = None
from python25 import OrderedDict
from theano.gof.python25 import OrderedDict
from theano.misc.ordered_set import OrderedSet
class InconsistencyError(Exception):
......
"""WRITEME"""
import utils
import graph
from type import Type
from theano.gof import utils
from theano.gof import graph
from theano.gof.type import Type
import sys, traceback
from copy import copy
from theano.gof.python25 import all
__excepthook = sys.excepthook
......
......@@ -11,7 +11,6 @@ __contact__ = "theano-dev <theano-dev@googlegroups.com>"
__docformat__ = "restructuredtext en"
import copy
import logging
import os
import subprocess
......@@ -22,10 +21,10 @@ import theano
from theano import config
from theano.misc.windows import call_subprocess_Popen
import cc
import graph
import utils
from fg import FunctionGraph
import theano.gof.cc
from theano.gof import graph
from theano.gof import utils
from theano.gof.fg import FunctionGraph
class CLinkerObject(object):
......@@ -572,7 +571,7 @@ class Op(utils.object2, PureOp, CLinkerOp):
e_no_recycling = [new_o
for (new_o, old_o) in zip(e.outputs, node.outputs)
if old_o in no_recycling]
cl = cc.CLinker().accept(e,
cl = theano.gof.cc.CLinker().accept(e,
no_recycling=e_no_recycling)
logger.debug('Trying CLinker.make_thunk')
......
......@@ -10,16 +10,15 @@ import time
import numpy
import graph
from fg import InconsistencyError
import op
import utils
import unify
import toolbox
from theano.gof import graph
from theano.gof.fg import InconsistencyError
from theano.gof import op
from theano.gof import utils
from theano.gof import unify
from theano.gof import toolbox
import theano
from theano import config
from theano.gof.python25 import any, all, deque
from theano.configparser import AddConfigVar, BoolParam
#if sys.version_info[:2] >= (2,5):
# from collections import defaultdict
......
import StringIO
import sys
from python25 import DefaultOrderedDict
from theano.gof.python25 import DefaultOrderedDict
import numpy
import opt
from theano.gof import opt
from theano.configparser import AddConfigVar, FloatParam
from theano import config
AddConfigVar('optdb.position_cutoff',
......
from graph import list_of_nodes
from theano.gof.graph import list_of_nodes
from theano.gof.python25 import any, defaultdict
......
......@@ -4,7 +4,7 @@ import time
from theano.gof.python25 import partial
from theano.gof.python25 import OrderedDict
import graph
from theano.gof import graph
......
......@@ -2,9 +2,9 @@
__docformat__ = "restructuredtext en"
import utils
from utils import MethodNotDefined, object2
import graph
from theano.gof import utils
from theano.gof.utils import MethodNotDefined, object2
from theano.gof import graph
########
# Type #
......
......@@ -9,8 +9,8 @@ if there exists an assignment to all unification variables such that
"""
from copy import copy
from python25 import partial
from utils import *
from theano.gof.python25 import partial
from theano.gof.utils import *
################################
......
......@@ -11,11 +11,10 @@ import warnings
from theano.gof.python25 import all
import theano
config = theano.config
from theano.configparser import config, AddConfigVar, BoolParam, ConfigParam
import theano.gof.cmodule
logger = logging.getLogger(__name__)
AddConfigVar('profile',
......
......@@ -27,12 +27,12 @@ from theano.gof import PureOp, Apply
import theano.tensor
from theano.tensor import TensorType
import gof
from theano import gof
from compile import optdb
from tensor import opt
from scan_module.scan_utils import find_up
from scan_module.scan_utils import clone
from theano.compile import optdb
from theano.tensor import opt
from theano.scan_module.scan_utils import find_up
from theano.scan_module.scan_utils import clone
_logger = logging.getLogger('theano.ifelse')
......
......@@ -24,9 +24,9 @@ except ImportError:
pydot_imported = False
import theano
import gof
from theano import gof
from theano import config
from gof import Op, Apply
from theano.gof import Op, Apply
from theano.gof.python25 import any
from theano.compile import Function, debugmode
from theano.compile.profilemode import ProfileMode
......
......@@ -6,7 +6,7 @@ __license__ = "3-clause BSD License"
__contact__ = "theano-dev <theano-dev@googlegroups.com>"
__docformat__ = "restructuredtext en"
import gof
from theano import gof
class Raise(gof.Op):
"""Op whose perform() raises an exception.
......
......@@ -38,7 +38,7 @@ __authors__ = ("Razvan Pascanu "
__copyright__ = "(c) 2010, Universite de Montreal"
__contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import scan_opt
from scan import scan
from scan_views import map, reduce, foldl, foldr
from scan_utils import clone, until
from theano.scan_module import scan_opt
from theano.scan_module.scan import scan
from theano.scan_module.scan_views import map, reduce, foldl, foldr
from theano.scan_module.scan_utils import clone, until
......@@ -57,9 +57,9 @@ from theano.compile import ops
from theano.gof.python25 import OrderedDict
import scan_op
import scan_utils
from scan_utils import safe_new, traverse
from theano.scan_module import scan_op
from theano.scan_module import scan_utils
from theano.scan_module.scan_utils import safe_new, traverse
# Logging function for sending warning or info
_logger = logging.getLogger('theano.scan_module.scan')
......
......@@ -33,8 +33,8 @@ from theano.gradient import grad_undefined
from theano.gradient import DisconnectedType
from theano.compile.profiling import ScanProfileStats
import scan_utils
from scan_utils import safe_new, forced_replace
from theano.scan_module import scan_utils
from theano.scan_module.scan_utils import safe_new, forced_replace
# Logging function for sending warning or info
_logger = logging.getLogger('theano.scan_module.scan_op')
......
......@@ -26,9 +26,9 @@ from theano.gof import toolbox, DestroyHandler, InconsistencyError
from theano.compile import optdb
from theano.compile.function_module import deep_copy_op
import scan_op
import scan_utils
from scan_utils import equal_computations, find_up, scan_args
from theano.scan_module import scan_op
from theano.scan_module import scan_utils
from theano.scan_module.scan_utils import equal_computations, find_up, scan_args
from theano.gof.opt import pre_constant_merge, pre_greedy_local_optimizer
# Logging function for sending warning or info
......
......@@ -15,7 +15,7 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import logging
import scan
from theano.scan_module import scan
# Logging function for sending warning or info
_logger = logging.getLogger('theano.scan_module.scan_views')
......@@ -58,7 +58,7 @@ def map(fn,
:param name: See ``scan``.
"""
return scan.scan(fn=fn,
return scan(fn=fn,
sequences=sequences,
outputs_info=[],
non_sequences=non_sequences,
......@@ -101,7 +101,7 @@ def reduce(fn,
:param name: See ``scan``.
"""
rval = scan.scan(fn=fn,
rval = scan(fn=fn,
sequences=sequences,
outputs_info=outputs_info,
non_sequences=non_sequences,
......
......@@ -4,13 +4,12 @@ import theano
import numpy
from theano import gof, scalar, tensor
from theano.tensor import blas
from theano.sparse import (CSC, CSR, csm_properties, Remove0,
from theano.sparse import (CSC, CSR, csm_properties,
register_specialize,
csm_grad, usmm)
from theano.sparse import basic as sparse
from basic import _is_sparse_variable
_is_sparse_variable = sparse._is_sparse_variable
# This is tested in tests/test_opt.py:test_local_csm_properties_csm
@gof.local_optimizer([csm_properties])
......
import copy
import scipy.sparse
from theano.compile import shared_constructor, SharedVariable
from theano import config
from basic import SparseType, _sparse_py_operators
from theano.sparse.basic import SparseType, _sparse_py_operators
class SparseTensorSharedVariable(_sparse_py_operators, SharedVariable):
pass
@shared_constructor
def sparse_constructor(value, name=None, strict=False, allow_downcast=None,
borrow=False, format = None):
borrow=False, format=None):
"""SharedVariable Constructor for SparseType
writeme
"""
if not isinstance(value, scipy.sparse.spmatrix):
raise TypeError("Expected a sparse matrix in the sparse shared variable constructor. Received: ",value.__class__)
raise TypeError("Expected a sparse matrix in the sparse shared variable constructor. Received: ",
value.__class__)
if format is None:
format = value.format
type = SparseType(format =format, dtype = value.dtype)
type = SparseType(format=format, dtype=value.dtype)
if not borrow:
value = copy.deepcopy(value)
return SparseTensorSharedVariable(type=type, value=value, name=name,
strict=strict, allow_downcast=allow_downcast)
strict=strict, allow_downcast=allow_downcast)
......@@ -3,34 +3,35 @@ __docformat__ = "restructuredtext en"
import warnings
from basic import *
from theano.tensor.basic import *
import opt
import opt_uncanonicalize
import blas
import blas_scipy
import blas_c
import xlogx
from theano.tensor import opt
from theano.tensor import opt_uncanonicalize
from theano.tensor import blas
from theano.tensor import blas_scipy
from theano.tensor import blas_c
from theano.tensor import xlogx
import raw_random
import randomstreams
import shared_randomstreams
from randomstreams import \
RandomStreams
# These imports cannot be performed here because the modules depend on tensor. This is done at the
# end of theano.__init__.py instead.
#from theano.tensor import raw_random
#from theano.tensor import randomstreams
#from theano.tensor import shared_randomstreams
#from theano.tensor.randomstreams import \
# RandomStreams
random = RandomStreams(seed=0xBAD5EED, no_warn = True)
"""Imitate the numpy.random symbol with a tensor.random one"""
#random = RandomStreams(seed=0xBAD5EED, no_warn = True)
#"""Imitate the numpy.random symbol with a tensor.random one"""
from elemwise import \
DimShuffle, Elemwise, CAReduce
from theano.tensor.elemwise import DimShuffle, Elemwise, CAReduce
import sharedvar # adds shared-variable constructors
from theano.tensor import sharedvar # adds shared-variable constructors
# We import as `_shared` instead of `shared` to avoid confusion between
# `theano.shared` and `tensor._shared`.
from sharedvar import tensor_constructor as _shared
from theano.tensor.sharedvar import tensor_constructor as _shared
from io import *
from theano.tensor.io import *
def shared(*args, **kw):
"""
......@@ -49,11 +50,11 @@ def shared(*args, **kw):
return _shared(*args, **kw)
import nnet # used for softmax, sigmoid, etc.
from theano.tensor import nnet # used for softmax, sigmoid, etc.
from theano.gradient import Rop, Lop, grad, numeric_grad, verify_grad, \
jacobian, hessian
from theano.tensor.sort import sort, argsort
from extra_ops import (DiffOp, bincount, squeeze,
from theano.tensor.extra_ops import (DiffOp, bincount, squeeze,
repeat, bartlett, fill_diagonal)
......@@ -14,7 +14,7 @@ from theano.configparser import config
from theano import gof
from theano.gof import Apply, Constant, Op, Type, Variable
import elemwise
from theano.tensor import elemwise
from theano import scalar as scal
from theano.gof.python25 import partial, any, all, maxsize
from theano import compile, printing
......@@ -29,7 +29,7 @@ from theano.gradient import grad_not_implemented
from theano.gradient import DisconnectedType
### set up the external interface
from elemwise import Elemwise, DimShuffle, CAReduce, Sum
from theano.tensor.elemwise import Elemwise, DimShuffle, CAReduce, Sum
import logging
_logger = logging.getLogger("theano.tensor.basic")
......
from theano import config
from blas import ldflags, blas_header_text
from blas import blas_optdb, optdb, local_optimizer, EquilibriumOptimizer
from blas import Ger, ger, ger_destructive
from blas import Gemv, gemv_inplace, gemv_no_inplace
from theano.tensor.blas import ldflags, blas_header_text
from theano.tensor.blas import blas_optdb, optdb, local_optimizer, EquilibriumOptimizer
from theano.tensor.blas import Ger, ger, ger_destructive
from theano.tensor.blas import Gemv, gemv_inplace, gemv_no_inplace
class BaseBLAS(object):
......
......@@ -5,7 +5,6 @@ from itertools import izip
import numpy
import elemwise_cgen as cgen
import theano
from theano import gof
from theano.gof import Apply, Op
......@@ -16,6 +15,7 @@ from theano.gof.python25 import all, any
from theano.tensor.utils import hash_from_dict
from theano.gradient import DisconnectedType
from theano.gof.null_type import NullType
from theano.tensor import elemwise_cgen as cgen
config = theano.config
......
......@@ -2,9 +2,9 @@ import numpy as np
import numpy
import theano
import basic
from theano.tensor import basic
from theano import gof, scalar
import basic as tensor
tensor = basic
from theano.gradient import DisconnectedType
......
......@@ -2,7 +2,7 @@ import numpy
from theano import gof
from theano.gof import Constant, Generic, Op
from theano.gof.sched import key_to_cmp
from basic import tensor
from theano.tensor import tensor
import theano
##########################
# Disk Access
......
......@@ -23,9 +23,9 @@ from theano.gof import Variable, Constant
from theano.gof.python25 import maxsize
from theano.gof.utils import MethodNotDefined
from theano.configparser import config
from elemwise import Elemwise, DimShuffle
from theano.tensor.elemwise import Elemwise, DimShuffle
from theano import scalar
import basic as T
from theano.tensor import basic as T
from theano import compile # to register the optimizer built by this file
from theano.gof.python25 import any, all
......@@ -33,7 +33,7 @@ from theano.gof.opt import (Optimizer, pre_constant_merge,
pre_greedy_local_optimizer)
from theano.gof.opt import merge_optimizer
from theano.gof import toolbox, DestroyHandler
from basic import get_scalar_constant_value, ShapeError, NotScalarConstantError
from theano.tensor.basic import get_scalar_constant_value, ShapeError, NotScalarConstantError
theano.configparser.AddConfigVar('on_shape_error',
......
......@@ -29,13 +29,13 @@ import logging
_logger = logging.getLogger('theano.tensor.opt')
from theano import gof
from elemwise import CAReduce
import basic as T
from theano.tensor.elemwise import CAReduce
from theano.tensor import basic as T
from theano.gof.opt import Optimizer
from theano.gof import InconsistencyError, toolbox
from basic import get_scalar_constant_value, NotScalarConstantError
from theano.tensor.basic import get_scalar_constant_value, NotScalarConstantError
from theano.tensor.opt import register_uncanonicalize
from theano import scalar as scal
......
......@@ -7,8 +7,8 @@ import numpy
#local imports
import theano
import basic as tensor
import opt
from theano import tensor
from theano.tensor import opt
from theano import gof
from theano.compile import optdb
......
......@@ -8,7 +8,7 @@ import numpy
from theano.compile.sharedvalue import (SharedVariable, shared_constructor,
shared)
import raw_random
from theano.tensor import raw_random
class RandomStateSharedVariable(SharedVariable):
......
......@@ -3,7 +3,7 @@ import traceback
import numpy
import theano.tensor.basic
from basic import TensorType, _tensor_py_operators
from theano.tensor.basic import TensorType, _tensor_py_operators
from theano.compile import shared_constructor, SharedVariable
......
......@@ -3,7 +3,7 @@ import numpy as np
import theano
from theano.tensor import tensor
from basic import mul
from theano.tensor.basic import mul
class SortOp(theano.Op):
......
......@@ -66,7 +66,7 @@ class QuadraticDenoisingAA(module.Module):
"""
super(QuadraticDenoisingAA, self).__init__()
self.random = T.RandomStreams()
self.random = T.randomstreams.RandomStreams()
# MODEL CONFIGURATION
# self.regularize = regularize
......
import numpy
from elemwise import Elemwise
from theano.tensor.elemwise import Elemwise
from theano import scalar
class XlogX(scalar.UnaryScalarOp):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论