Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b7bcc91a
提交
b7bcc91a
authored
5月 29, 2014
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1882 from abergeron/cuda_fftconv
Cuda fftconv assert
上级
ba81e61d
1a60236f
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
13 行增加
和
6 行删除
+13
-6
fftconv.py
theano/sandbox/cuda/fftconv.py
+3
-0
opt.py
theano/tensor/opt.py
+10
-6
没有找到文件。
theano/sandbox/cuda/fftconv.py
浏览文件 @
b7bcc91a
...
@@ -453,6 +453,9 @@ def conv2d_fft(input, filters, image_shape=None, filter_shape=None,
...
@@ -453,6 +453,9 @@ def conv2d_fft(input, filters, image_shape=None, filter_shape=None,
else
:
else
:
raise
ValueError
(
'invalid mode'
)
raise
ValueError
(
'invalid mode'
)
input_padded
=
T
.
opt
.
Assert
(
"in conv2d_fft: width is not even"
)(
input_padded
,
T
.
eq
(
o1
%
2
,
0
))
# reshape for FFT
# reshape for FFT
input_flat
=
input_padded
.
reshape
((
b
*
ic
,
o0
,
o1
))
input_flat
=
input_padded
.
reshape
((
b
*
ic
,
o0
,
o1
))
filters_flat
=
filters_padded
.
reshape
((
oc
*
ic
,
o0
,
o1
))
filters_flat
=
filters_padded
.
reshape
((
oc
*
ic
,
o0
,
o1
))
...
...
theano/tensor/opt.py
浏览文件 @
b7bcc91a
...
@@ -1363,6 +1363,9 @@ class Assert(T.Op):
...
@@ -1363,6 +1363,9 @@ class Assert(T.Op):
"""
"""
view_map
=
{
0
:
[
0
]}
view_map
=
{
0
:
[
0
]}
def
__init__
(
self
,
msg
=
"Theano Assert failed!"
):
self
.
msg
=
msg
def
make_node
(
self
,
value
,
*
conds
):
def
make_node
(
self
,
value
,
*
conds
):
cond
=
[
T
.
as_tensor_variable
(
c
)
for
c
in
conds
]
cond
=
[
T
.
as_tensor_variable
(
c
)
for
c
in
conds
]
assert
numpy
.
all
([
c
.
type
.
ndim
==
0
for
c
in
cond
])
assert
numpy
.
all
([
c
.
type
.
ndim
==
0
for
c
in
cond
])
...
@@ -1375,13 +1378,13 @@ class Assert(T.Op):
...
@@ -1375,13 +1378,13 @@ class Assert(T.Op):
out
,
=
out_
out
,
=
out_
v
=
inputs
[
0
]
v
=
inputs
[
0
]
out
[
0
]
=
v
out
[
0
]
=
v
assert
numpy
.
all
(
inputs
[
1
:])
assert
numpy
.
all
(
inputs
[
1
:])
,
self
.
msg
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
return
type
(
self
)
==
type
(
other
)
and
self
.
msg
==
other
.
msg
def
__hash__
(
self
):
def
__hash__
(
self
):
return
hash
(
type
(
self
))
return
hash
(
type
(
self
))
^
hash
(
self
.
msg
)
def
grad
(
self
,
input
,
output_gradients
):
def
grad
(
self
,
input
,
output_gradients
):
return
output_gradients
return
output_gradients
...
@@ -1391,12 +1394,13 @@ class Assert(T.Op):
...
@@ -1391,12 +1394,13 @@ class Assert(T.Op):
out
=
onames
[
0
]
out
=
onames
[
0
]
check
=
[]
check
=
[]
fail
=
sub
[
'fail'
]
fail
=
sub
[
'fail'
]
msg
=
self
.
msg
.
replace
(
'"'
,
'
\\
"'
)
.
replace
(
'
\n
'
,
'
\\
n'
)
for
idx
in
xrange
(
len
(
inames
)
-
1
):
for
idx
in
xrange
(
len
(
inames
)
-
1
):
i
=
inames
[
idx
+
1
]
i
=
inames
[
idx
+
1
]
dtype
=
node
.
inputs
[
idx
+
1
]
.
dtype
dtype
=
node
.
inputs
[
idx
+
1
]
.
dtype
check
.
append
(
'if(!((npy_
%(dtype)
s*)PyArray_DATA(
%(i)
s))[0])'
check
.
append
(
'if(!((npy_
%(dtype)
s*)PyArray_DATA(
%(i)
s))[0])'
'{PyErr_SetString(PyExc_AssertionError,"
Theano
'
'{PyErr_SetString(PyExc_AssertionError,"
%(msg)
s");
'
'
Assert failed!");
%(fail)
s}'
%
locals
())
'
%(fail)
s}'
%
locals
())
check
=
"
\n
"
.
join
(
check
)
check
=
"
\n
"
.
join
(
check
)
return
"""
return
"""
%(check)
s
%(check)
s
...
@@ -1405,7 +1409,7 @@ class Assert(T.Op):
...
@@ -1405,7 +1409,7 @@ class Assert(T.Op):
"""
%
locals
()
"""
%
locals
()
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
0
,
1
)
return
(
1
,
0
)
def
infer_shape
(
self
,
node
,
input_shapes
):
def
infer_shape
(
self
,
node
,
input_shapes
):
return
[
input_shapes
[
0
]]
return
[
input_shapes
[
0
]]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论