Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
bcc9336f
提交
bcc9336f
authored
12月 01, 2015
作者:
Nicolas Ballas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
prepare conv2d transition
上级
9baed894
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
98 行增加
和
18 行删除
+98
-18
dnn.py
theano/sandbox/cuda/dnn.py
+4
-4
opt.py
theano/sandbox/cuda/opt.py
+4
-4
test_abstractconv.py
theano/sandbox/cuda/tests/test_abstractconv.py
+1
-1
dnn.py
theano/sandbox/gpuarray/dnn.py
+1
-1
__init__.py
theano/tensor/nnet/__init__.py
+85
-1
abstract_conv.py
theano/tensor/nnet/abstract_conv.py
+0
-4
conv.py
theano/tensor/nnet/conv.py
+2
-2
corr.py
theano/tensor/nnet/corr.py
+1
-1
没有找到文件。
theano/sandbox/cuda/dnn.py
浏览文件 @
bcc9336f
...
...
@@ -11,7 +11,7 @@ from theano.gof.type import CDataType, Generic
from
theano.compile
import
optdb
from
theano.compile.ops
import
shape_i
from
theano.tensor.nnet
import
SoftmaxGrad
from
theano.tensor.nnet.abstract_conv
2d
import
get_conv_output_shape
from
theano.tensor.nnet.abstract_conv
import
get_conv_output_shape
from
theano.tensor.signal.downsample
import
(
DownsampleFactorMax
,
MaxPoolGrad
,
AveragePoolGrad
)
from
theano.sandbox.cuda.type
import
CudaNdarrayType
...
...
@@ -30,9 +30,9 @@ from theano.sandbox.cuda import gpu_seqopt, register_opt
from
theano.sandbox.cuda.nvcc_compiler
import
NVCC_compiler
from
theano.tensor.nnet.abstract_conv
2d
import
(
AbstractConv2d
,
AbstractConv2d_gradWeights
,
AbstractConv2d_gradInputs
)
from
theano.tensor.nnet.abstract_conv
import
(
AbstractConv2d
,
AbstractConv2d_gradWeights
,
AbstractConv2d_gradInputs
)
def
dnn_available
():
if
dnn_available
.
avail
is
None
:
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
bcc9336f
...
...
@@ -75,10 +75,10 @@ from theano.tensor import slinalg
from
theano.tensor.nnet.Conv3D
import
Conv3D
from
theano.tests.breakpoint
import
PdbBreakpoint
from
theano.tensor.nnet.abstract_conv
2d
import
(
BaseAbstractConv2d
,
AbstractConv2d
,
AbstractConv2d_gradWeights
,
AbstractConv2d_gradInputs
)
from
theano.tensor.nnet.abstract_conv
import
(
BaseAbstractConv2d
,
AbstractConv2d
,
AbstractConv2d_gradWeights
,
AbstractConv2d_gradInputs
)
from
theano.tensor.opt
import
register_specialize_device
...
...
theano/sandbox/cuda/tests/test_abstractconv.py
浏览文件 @
bcc9336f
...
...
@@ -4,7 +4,7 @@ import itertools
import
theano
from
theano.tests
import
unittest_tools
as
utt
import
theano.tensor.nnet.abstract_conv
2d
as
conv
import
theano.tensor.nnet.abstract_conv
as
conv
from
theano.sandbox.cuda
import
float32_shared_constructor
as
gpu_shared
from
theano.compile
import
shared
as
cpu_shared
from
theano.sandbox.cuda.dnn
import
dnn_available
,
dnn_conv
,
dnn_gradweight
,
dnn_gradinput
...
...
theano/sandbox/gpuarray/dnn.py
浏览文件 @
bcc9336f
...
...
@@ -12,7 +12,7 @@ from theano.gof.type import CDataType, Generic
from
theano.compile
import
optdb
from
theano.compile.ops
import
shape_i
from
theano.tensor.nnet
import
SoftmaxGrad
from
theano.tensor.nnet.abstract_conv
2d
import
get_conv_output_shape
from
theano.tensor.nnet.abstract_conv
import
get_conv_output_shape
from
theano.tensor.signal.downsample
import
(
DownsampleFactorMax
,
MaxPoolGrad
,
AveragePoolGrad
)
...
...
theano/tensor/nnet/__init__.py
浏览文件 @
bcc9336f
...
...
@@ -22,7 +22,7 @@ from .nnet import (
prepend_scalar_to_each_row
,
relu
,
softmax
,
softmax_grad
,
softmax_graph
,
softmax_op
,
softmax_simplifier
,
softmax_with_bias
)
from
.
import
opt
from
.conv
import
conv2d
,
ConvOp
from
.conv
import
ConvOp
from
.Conv3D
import
*
from
.ConvGrad3D
import
*
from
.ConvTransp3D
import
*
...
...
@@ -30,3 +30,87 @@ from .sigm import (softplus, sigmoid, sigmoid_inplace,
scalar_sigmoid
,
ultra_fast_sigmoid
,
hard_sigmoid
)
from
.bn
import
batch_normalization
import
warnings
from
.abstract_conv
import
conv2d
as
abstract_conv2d
def
conv2d
(
input
,
filters
,
input_shape
=
None
,
image_shape
=
None
,
filter_shape
=
None
,
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
filter_flip
=
True
,
**
kargs
):
"""
This function will build the symbolic graph for convolving a mini-batch of a
stack of 2D inputs with a set of 2D filters. The implementation is modelled
after Convolutional Neural Networks (CNN).
:type input: symbolic 4D tensor
:param input: mini-batch of feature map stacks, of shape
(batch size, input channels, input rows, input columns).
See the optional parameter ``input_shape``.
:type filters: symbolic 4D tensor
:param filters: set of filters used in CNN layer of shape
(output channels, input channels, filter rows, filter columns).
See the optional parameter ``filter_shape``.
:type image_shape: None, tuple/list of len 4 of int or Constant variable
:param image_shape Deprected, use input_shape instead
:type input_shape: None, tuple/list of len 4 of int or Constant variable
:param input_shape: The shape of the input parameter.
Optional, possibly used to choose an optimal implementation.
You can give ``None`` for any element of the list to specify that this
element is not known at compile time.
:type filter_shape: None, tuple/list of len 4 of int or Constant variable
:param filter_shape: The shape of the filters parameter.
Optional, possibly used to choose an optimal implementation.
You can give ``None`` for any element of the list to specify that this
element is not known at compile time.
:type border_mode: str, int or tuple of two int
:param border_mode: Either of the following:
* ``'valid'``: apply filter wherever it completely overlaps with the
input. Generates output of shape: input shape - filter shape + 1
* ``'full'``: apply filter wherever it partly overlaps with the input.
Generates output of shape: input shape + filter shape - 1
* ``'half'``: pad input with a symmetric border of ``filter rows // 2``
rows and ``filter columns // 2`` columns, then perform a valid
convolution. For filters with an odd number of rows and columns, this
leads to the output shape being equal to the input shape.
* ``int``: pad input with a symmetric border of zeros of the given
width, then perform a valid convolution.
* ``(int1, int2)``: pad input with a symmetric border of ``int1`` rows
and ``int2`` columns, then perform a valid convolution.
:type subsample: tuple of len 2
:param subsample: factor by which to subsample the output.
Also called strides elsewhere.
:type filter_flip: bool
:param filter_flip: If ``True``, will flip the filter rows and columns
before sliding them over the input. This operation is normally referred
to as a convolution, and this is the default. If ``False``, the filters
are not flipped and the operation is referred to as a cross-correlation.
:rtype: symbolic 4D tensor
:return: set of feature maps generated by convolutional layer. Tensor is
of shape (batch size, output channels, output rows, output columns)
"""
if
len
(
kargs
.
keys
())
>
0
:
warnings
.
warn
(
str
(
kargs
.
keys
())
+
" are not deprecared in "
"`tensor.nnet.abstract_conv.conv2d` interface"
)
if
image_shape
is
not
None
:
warnings
.
warn
(
"image_shape is not supported in "
"`tensor.nnet.abstract_conv.conv2d` interface"
" use input_shape instead."
)
if
input_shape
is
None
:
input_shape
=
image_shape
return
abstract_conv2d
(
input
,
filters
,
input_shape
,
filter_shape
,
border_mode
,
subsample
=
(
1
,
1
))
theano/tensor/nnet/abstract_conv
2d
.py
→
theano/tensor/nnet/abstract_conv.py
浏览文件 @
bcc9336f
...
...
@@ -10,10 +10,6 @@ import theano
from
theano.tensor
import
(
as_tensor_variable
,
patternbroadcast
)
from
theano.tensor
import
TensorType
from
theano.gof
import
Apply
,
Op
from
theano.gof
import
local_optimizer
from
theano.tensor.opt
import
register_specialize_device
_logger
=
logging
.
getLogger
(
"theano.tensor.nnet.conv2d"
)
...
...
theano/tensor/nnet/conv.py
浏览文件 @
bcc9336f
...
...
@@ -21,8 +21,8 @@ from theano import OpenMPOp
from
theano.tensor
import
(
as_tensor_variable
,
blas
,
get_scalar_constant_value
,
patternbroadcast
,
NotScalarConstantError
)
from
theano.gof
import
Apply
from
theano.tensor.nnet.abstract_conv
2d
import
(
get_conv_output_shape
,
get_conv_shape_1axis
)
from
theano.tensor.nnet.abstract_conv
import
(
get_conv_output_shape
,
get_conv_shape_1axis
)
try
:
# TODO: move these back out to global scope when they no longer
...
...
theano/tensor/nnet/corr.py
浏览文件 @
bcc9336f
...
...
@@ -5,7 +5,7 @@ import theano
from
theano
import
Apply
from
theano
import
gof
from
theano.tensor
import
as_tensor_variable
,
TensorType
from
theano.tensor.nnet.abstract_conv
2d
import
get_conv_output_shape
from
theano.tensor.nnet.abstract_conv
import
get_conv_output_shape
from
theano.tensor.blas_headers
import
blas_header_text
from
theano.tensor.blas
import
ldflags
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论