Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e14dda64
提交
e14dda64
authored
2月 09, 2016
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Force shape inputs to int64 in CorrMM to avoid having something that does not…
Force shape inputs to int64 in CorrMM to avoid having something that does not match the 'int' assumed type of before.
上级
c3b54b9b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
6 行增加
和
6 行删除
+6
-6
corr.py
theano/tensor/nnet/corr.py
+6
-6
没有找到文件。
theano/tensor/nnet/corr.py
浏览文件 @
e14dda64
...
@@ -177,13 +177,13 @@ class BaseCorrMM(gof.Op):
...
@@ -177,13 +177,13 @@ class BaseCorrMM(gof.Op):
if
((
direction
!=
0
)
and
(
dH
!=
1
))
or
((
direction
==
1
)
and
(
padH
==
-
1
)):
if
((
direction
!=
0
)
and
(
dH
!=
1
))
or
((
direction
==
1
)
and
(
padH
==
-
1
)):
if
not
height
:
if
not
height
:
raise
ValueError
(
"height must be given for backprop with vertical sampling or border_mode='half'"
)
raise
ValueError
(
"height must be given for backprop with vertical sampling or border_mode='half'"
)
height
=
'(*(npy_int*)(PyArray_DATA(
%
s)))'
%
height
height
=
'(*(npy_int
64
*)(PyArray_DATA(
%
s)))'
%
height
else
:
else
:
height
=
'-1'
height
=
'-1'
if
((
direction
!=
0
)
and
(
dW
!=
1
))
or
((
direction
==
1
)
and
(
padW
==
-
1
)):
if
((
direction
!=
0
)
and
(
dW
!=
1
))
or
((
direction
==
1
)
and
(
padW
==
-
1
)):
if
not
width
:
if
not
width
:
raise
ValueError
(
"width must be given for backprop with horizontal sampling or border_mode='half'"
)
raise
ValueError
(
"width must be given for backprop with horizontal sampling or border_mode='half'"
)
width
=
'(*(npy_int*)(PyArray_DATA(
%
s)))'
%
width
width
=
'(*(npy_int
64
*)(PyArray_DATA(
%
s)))'
%
width
else
:
else
:
width
=
'-1'
width
=
'-1'
sub
=
sub
.
copy
()
sub
=
sub
.
copy
()
...
@@ -314,8 +314,8 @@ class BaseCorrMM(gof.Op):
...
@@ -314,8 +314,8 @@ class BaseCorrMM(gof.Op):
if (NULL ==
%(out)
s)
if (NULL ==
%(out)
s)
{
{
PyErr_Format(PyExc_RuntimeError,
PyErr_Format(PyExc_RuntimeError,
"BaseCorrMM: Failed to allocate output of
%%
d x
%%
d x
%%
d x
%%
d",
"BaseCorrMM: Failed to allocate output of
%%
lld x
%%
lld x
%%
lld x
%%
ll
d",
out_dim[0], out_dim[1], out_dim[2],
out_dim[3]);
(long long)out_dim[0], (long long)out_dim[1], (long long)out_dim[2], (long long)
out_dim[3]);
%(fail)
s
%(fail)
s
}
}
}
}
...
@@ -424,7 +424,7 @@ class CorrMM_gradWeights(BaseCorrMM):
...
@@ -424,7 +424,7 @@ class CorrMM_gradWeights(BaseCorrMM):
if
shape
is
None
:
if
shape
is
None
:
raise
ValueError
(
'shape must be given if subsample != (1, 1)'
raise
ValueError
(
'shape must be given if subsample != (1, 1)'
' or border_mode == "half"'
)
' or border_mode == "half"'
)
height_width
=
[
as_tensor_variable
(
shape
[
0
])
,
as_tensor_variable
(
shape
[
1
]
)]
height_width
=
[
as_tensor_variable
(
shape
[
0
])
.
astype
(
'int64'
),
as_tensor_variable
(
shape
[
1
])
.
astype
(
'int64'
)]
else
:
else
:
height_width
=
[]
height_width
=
[]
...
@@ -519,7 +519,7 @@ class CorrMM_gradInputs(BaseCorrMM):
...
@@ -519,7 +519,7 @@ class CorrMM_gradInputs(BaseCorrMM):
raise
TypeError
(
'topgrad must be 4D tensor'
)
raise
TypeError
(
'topgrad must be 4D tensor'
)
if
self
.
subsample
!=
(
1
,
1
)
and
shape
is
None
:
if
self
.
subsample
!=
(
1
,
1
)
and
shape
is
None
:
raise
ValueError
(
'shape must be given if subsample != (1, 1)'
)
raise
ValueError
(
'shape must be given if subsample != (1, 1)'
)
height_width
=
[
as_tensor_variable
(
shape
[
0
])
,
as_tensor_variable
(
shape
[
1
]
)]
if
self
.
subsample
!=
(
1
,
1
)
else
[]
height_width
=
[
as_tensor_variable
(
shape
[
0
])
.
astype
(
'int64'
),
as_tensor_variable
(
shape
[
1
])
.
astype
(
'int64'
)]
if
self
.
subsample
!=
(
1
,
1
)
else
[]
broadcastable
=
[
topgrad
.
type
.
broadcastable
[
0
],
kern
.
type
.
broadcastable
[
1
],
broadcastable
=
[
topgrad
.
type
.
broadcastable
[
0
],
kern
.
type
.
broadcastable
[
1
],
False
,
False
]
False
,
False
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论