提交 7bd463da authored 作者: abalkin's avatar abalkin

Replace relative imports with absolute.

This is one of the trickier relative to absolute convertions. Some of the initialization code had to be moved from tensor subpackage to the main theano __init__.py in order to work around a circular dependency.
上级 ebee1fb0
......@@ -176,3 +176,13 @@ def test(**kwds):
" It is needed for Theano tests.")
else:
return TheanoNoseTester().test(**kwds)
# 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
......@@ -12,14 +12,16 @@ from theano.tensor import blas_scipy
from theano.tensor import blas_c
from theano.tensor import xlogx
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"""
# 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"""
from theano.tensor.elemwise import DimShuffle, Elemwise, CAReduce
......
......@@ -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
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论