Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
75405be7
提交
75405be7
authored
11月 26, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
crash fix to the new tests that will be in the next commit.
Make subtensor.make_node infer more broadcastable. This remove crash from local_subtensor_merge that was loosing broadcastable dimensions.
上级
2d73c170
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
3 行删除
+12
-3
basic.py
theano/tensor/basic.py
+2
-0
subtensor.py
theano/tensor/subtensor.py
+10
-3
没有找到文件。
theano/tensor/basic.py
浏览文件 @
75405be7
...
@@ -593,6 +593,8 @@ def get_scalar_constant_value(orig_v, elemwise=True):
...
@@ -593,6 +593,8 @@ def get_scalar_constant_value(orig_v, elemwise=True):
# mess with the stabilization optimization and be too slow.
# mess with the stabilization optimization and be too slow.
# We put all the scalar Ops used by get_canonical_form_slice()
# We put all the scalar Ops used by get_canonical_form_slice()
# to allow it to determine the broadcast pattern correctly.
# to allow it to determine the broadcast pattern correctly.
elif
isinstance
(
v
.
owner
.
op
,
ScalarFromTensor
):
return
get_scalar_constant_value
(
v
.
owner
.
inputs
[
0
])
elif
isinstance
(
v
.
owner
.
op
,
scal
.
ScalarOp
):
elif
isinstance
(
v
.
owner
.
op
,
scal
.
ScalarOp
):
if
isinstance
(
v
.
owner
.
op
,
scal
.
Second
):
if
isinstance
(
v
.
owner
.
op
,
scal
.
Second
):
# We don't need both input to be constant for second
# We don't need both input to be constant for second
...
...
theano/tensor/subtensor.py
浏览文件 @
75405be7
...
@@ -16,7 +16,7 @@ from theano.gof.python25 import maxsize
...
@@ -16,7 +16,7 @@ from theano.gof.python25 import maxsize
from
theano.printing
import
pprint
from
theano.printing
import
pprint
from
theano
import
scalar
as
scal
from
theano
import
scalar
as
scal
from
theano.tensor.basic
import
(
addbroadcast
,
clip
,
get_scalar_constant_value
,
from
theano.tensor.basic
import
(
addbroadcast
,
clip
,
get_scalar_constant_value
,
ARange
,
TensorType
)
ARange
,
TensorType
,
NotScalarConstantError
)
from
theano.tensor.elemwise
import
DimShuffle
from
theano.tensor.elemwise
import
DimShuffle
from
theano.tensor.type_other
import
NoneConst
,
SliceType
,
make_slice
from
theano.tensor.type_other
import
NoneConst
,
SliceType
,
make_slice
from
theano
import
config
from
theano
import
config
...
@@ -470,12 +470,19 @@ class Subtensor(Op):
...
@@ -470,12 +470,19 @@ class Subtensor(Op):
broadcastable
=
[]
broadcastable
=
[]
for
i
,
(
p
,
bc
)
in
enumerate
(
izip
(
padded
,
x
.
type
.
broadcastable
)):
for
i
,
(
p
,
bc
)
in
enumerate
(
izip
(
padded
,
x
.
type
.
broadcastable
)):
if
isinstance
(
p
,
slice
):
if
isinstance
(
p
,
slice
):
if
bc
and
p
.
start
in
[
None
,
0
]:
if
bc
:
start
=
p
.
start
try
:
start
=
get_scalar_constant_value
(
start
)
except
NotScalarConstantError
:
pass
if
start
in
[
None
,
0
]:
start
=
p
.
start
start
=
p
.
start
if
start
is
None
:
if
start
is
None
:
start
=
0
start
=
0
if
(
p
.
stop
is
None
or
if
(
p
.
stop
is
None
or
(
isinstance
(
p
.
stop
,
(
int
,
numpy
.
integer
))
and
(
isinstance
(
p
.
stop
,
(
int
,
numpy
.
integer
,
numpy
.
ndarray
))
and
p
.
stop
>
start
)):
p
.
stop
>
start
)):
broadcastable
.
append
(
True
)
broadcastable
.
append
(
True
)
continue
continue
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论