Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
bc3bd4ee
提交
bc3bd4ee
authored
2月 23, 2011
作者:
David Warde-Farley
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Whitespace cleanup.
上级
1569a7a9
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
20 行增加
和
20 行删除
+20
-20
Conv3D.py
theano/tensor/nnet/Conv3D.py
+2
-2
ConvTransp3D.py
theano/tensor/nnet/ConvTransp3D.py
+1
-1
sigm.py
theano/tensor/nnet/sigm.py
+7
-7
raw_random.py
theano/tensor/raw_random.py
+1
-1
downsample.py
theano/tensor/signal/downsample.py
+9
-9
没有找到文件。
theano/tensor/nnet/Conv3D.py
浏览文件 @
bc3bd4ee
...
@@ -109,7 +109,7 @@ class Conv3D(theano.Op):
...
@@ -109,7 +109,7 @@ class Conv3D(theano.Op):
dCdV
.
name
=
'Conv3D_dCdV.dCdH='
+
dCdH_name
+
',V='
+
V_name
dCdV
.
name
=
'Conv3D_dCdV.dCdH='
+
dCdH_name
+
',V='
+
V_name
dCdW
.
name
=
'Conv3D_dCdW.dCdH='
+
dCdH_name
+
',V='
+
V_name
+
',W='
+
W_name
dCdW
.
name
=
'Conv3D_dCdW.dCdH='
+
dCdH_name
+
',V='
+
V_name
+
',W='
+
W_name
dCdb
.
name
=
'Conv3D_dCdb.dCdH='
+
dCdH_name
+
',V='
+
V_name
+
',W='
+
W_name
+
',b='
+
b_name
dCdb
.
name
=
'Conv3D_dCdb.dCdH='
+
dCdH_name
+
',V='
+
V_name
+
',W='
+
W_name
+
',b='
+
b_name
return
[
dCdV
,
dCdW
,
dCdb
,
dCdd
]
return
[
dCdV
,
dCdW
,
dCdb
,
dCdd
]
...
@@ -140,7 +140,7 @@ class Conv3D(theano.Op):
...
@@ -140,7 +140,7 @@ class Conv3D(theano.Op):
output_dur
=
T
.
floor
(
(
vidDur
-
filterDur
)
/
dt
)
+
1
output_dur
=
T
.
floor
(
(
vidDur
-
filterDur
)
/
dt
)
+
1
rval
=
(
batch_size
,
output_height
,
output_width
,
output_dur
,
output_channels
)
rval
=
(
batch_size
,
output_height
,
output_width
,
output_dur
,
output_channels
)
return
[
rval
]
return
[
rval
]
...
...
theano/tensor/nnet/ConvTransp3D.py
浏览文件 @
bc3bd4ee
...
@@ -73,7 +73,7 @@ class ConvTransp3D(theano.Op):
...
@@ -73,7 +73,7 @@ class ConvTransp3D(theano.Op):
else
:
else
:
b_name
=
'anon'
b_name
=
'anon'
dCdW
.
name
=
'ConvTransp3D_dCdW.H='
+
H_name
+
',dCdR='
+
dCdR_name
+
',W='
+
W_name
dCdW
.
name
=
'ConvTransp3D_dCdW.H='
+
H_name
+
',dCdR='
+
dCdR_name
+
',W='
+
W_name
dCdb
.
name
=
'ConvTransp3D_dCdb.H='
+
H_name
+
',dCdR='
+
dCdR_name
+
',W='
+
W_name
+
',b='
+
b_name
dCdb
.
name
=
'ConvTransp3D_dCdb.H='
+
H_name
+
',dCdR='
+
dCdR_name
+
',W='
+
W_name
+
',b='
+
b_name
dCdH
.
name
=
'ConvTransp3D_dCdH.H='
+
H_name
+
',dCdR='
+
dCdR_name
dCdH
.
name
=
'ConvTransp3D_dCdH.H='
+
H_name
+
',dCdR='
+
dCdR_name
...
...
theano/tensor/nnet/sigm.py
浏览文件 @
bc3bd4ee
...
@@ -25,7 +25,7 @@ class ScalarSigmoid(scalar.UnaryScalarOp):
...
@@ -25,7 +25,7 @@ class ScalarSigmoid(scalar.UnaryScalarOp):
if
x
<
-
30.0
:
if
x
<
-
30.0
:
return
0.0
return
0.0
if
x
>
30.0
:
if
x
>
30.0
:
return
1.0
return
1.0
return
1.0
/
(
1.0
+
numpy
.
exp
(
-
x
))
return
1.0
/
(
1.0
+
numpy
.
exp
(
-
x
))
def
impl
(
self
,
x
):
def
impl
(
self
,
x
):
return
ScalarSigmoid
.
st_impl
(
x
)
return
ScalarSigmoid
.
st_impl
(
x
)
...
@@ -125,7 +125,7 @@ def _is_1(expr):
...
@@ -125,7 +125,7 @@ def _is_1(expr):
return
False
return
False
log1msigm_to_softplus
=
gof
.
PatternSub
(
log1msigm_to_softplus
=
gof
.
PatternSub
(
(
tensor
.
log
,
(
tensor
.
log
,
(
tensor
.
sub
,
(
tensor
.
sub
,
dict
(
pattern
=
'y'
,
constraint
=
_is_1
),
dict
(
pattern
=
'y'
,
constraint
=
_is_1
),
(
sigmoid
,
'x'
))),
(
sigmoid
,
'x'
))),
...
@@ -134,7 +134,7 @@ log1msigm_to_softplus = gof.PatternSub(
...
@@ -134,7 +134,7 @@ log1msigm_to_softplus = gof.PatternSub(
skip_identities_fn
=
_skip_mul_1
)
skip_identities_fn
=
_skip_mul_1
)
log1pexp_to_softplus
=
gof
.
PatternSub
(
log1pexp_to_softplus
=
gof
.
PatternSub
(
(
tensor
.
log1p
,
(
tensor
.
log1p
,
(
tensor
.
exp
,
'x'
)),
(
tensor
.
exp
,
'x'
)),
(
softplus
,
'x'
),
(
softplus
,
'x'
),
allow_multiple_clients
=
True
)
allow_multiple_clients
=
True
)
...
@@ -289,7 +289,7 @@ def local_sigm_times_exp(node):
...
@@ -289,7 +289,7 @@ def local_sigm_times_exp(node):
rval
=
tensor
.
mul
(
*
terms
)
rval
=
tensor
.
mul
(
*
terms
)
else
:
else
:
rval
=
terms
[
0
]
rval
=
terms
[
0
]
if
neg
:
if
neg
:
return
[
-
rval
]
return
[
-
rval
]
else
:
else
:
...
@@ -336,13 +336,13 @@ def local_1msigmoid(node):
...
@@ -336,13 +336,13 @@ def local_1msigmoid(node):
return
[
sigmoid
(
-
sub_r
.
owner
.
inputs
[
0
])]
return
[
sigmoid
(
-
sub_r
.
owner
.
inputs
[
0
])]
register_local_1msigmoid
=
False
register_local_1msigmoid
=
False
# This is False because the Stabilize pattern above
# This is False because the Stabilize pattern above
# is looking for 1-sigm. Also Canonizer turns neg into *(-1) and so
# is looking for 1-sigm. Also Canonizer turns neg into *(-1) and so
# this optimization might set off an unwanted chain of things.
# this optimization might set off an unwanted chain of things.
# OTH - this transformation can be seen as pushing normal arithmetic either below or above the
# OTH - this transformation can be seen as pushing normal arithmetic either below or above the
# sigmoidal nonlinearity... so if the canonicalized form had anything to say about that then it
# sigmoidal nonlinearity... so if the canonicalized form had anything to say about that then it
# would be a consideration... anyway leaving False for now.
# would be a consideration... anyway leaving False for now.
if
register_local_1msigmoid
:
if
register_local_1msigmoid
:
opt
.
register_canonicalize
(
local_1msigmoid
)
opt
.
register_canonicalize
(
local_1msigmoid
)
...
...
theano/tensor/raw_random.py
浏览文件 @
bc3bd4ee
...
@@ -155,7 +155,7 @@ class RandomFunction(gof.Op):
...
@@ -155,7 +155,7 @@ class RandomFunction(gof.Op):
raise
TypeError
(
'r must be RandomStateType instance'
,
r
)
raise
TypeError
(
'r must be RandomStateType instance'
,
r
)
# the following doesn't work because we want to ignore the broadcastable flags in
# the following doesn't work because we want to ignore the broadcastable flags in
# shape.type
# shape.type
# assert shape.type == tensor.lvector
# assert shape.type == tensor.lvector
# convert args to TensorType instances
# convert args to TensorType instances
# and append enough None's to match the length of self.args
# and append enough None's to match the length of self.args
...
...
theano/tensor/signal/downsample.py
浏览文件 @
bc3bd4ee
""" Ops for downsampling images.
""" Ops for downsampling images.
Planned:
Planned:
DownsampleFactorMax, DownsampleAvg, DownsampleSoftmax.
DownsampleFactorMax, DownsampleAvg, DownsampleSoftmax.
"""
"""
...
@@ -21,7 +21,7 @@ def max_pool_2d(input, ds, ignore_border=False):
...
@@ -21,7 +21,7 @@ def max_pool_2d(input, ds, ignore_border=False):
the specified factor, by keeping only the maximum value of non-overlapping
the specified factor, by keeping only the maximum value of non-overlapping
patches of size (ds[0],ds[1])
patches of size (ds[0],ds[1])
:type input: N-D theano tensor of input images.
:type input: N-D theano tensor of input images.
:param input: input images. Max pooling will be done over the 2 last dimensions.
:param input: input images. Max pooling will be done over the 2 last dimensions.
:type ds: tuple of length 2
:type ds: tuple of length 2
:param ds: factor by which to downscale. (2,2) will halve the image in each dimension.
:param ds: factor by which to downscale. (2,2) will halve the image in each dimension.
...
@@ -39,7 +39,7 @@ def max_pool_2d(input, ds, ignore_border=False):
...
@@ -39,7 +39,7 @@ def max_pool_2d(input, ds, ignore_border=False):
batch_size
=
tensor
.
shape_padright
(
batch_size
,
1
)
batch_size
=
tensor
.
shape_padright
(
batch_size
,
1
)
# store as 4D tensor with shape: (batch_size,1,height,width)
# store as 4D tensor with shape: (batch_size,1,height,width)
new_shape
=
tensor
.
cast
(
tensor
.
join
(
0
,
batch_size
,
new_shape
=
tensor
.
cast
(
tensor
.
join
(
0
,
batch_size
,
tensor
.
as_tensor
([
1
,]),
img_shape
),
'int64'
)
tensor
.
as_tensor
([
1
,]),
img_shape
),
'int64'
)
input_4D
=
tensor
.
reshape
(
input
,
new_shape
,
ndim
=
4
)
input_4D
=
tensor
.
reshape
(
input
,
new_shape
,
ndim
=
4
)
...
@@ -54,7 +54,7 @@ def max_pool_2d(input, ds, ignore_border=False):
...
@@ -54,7 +54,7 @@ def max_pool_2d(input, ds, ignore_border=False):
class
DownsampleFactorMax
(
Op
):
class
DownsampleFactorMax
(
Op
):
"""
"""
For N-dimensional tensors, consider that the last two dimensions span images.
For N-dimensional tensors, consider that the last two dimensions span images.
This Op downsamples these images by a factor ds, by taking the max over non-
This Op downsamples these images by a factor ds, by taking the max over non-
overlapping rectangular regions.
overlapping rectangular regions.
"""
"""
...
@@ -77,7 +77,7 @@ class DownsampleFactorMax(Op):
...
@@ -77,7 +77,7 @@ class DownsampleFactorMax(Op):
:rtype: list
:rtype: list
:returns: the shape of the output from this op, for input of given shape. This will
:returns: the shape of the output from this op, for input of given shape. This will
have the same length as imgshape, but with last two elements reduced as per the
have the same length as imgshape, but with last two elements reduced as per the
downsampling & ignore_border flags.
downsampling & ignore_border flags.
"""
"""
if
len
(
imgshape
)
<
2
:
if
len
(
imgshape
)
<
2
:
raise
TypeError
(
'imgshape must have at least two elements (rows, cols)'
)
raise
TypeError
(
'imgshape must have at least two elements (rows, cols)'
)
...
@@ -162,7 +162,7 @@ class DownsampleFactorMax(Op):
...
@@ -162,7 +162,7 @@ class DownsampleFactorMax(Op):
int x_shp0_usable;
int x_shp0_usable;
int x_shp1_usable;
int x_shp1_usable;
int z_shp0, z_shp1;
int z_shp0, z_shp1;
if(
%(x)
s->nd!=4)
if(
%(x)
s->nd!=4)
{
{
PyErr_SetString(PyExc_ValueError, "x must be a 4d ndarray");
PyErr_SetString(PyExc_ValueError, "x must be a 4d ndarray");
%(fail)
s;
%(fail)
s;
...
@@ -289,17 +289,17 @@ class DownsampleFactorMaxGrad(Op):
...
@@ -289,17 +289,17 @@ class DownsampleFactorMaxGrad(Op):
PyErr_SetString(PyExc_ValueError, "input types must all match");
PyErr_SetString(PyExc_ValueError, "input types must all match");
%(fail)
s;
%(fail)
s;
}
}
if(
%(x)
s->nd!=4)
if(
%(x)
s->nd!=4)
{
{
PyErr_SetString(PyExc_ValueError, "x must be a 4d ndarray");
PyErr_SetString(PyExc_ValueError, "x must be a 4d ndarray");
%(fail)
s;
%(fail)
s;
}
}
if(
%(z)
s->nd!=4)
if(
%(z)
s->nd!=4)
{
{
PyErr_SetString(PyExc_ValueError, "z must be a 4d ndarray");
PyErr_SetString(PyExc_ValueError, "z must be a 4d ndarray");
%(fail)
s;
%(fail)
s;
}
}
if(
%(gz)
s->nd!=4)
if(
%(gz)
s->nd!=4)
{
{
PyErr_SetString(PyExc_ValueError, "gz must be a 4d ndarray");
PyErr_SetString(PyExc_ValueError, "gz must be a 4d ndarray");
%(fail)
s;
%(fail)
s;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论