Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
980b74a7
提交
980b74a7
authored
6月 27, 2015
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3075 from carriepl/remove_floordiv_ref
Make tensor.floor_div a reference to tensor.int_div
上级
c5711d7a
f452bfc2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
6 行增加
和
10 行删除
+6
-10
basic.py
theano/tensor/basic.py
+3
-6
opt.py
theano/tensor/opt.py
+3
-4
没有找到文件。
theano/tensor/basic.py
浏览文件 @
980b74a7
...
@@ -3067,16 +3067,13 @@ def true_div(a, b):
...
@@ -3067,16 +3067,13 @@ def true_div(a, b):
@_scal_elemwise_with_nfunc
(
'floor_divide'
,
2
,
1
)
@_scal_elemwise_with_nfunc
(
'floor_divide'
,
2
,
1
)
def
floor
_div
(
a
,
b
):
def
int
_div
(
a
,
b
):
"""elementwise [floor] division (inverse of multiplication)"""
"""elementwise [floor] division (inverse of multiplication)"""
# see decorator for function body
# see decorator for function body
# not a c/p error, floor_div and int_div are the same thing
# floor_div and int_div are the same thing
@_scal_elemwise_with_nfunc
(
'floor_divide'
,
2
,
1
)
floor_div
=
int_div
def
int_div
(
a
,
b
):
"""elementwise integer-division"""
# see decorator for function body
def
ceil_intdiv
(
a
,
b
):
def
ceil_intdiv
(
a
,
b
):
...
...
theano/tensor/opt.py
浏览文件 @
980b74a7
...
@@ -3133,7 +3133,7 @@ def local_mul_switch_sink(node):
...
@@ -3133,7 +3133,7 @@ def local_mul_switch_sink(node):
@register_canonicalize
@register_canonicalize
@gof.local_optimizer
([
T
.
true_div
,
T
.
int_div
,
T
.
floor_div
])
@gof.local_optimizer
([
T
.
true_div
,
T
.
int_div
])
def
local_div_switch_sink
(
node
):
def
local_div_switch_sink
(
node
):
"""
"""
This optimization makes the folowing changes in the graph:
This optimization makes the folowing changes in the graph:
...
@@ -3145,8 +3145,7 @@ def local_div_switch_sink(node):
...
@@ -3145,8 +3145,7 @@ def local_div_switch_sink(node):
NaN or inf values for cases where the switch returns 0.
NaN or inf values for cases where the switch returns 0.
See local_mul_switch_sink for more details.
See local_mul_switch_sink for more details.
"""
"""
if
(
node
.
op
!=
T
.
true_div
and
node
.
op
!=
T
.
int_div
if
(
node
.
op
!=
T
.
true_div
and
node
.
op
!=
T
.
int_div
):
and
node
.
op
!=
T
.
floor_div
):
return
False
return
False
op
=
node
.
op
op
=
node
.
op
if
node
.
inputs
[
0
]
.
owner
and
node
.
inputs
[
0
]
.
owner
.
op
==
T
.
switch
:
if
node
.
inputs
[
0
]
.
owner
and
node
.
inputs
[
0
]
.
owner
.
op
==
T
.
switch
:
...
@@ -4399,7 +4398,7 @@ def local_mul_to_sqr(node):
...
@@ -4399,7 +4398,7 @@ def local_mul_to_sqr(node):
@register_canonicalize
@register_canonicalize
@gof.local_optimizer
([
T
.
int_div
,
T
.
floor_div
])
@gof.local_optimizer
([
T
.
int_div
])
def
local_intdiv_by_one
(
node
):
def
local_intdiv_by_one
(
node
):
"""x // 1 -> x
"""x // 1 -> x
"""
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论