Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0aa5ff77
提交
0aa5ff77
authored
2月 24, 2016
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4018 from abergeron/fix_buildbot
Move the AbstractConv tests with the implementation
上级
42907a0c
2a339bb1
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
11 行增加
和
12 行删除
+11
-12
test_abstractconv.py
theano/sandbox/cuda/tests/test_abstractconv.py
+0
-0
test_abstractconv.py
theano/sandbox/gpuarray/tests/test_abstractconv.py
+0
-0
__init__.py
theano/tensor/nnet/__init__.py
+1
-2
abstract_conv.py
theano/tensor/nnet/abstract_conv.py
+1
-1
corr.py
theano/tensor/nnet/corr.py
+7
-7
corr_gemm.c
theano/tensor/nnet/corr_gemm.c
+2
-2
test_abstract_conv.py
theano/tensor/nnet/tests/test_abstract_conv.py
+0
-0
没有找到文件。
theano/sandbox/cuda/tests/test_abstractconv.py
浏览文件 @
0aa5ff77
差异被折叠。
点击展开。
theano/sandbox/gpuarray/tests/test_abstractconv.py
浏览文件 @
0aa5ff77
差异被折叠。
点击展开。
theano/tensor/nnet/__init__.py
浏览文件 @
0aa5ff77
...
@@ -31,6 +31,7 @@ from .bn import batch_normalization
...
@@ -31,6 +31,7 @@ from .bn import batch_normalization
import
warnings
import
warnings
from
.abstract_conv
import
conv2d
as
abstract_conv2d
from
.abstract_conv
import
conv2d
as
abstract_conv2d
def
conv2d
(
input
,
filters
,
input_shape
=
None
,
filter_shape
=
None
,
def
conv2d
(
input
,
filters
,
input_shape
=
None
,
filter_shape
=
None
,
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
filter_flip
=
True
,
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
filter_flip
=
True
,
image_shape
=
None
,
**
kwargs
):
image_shape
=
None
,
**
kwargs
):
...
@@ -139,5 +140,3 @@ def conv2d(input, filters, input_shape=None, filter_shape=None,
...
@@ -139,5 +140,3 @@ def conv2d(input, filters, input_shape=None, filter_shape=None,
return
abstract_conv2d
(
input
,
filters
,
input_shape
,
filter_shape
,
return
abstract_conv2d
(
input
,
filters
,
input_shape
,
filter_shape
,
border_mode
,
subsample
,
filter_flip
)
border_mode
,
subsample
,
filter_flip
)
theano/tensor/nnet/abstract_conv.py
浏览文件 @
0aa5ff77
...
@@ -408,7 +408,7 @@ class BaseAbstractConv2d(Op):
...
@@ -408,7 +408,7 @@ class BaseAbstractConv2d(Op):
if
len
(
subsample
)
!=
2
:
if
len
(
subsample
)
!=
2
:
raise
ValueError
(
"subsample must have two elements"
)
raise
ValueError
(
"subsample must have two elements"
)
self
.
subsample
=
subsample
self
.
subsample
=
tuple
(
subsample
)
def
flops
(
self
,
inp
,
outp
):
def
flops
(
self
,
inp
,
outp
):
""" Useful with the hack in profilemode to print the MFlops"""
""" Useful with the hack in profilemode to print the MFlops"""
...
...
theano/tensor/nnet/corr.py
浏览文件 @
0aa5ff77
...
@@ -52,7 +52,7 @@ class BaseCorrMM(gof.Op):
...
@@ -52,7 +52,7 @@ class BaseCorrMM(gof.Op):
self
.
border_mode
=
border_mode
self
.
border_mode
=
border_mode
if
len
(
subsample
)
!=
2
:
if
len
(
subsample
)
!=
2
:
raise
ValueError
(
"subsample must have two elements"
)
raise
ValueError
(
"subsample must have two elements"
)
self
.
subsample
=
subsample
self
.
subsample
=
tuple
(
subsample
)
@property
@property
def
pad
(
self
):
def
pad
(
self
):
...
@@ -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
=
[
shape
[
0
],
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
=
[
shape
[
0
],
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
]
...
...
theano/tensor/nnet/corr_gemm.c
浏览文件 @
0aa5ff77
...
@@ -162,7 +162,7 @@ PyArrayObject* corrMM(PyArrayObject* bottom,
...
@@ -162,7 +162,7 @@ PyArrayObject* corrMM(PyArrayObject* bottom,
"CorrMM shape inconsistency:
\n
"
"CorrMM shape inconsistency:
\n
"
" bottom shape: %%d %%d %%d %%d
\n
"
" bottom shape: %%d %%d %%d %%d
\n
"
" weight shape: %%d %%d %%d %%d
\n
"
" weight shape: %%d %%d %%d %%d
\n
"
" top shape: %%
d %%d %%d %%
d (expected %%d %%d %%d %%d)
\n
"
,
" top shape: %%
ld %%ld %%ld %%l
d (expected %%d %%d %%d %%d)
\n
"
,
batchSize
,
nChannels
,
bottomHeight
,
bottomWidth
,
batchSize
,
nChannels
,
bottomHeight
,
bottomWidth
,
nFilters
,
nChannels
,
kH
,
kW
,
nFilters
,
nChannels
,
kH
,
kW
,
PyArray_DIMS
(
top
)[
0
],
PyArray_DIMS
(
top
)[
1
],
PyArray_DIMS
(
top
)[
0
],
PyArray_DIMS
(
top
)[
1
],
...
@@ -182,7 +182,7 @@ PyArrayObject* corrMM(PyArrayObject* bottom,
...
@@ -182,7 +182,7 @@ PyArrayObject* corrMM(PyArrayObject* bottom,
if
(
NULL
==
col
)
if
(
NULL
==
col
)
{
{
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"CorrMM failed to allocate working memory of %%
d x %%
d
\n
"
,
"CorrMM failed to allocate working memory of %%
ld x %%l
d
\n
"
,
col_dim
[
0
],
col_dim
[
1
]);
col_dim
[
0
],
col_dim
[
1
]);
return
NULL
;
return
NULL
;
}
}
...
...
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
0aa5ff77
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论