Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ba857335
提交
ba857335
authored
2月 04, 2020
作者:
Miro Hrončok
提交者:
Brandon T. Willard
3月 18, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move more collections.abc imports to theano.compat
上级
b6a66822
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
18 行增加
和
13 行删除
+18
-13
__init__.py
theano/compat/__init__.py
+8
-4
nanguardmode.py
theano/compile/nanguardmode.py
+2
-2
frozendict.py
theano/misc/frozendict.py
+4
-2
basic.py
theano/scalar/basic.py
+2
-3
subtensor.py
theano/tensor/subtensor.py
+2
-2
没有找到文件。
theano/compat/__init__.py
浏览文件 @
ba857335
...
@@ -8,12 +8,14 @@ from six.moves import configparser
...
@@ -8,12 +8,14 @@ from six.moves import configparser
from
six.moves
import
reload_module
as
reload
from
six.moves
import
reload_module
as
reload
from
collections
import
OrderedDict
from
collections
import
OrderedDict
try
:
try
:
from
collections.abc
import
MutableMapping
as
DictMixin
,
Callable
from
collections.abc
import
(
Callable
,
Iterable
,
Mapping
,
ValuesView
,
MutableMapping
as
DictMixin
)
except
ImportError
:
except
ImportError
:
# this raises an DeprecationWarning on py37 and will become
# this raises an DeprecationWarning on py37 and will become
# and Exception in py39. Importing from collections.abc
# and Exception in py39. Importing from collections.abc
# won't work on py27
# won't work on py27
from
collections
import
MutableMapping
as
DictMixin
,
Callable
from
collections
import
(
Callable
,
Iterable
,
Mapping
,
ValuesView
,
MutableMapping
as
DictMixin
)
__all__
=
[
'PY3'
,
'b'
,
'BytesIO'
,
'next'
,
'configparser'
,
'reload'
]
__all__
=
[
'PY3'
,
'b'
,
'BytesIO'
,
'next'
,
'configparser'
,
'reload'
]
...
@@ -72,8 +74,10 @@ else:
...
@@ -72,8 +74,10 @@ else:
def
decode_with
(
x
,
encoding
):
def
decode_with
(
x
,
encoding
):
return
x
return
x
__all__
+=
[
'cmp'
,
'operator_div'
,
'DictMixin'
,
'OrderedDict'
,
'decode'
,
__all__
+=
[
'cmp'
,
'operator_div'
,
'decode_iter'
,
'get_unbound_function'
,
'imap'
,
'izip'
,
'ifilter'
]
'DictMixin'
,
'Iterable'
,
'Mapping'
,
'OrderedDict'
,
'ValuesView'
,
'decode'
,
'decode_iter'
,
'get_unbound_function'
,
'imap'
,
'izip'
,
'ifilter'
]
class
DefaultOrderedDict
(
OrderedDict
):
class
DefaultOrderedDict
(
OrderedDict
):
...
...
theano/compile/nanguardmode.py
浏览文件 @
ba857335
from
__future__
import
absolute_import
,
print_function
,
division
from
__future__
import
absolute_import
,
print_function
,
division
import
collections
import
logging
import
logging
from
six.moves
import
StringIO
from
six.moves
import
StringIO
...
@@ -9,6 +8,7 @@ import theano
...
@@ -9,6 +8,7 @@ import theano
from
theano
import
config
from
theano
import
config
import
theano.tensor
as
T
import
theano.tensor
as
T
from
theano.compile
import
Mode
from
theano.compile
import
Mode
from
theano.compat
import
ValuesView
from
.mode
import
get_mode
from
.mode
import
get_mode
try
:
try
:
...
@@ -68,7 +68,7 @@ def flatten(l):
...
@@ -68,7 +68,7 @@ def flatten(l):
A flattened list of objects.
A flattened list of objects.
"""
"""
if
isinstance
(
l
,
(
list
,
tuple
,
collections
.
ValuesView
)):
if
isinstance
(
l
,
(
list
,
tuple
,
ValuesView
)):
rval
=
[]
rval
=
[]
for
elem
in
l
:
for
elem
in
l
:
if
isinstance
(
elem
,
(
list
,
tuple
)):
if
isinstance
(
elem
,
(
list
,
tuple
)):
...
...
theano/misc/frozendict.py
浏览文件 @
ba857335
...
@@ -5,10 +5,12 @@ import collections
...
@@ -5,10 +5,12 @@ import collections
import
operator
import
operator
import
functools
import
functools
from
theano.compat
import
Mapping
class
frozendict
(
collections
.
Mapping
):
class
frozendict
(
Mapping
):
"""
"""
An immutable wrapper around dictionaries that implements the complete :py:class:`collections.Mapping`
An immutable wrapper around dictionaries that implements the complete :py:class:`collections.
abc.
Mapping`
interface. It can be used as a drop-in replacement for dictionaries where immutability and ordering are desired.
interface. It can be used as a drop-in replacement for dictionaries where immutability and ordering are desired.
"""
"""
...
...
theano/scalar/basic.py
浏览文件 @
ba857335
...
@@ -22,7 +22,7 @@ import six
...
@@ -22,7 +22,7 @@ import six
from
six.moves
import
xrange
from
six.moves
import
xrange
import
theano
import
theano
from
theano.compat
import
imap
,
izip
from
theano.compat
import
imap
,
izip
,
Callable
from
theano
import
gof
,
printing
from
theano
import
gof
,
printing
from
theano.gof
import
(
Op
,
utils
,
Variable
,
Constant
,
Type
,
Apply
,
from
theano.gof
import
(
Op
,
utils
,
Variable
,
Constant
,
Type
,
Apply
,
FunctionGraph
)
FunctionGraph
)
...
@@ -33,7 +33,6 @@ from theano.gradient import DisconnectedType
...
@@ -33,7 +33,6 @@ from theano.gradient import DisconnectedType
from
theano.gradient
import
grad_undefined
from
theano.gradient
import
grad_undefined
from
theano.printing
import
pprint
from
theano.printing
import
pprint
import
collections
builtin_bool
=
bool
builtin_bool
=
bool
builtin_complex
=
complex
builtin_complex
=
complex
...
@@ -1028,7 +1027,7 @@ class ScalarOp(Op):
...
@@ -1028,7 +1027,7 @@ class ScalarOp(Op):
def
__init__
(
self
,
output_types_preference
=
None
,
name
=
None
):
def
__init__
(
self
,
output_types_preference
=
None
,
name
=
None
):
self
.
name
=
name
self
.
name
=
name
if
output_types_preference
is
not
None
:
if
output_types_preference
is
not
None
:
if
not
isinstance
(
output_types_preference
,
collections
.
Callable
):
if
not
isinstance
(
output_types_preference
,
Callable
):
raise
TypeError
(
raise
TypeError
(
"Expected a callable for the 'output_types_preference' argument to
%
s. (got:
%
s)"
%
"Expected a callable for the 'output_types_preference' argument to
%
s. (got:
%
s)"
%
(
self
.
__class__
,
output_types_preference
))
(
self
.
__class__
,
output_types_preference
))
...
...
theano/tensor/subtensor.py
浏览文件 @
ba857335
from
__future__
import
absolute_import
,
print_function
,
division
from
__future__
import
absolute_import
,
print_function
,
division
import
sys
import
sys
from
textwrap
import
dedent
from
textwrap
import
dedent
import
collections
import
warnings
import
warnings
import
logging
import
logging
...
@@ -22,6 +21,7 @@ from theano.tensor.basic import (addbroadcast, clip, get_scalar_constant_value,
...
@@ -22,6 +21,7 @@ from theano.tensor.basic import (addbroadcast, clip, get_scalar_constant_value,
from
theano.tensor.elemwise
import
DimShuffle
from
theano.tensor.elemwise
import
DimShuffle
from
theano.tensor.type_other
import
NoneConst
,
SliceType
,
NoneTypeT
,
make_slice
from
theano.tensor.type_other
import
NoneConst
,
SliceType
,
NoneTypeT
,
make_slice
from
theano
import
config
from
theano
import
config
from
theano.compat
import
Iterable
from
.inc_code
import
inc_code
from
.inc_code
import
inc_code
...
@@ -2154,7 +2154,7 @@ def check_and_reject_bool(args_el):
...
@@ -2154,7 +2154,7 @@ def check_and_reject_bool(args_el):
pass
pass
if
(
not
isinstance
(
args_el
,
theano
.
tensor
.
Variable
)
and
if
(
not
isinstance
(
args_el
,
theano
.
tensor
.
Variable
)
and
isinstance
(
args_el
,
collections
.
Iterable
)):
isinstance
(
args_el
,
Iterable
)):
for
el
in
args_el
:
for
el
in
args_el
:
check_and_reject_bool
(
el
)
check_and_reject_bool
(
el
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论