Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5ae986b1
提交
5ae986b1
authored
8月 27, 2017
作者:
Vikram
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Documentation suggestions implemented
上级
444f7d56
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
15 行增加
和
16 行删除
+15
-16
dnn.py
theano/gpuarray/dnn.py
+5
-0
__init__.py
theano/tensor/nnet/__init__.py
+6
-12
abstract_conv.py
theano/tensor/nnet/abstract_conv.py
+0
-0
corr.py
theano/tensor/nnet/corr.py
+1
-1
test_abstract_conv.py
theano/tensor/nnet/tests/test_abstract_conv.py
+3
-3
没有找到文件。
theano/gpuarray/dnn.py
浏览文件 @
5ae986b1
...
@@ -3039,6 +3039,7 @@ def local_abstractconv_cudnn_graph(op, context_name, inputs, outputs):
...
@@ -3039,6 +3039,7 @@ def local_abstractconv_cudnn_graph(op, context_name, inputs, outputs):
return
None
return
None
if
isinstance
(
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
op
.
border_mode
):
if
isinstance
(
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
op
.
border_mode
):
# Asymmetric padding not yet supported
return
None
return
None
inp1
=
inputs
[
0
]
inp1
=
inputs
[
0
]
...
@@ -3138,6 +3139,7 @@ def local_abstractconv_cudnn(node):
...
@@ -3138,6 +3139,7 @@ def local_abstractconv_cudnn(node):
if
node
.
op
.
unshared
:
if
node
.
op
.
unshared
:
return
None
return
None
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
# Asymmetric padding not yet supported
return
None
return
None
if
isinstance
(
node
.
op
,
AbstractConv2d
):
if
isinstance
(
node
.
op
,
AbstractConv2d
):
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
...
@@ -3156,6 +3158,7 @@ def local_abstractconv_cudnn_alt(node):
...
@@ -3156,6 +3158,7 @@ def local_abstractconv_cudnn_alt(node):
if
node
.
op
.
unshared
:
if
node
.
op
.
unshared
:
return
None
return
None
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
# Asymmetric padding not yet supported
return
None
return
None
inp1
=
node
.
inputs
[
0
]
inp1
=
node
.
inputs
[
0
]
inp2
=
node
.
inputs
[
1
]
inp2
=
node
.
inputs
[
1
]
...
@@ -3366,6 +3369,7 @@ def local_abstractconv_gw_cudnn(node):
...
@@ -3366,6 +3369,7 @@ def local_abstractconv_gw_cudnn(node):
if
node
.
op
.
unshared
:
if
node
.
op
.
unshared
:
return
None
return
None
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
# Asymmetric padding not yet supported
return
None
return
None
if
isinstance
(
node
.
op
,
AbstractConv2d_gradWeights
):
if
isinstance
(
node
.
op
,
AbstractConv2d_gradWeights
):
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
...
@@ -3381,6 +3385,7 @@ def local_abstractconv_gi_cudnn(node):
...
@@ -3381,6 +3385,7 @@ def local_abstractconv_gi_cudnn(node):
if
node
.
op
.
unshared
:
if
node
.
op
.
unshared
:
return
None
return
None
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
# Asymmetric padding not yet supported
return
None
return
None
if
isinstance
(
node
.
op
,
AbstractConv2d_gradInputs
):
if
isinstance
(
node
.
op
,
AbstractConv2d_gradInputs
):
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
...
...
theano/tensor/nnet/__init__.py
浏览文件 @
5ae986b1
...
@@ -72,18 +72,17 @@ def conv2d(input, filters, input_shape=None, filter_shape=None,
...
@@ -72,18 +72,17 @@ def conv2d(input, filters, input_shape=None, filter_shape=None,
You can give ``None`` for any element of the list to specify that this
You can give ``None`` for any element of the list to specify that this
element is not known at compile time.
element is not known at compile time.
border_mode: str, int or tuple of ``convdim`` elements where each element
border_mode: str, int or a tuple of two ints or pairs of ints
is an integer or a tuple of length 2.
Either of the following:
Either of the following:
``'valid'``: apply filter wherever it completely overlaps with the
``'valid'``: apply filter wherever it completely overlaps with the
input. Generates output of shape: input shape - filter shape + 1
input. Generates output of shape: input shape - filter shape + 1
``'full'``: apply filter wherever it partly overlaps with the input.
``'full'``: apply filter wherever it partly overlaps with the input.
Generates output of shape: input shape + filter shape - 1
Generates output of shape: input shape + filter shape - 1
``'half'``: pad input with a symmetric border of ``filter
size
// 2``
``'half'``: pad input with a symmetric border of ``filter
rows
// 2``
in each convolution dimension, then perform a valid convolution.
rows and ``filter columns // 2`` columns, then perform a valid
For filters with an odd filter size, this leads to the output
convolution. For filters with an odd number of rows and columns, this
shape being equal to the input shape.
leads to the output
shape being equal to the input shape.
``int``: pad input with a symmetric border of zeros of the given
``int``: pad input with a symmetric border of zeros of the given
width, then perform a valid convolution.
width, then perform a valid convolution.
``(int1, int2)``: (for 2D) pad input with a symmetric border of ``int1``,
``(int1, int2)``: (for 2D) pad input with a symmetric border of ``int1``,
...
@@ -91,11 +90,6 @@ def conv2d(input, filters, input_shape=None, filter_shape=None,
...
@@ -91,11 +90,6 @@ def conv2d(input, filters, input_shape=None, filter_shape=None,
``(int1, (int2, int3))`` or ``((int1, int2), int3)``: (for 2D)
``(int1, (int2, int3))`` or ``((int1, int2), int3)``: (for 2D)
pad input with one symmetric border of `int1`` or ``int3``, and
pad input with one symmetric border of `int1`` or ``int3``, and
one asymmetric border of ``(int2, int3)`` or ``(int1, int2)``.
one asymmetric border of ``(int2, int3)`` or ``(int1, int2)``.
``((int1, int2), (int3, int4))``: (for 2D) pad input with an asymmetric
border of ``(int1, int2)`` along one dimension and ``(int3, int4)``
along the second dimension.
``(int1, int2, int3)``: (for 3D) pad input with a symmetric border of
``int1``, ``int2`` and ``int3``, then perform a valid convolution.
subsample: tuple of len 2
subsample: tuple of len 2
Factor by which to subsample the output.
Factor by which to subsample the output.
...
@@ -208,7 +202,7 @@ def conv2d_transpose(input, filters, output_shape, filter_shape=None,
...
@@ -208,7 +202,7 @@ def conv2d_transpose(input, filters, output_shape, filter_shape=None,
You can give ``None`` for any element of the list to specify that this
You can give ``None`` for any element of the list to specify that this
element is not known at compile time.
element is not known at compile time.
border_mode: str, int or tuple of two
elements
border_mode: str, int or tuple of two
int
Refers to the ``border_mode`` argument of the corresponding forward
Refers to the ``border_mode`` argument of the corresponding forward
(non-transposed) convolution. See the argument description in
(non-transposed) convolution. See the argument description in
``conv2d``. What was ``padding`` for the forward convolution means
``conv2d``. What was ``padding`` for the forward convolution means
...
...
theano/tensor/nnet/abstract_conv.py
浏览文件 @
5ae986b1
差异被折叠。
点击展开。
theano/tensor/nnet/corr.py
浏览文件 @
5ae986b1
...
@@ -89,7 +89,7 @@ class BaseCorrMM(gof.OpenMPOp):
...
@@ -89,7 +89,7 @@ class BaseCorrMM(gof.OpenMPOp):
raise
ValueError
(
raise
ValueError
(
'invalid border_mode {}, which must be either '
'invalid border_mode {}, which must be either '
'"valid", "full", "half", an integer or a tuple '
'"valid", "full", "half", an integer or a tuple '
'of
length 2
'
.
format
(
border_mode
))
'of
two integers or a pair of integers
'
.
format
(
border_mode
))
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"
)
...
...
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
5ae986b1
...
@@ -24,7 +24,7 @@ from theano.tensor.nnet.abstract_conv import bilinear_kernel_1D
...
@@ -24,7 +24,7 @@ from theano.tensor.nnet.abstract_conv import bilinear_kernel_1D
from
theano.tensor.nnet.abstract_conv
import
bilinear_kernel_2D
from
theano.tensor.nnet.abstract_conv
import
bilinear_kernel_2D
from
theano.tensor.nnet.abstract_conv
import
bilinear_upsampling
from
theano.tensor.nnet.abstract_conv
import
bilinear_upsampling
from
theano.tensor.nnet.abstract_conv
import
separable_conv2d
,
separable_conv3d
from
theano.tensor.nnet.abstract_conv
import
separable_conv2d
,
separable_conv3d
from
theano.tensor.nnet.abstract_conv
import
causal_conv
from
theano.tensor.nnet.abstract_conv
import
causal_conv
1d
from
theano.tensor.nnet.corr
import
(
CorrMM
,
CorrMM_gradWeights
,
from
theano.tensor.nnet.corr
import
(
CorrMM
,
CorrMM_gradWeights
,
CorrMM_gradInputs
)
CorrMM_gradInputs
)
from
theano.tensor.nnet.corr3d
import
(
Corr3dMM
,
Corr3dMM_gradWeights
,
from
theano.tensor.nnet.corr3d
import
(
Corr3dMM
,
Corr3dMM_gradWeights
,
...
@@ -2037,7 +2037,7 @@ class TestCausalConv(unittest.TestCase):
...
@@ -2037,7 +2037,7 @@ class TestCausalConv(unittest.TestCase):
img_sym
=
theano
.
tensor
.
tensor3
(
'img'
)
img_sym
=
theano
.
tensor
.
tensor3
(
'img'
)
kern_sym
=
theano
.
tensor
.
tensor3
(
'kern'
)
kern_sym
=
theano
.
tensor
.
tensor3
(
'kern'
)
sym_out
=
causal_conv
(
img_sym
,
kern_sym
,
self
.
kern
.
shape
,
filter_dilation
=
self
.
dilation
)
sym_out
=
causal_conv
1d
(
img_sym
,
kern_sym
,
self
.
kern
.
shape
,
filter_dilation
=
self
.
dilation
)
causal_func
=
theano
.
function
([
img_sym
,
kern_sym
],
sym_out
,
mode
=
self
.
mode
)
causal_func
=
theano
.
function
([
img_sym
,
kern_sym
],
sym_out
,
mode
=
self
.
mode
)
...
@@ -2046,6 +2046,6 @@ class TestCausalConv(unittest.TestCase):
...
@@ -2046,6 +2046,6 @@ class TestCausalConv(unittest.TestCase):
utt
.
assert_allclose
(
output
,
self
.
precomp_top
)
utt
.
assert_allclose
(
output
,
self
.
precomp_top
)
def
causal_conv_fn
(
inputs_val
,
filters_val
):
def
causal_conv_fn
(
inputs_val
,
filters_val
):
return
causal_conv
(
inputs_val
,
filters_val
,
self
.
kern
.
shape
,
filter_dilation
=
1
)
return
causal_conv
1d
(
inputs_val
,
filters_val
,
self
.
kern
.
shape
,
filter_dilation
=
1
)
utt
.
verify_grad
(
causal_conv_fn
,
[
self
.
img
,
self
.
kern
],
mode
=
self
.
mode
,
eps
=
1
)
utt
.
verify_grad
(
causal_conv_fn
,
[
self
.
img
,
self
.
kern
],
mode
=
self
.
mode
,
eps
=
1
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论