Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
af1314a0
提交
af1314a0
authored
5月 04, 2015
作者:
David Warde-Farley
提交者:
Arnaud Bergeron
6月 22, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix get_unbound_function that had been modified in six.
上级
cbcc42e4
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
4 行删除
+13
-4
__init__.py
theano/compat/__init__.py
+13
-4
没有找到文件。
theano/compat/__init__.py
浏览文件 @
af1314a0
...
@@ -2,12 +2,11 @@
...
@@ -2,12 +2,11 @@
"""
"""
# Python 3.x compatibility
# Python 3.x compatibility
from
theano.compat.six
import
PY3
,
b
,
BytesIO
,
next
,
get_unbound_function
from
theano.compat.six
import
PY3
,
b
,
BytesIO
,
next
from
theano.compat.six.moves
import
configparser
from
theano.compat.six.moves
import
configparser
from
theano.compat.six.moves
import
reload_module
as
reload
from
theano.compat.six.moves
import
reload_module
as
reload
__all__
=
[
'PY3'
,
'b'
,
'BytesIO'
,
'next'
,
'get_unbound_function'
,
__all__
=
[
'PY3'
,
'b'
,
'BytesIO'
,
'next'
,
'configparser'
,
'reload'
]
'configparser'
,
'reload'
]
if
PY3
:
if
PY3
:
from
operator
import
truediv
as
operator_div
from
operator
import
truediv
as
operator_div
...
@@ -25,6 +24,16 @@ if PY3:
...
@@ -25,6 +24,16 @@ if PY3:
"""Return -1 if x < y, 0 if x == y, 1 if x > y."""
"""Return -1 if x < y, 0 if x == y, 1 if x > y."""
return
(
x
>
y
)
-
(
x
<
y
)
return
(
x
>
y
)
-
(
x
<
y
)
def
get_unbound_function
(
unbound
):
# Op.make_thunk isn't bound, so don't have a __func__ attr.
# But bound method, have a __func__ method that point to the
# not bound method. That is what we want.
if
hasattr
(
unbound
,
'__func__'
):
return
unbound
.
__func__
return
unbound
from
functools
import
partial
from
functools
import
partial
from
collections
import
defaultdict
,
deque
from
collections
import
defaultdict
,
deque
from
sys
import
maxsize
from
sys
import
maxsize
...
@@ -38,7 +47,7 @@ if PY3:
...
@@ -38,7 +47,7 @@ if PY3:
for
x
in
itr
:
for
x
in
itr
:
yield
x
.
decode
()
yield
x
.
decode
()
else
:
else
:
from
theano.compat.six
import
get_unbound_function
from
operator
import
div
as
operator_div
from
operator
import
div
as
operator_div
def
exc_message
(
e
):
def
exc_message
(
e
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论