Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
cd2272fe
提交
cd2272fe
authored
7月 20, 2015
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3145 from harlouci/props_tensor_nnet
Props tensor nnet
上级
c74da33d
102f212c
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
22 行增加
和
102 行删除
+22
-102
Conv3D.py
theano/tensor/nnet/Conv3D.py
+1
-8
ConvGrad3D.py
theano/tensor/nnet/ConvGrad3D.py
+1
-5
ConvTransp3D.py
theano/tensor/nnet/ConvTransp3D.py
+1
-5
conv3d2d.py
theano/tensor/nnet/conv3d2d.py
+4
-12
neighbours.py
theano/tensor/nnet/neighbours.py
+3
-6
nnet.py
theano/tensor/nnet/nnet.py
+12
-66
没有找到文件。
theano/tensor/nnet/Conv3D.py
浏览文件 @
cd2272fe
...
@@ -45,14 +45,7 @@ class Conv3D(theano.Op):
...
@@ -45,14 +45,7 @@ class Conv3D(theano.Op):
""" 3D `convolution` of multiple filters on a minibatch
""" 3D `convolution` of multiple filters on a minibatch
:note: does not flip the kernel, moves kernel with a user specified stride
:note: does not flip the kernel, moves kernel with a user specified stride
"""
"""
def
__eq__
(
self
,
other
):
__props__
=
()
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
hash
(
type
(
self
))
def
__str__
(
self
):
return
"Conv3D"
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
3
,
blas_header_version
())
return
(
3
,
blas_header_version
())
...
...
theano/tensor/nnet/ConvGrad3D.py
浏览文件 @
cd2272fe
...
@@ -12,11 +12,7 @@ from theano.gradient import DisconnectedType
...
@@ -12,11 +12,7 @@ from theano.gradient import DisconnectedType
class
ConvGrad3D
(
theano
.
Op
):
class
ConvGrad3D
(
theano
.
Op
):
""" Gradient of Conv3D with respect to W """
""" Gradient of Conv3D with respect to W """
def
__eq__
(
self
,
other
):
__props__
=
()
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
hash
(
type
(
self
))
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
1
,)
return
(
1
,)
...
...
theano/tensor/nnet/ConvTransp3D.py
浏览文件 @
cd2272fe
...
@@ -10,11 +10,7 @@ from theano.gradient import DisconnectedType
...
@@ -10,11 +10,7 @@ from theano.gradient import DisconnectedType
class
ConvTransp3D
(
theano
.
Op
):
class
ConvTransp3D
(
theano
.
Op
):
""" "Transpose" of Conv3D (Conv3D implements multiplication by an implicitly defined matrix W. This implements multiplication by its transpose) """
""" "Transpose" of Conv3D (Conv3D implements multiplication by an implicitly defined matrix W. This implements multiplication by its transpose) """
def
__eq__
(
self
,
other
):
__props__
=
()
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
hash
(
type
(
self
))
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
3
,)
return
(
3
,)
...
...
theano/tensor/nnet/conv3d2d.py
浏览文件 @
cd2272fe
...
@@ -73,6 +73,8 @@ class DiagonalSubtensor(Op):
...
@@ -73,6 +73,8 @@ class DiagonalSubtensor(Op):
see what's necessary at that point.
see what's necessary at that point.
"""
"""
__props__
=
(
"inplace"
,)
def
__str__
(
self
):
def
__str__
(
self
):
if
self
.
inplace
:
if
self
.
inplace
:
return
"
%
s{inplace}"
%
self
.
__class__
.
__name__
return
"
%
s{inplace}"
%
self
.
__class__
.
__name__
...
@@ -83,12 +85,6 @@ class DiagonalSubtensor(Op):
...
@@ -83,12 +85,6 @@ class DiagonalSubtensor(Op):
if
inplace
:
if
inplace
:
self
.
view_map
=
{
0
:
[
0
]}
self
.
view_map
=
{
0
:
[
0
]}
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
and
self
.
inplace
==
other
.
inplace
def
__hash__
(
self
):
return
hash
((
type
(
self
),
self
.
inplace
))
def
make_node
(
self
,
x
,
i0
,
i1
):
def
make_node
(
self
,
x
,
i0
,
i1
):
_i0
=
tensor
.
as_tensor_variable
(
i0
)
_i0
=
tensor
.
as_tensor_variable
(
i0
)
_i1
=
tensor
.
as_tensor_variable
(
i1
)
_i1
=
tensor
.
as_tensor_variable
(
i1
)
...
@@ -117,6 +113,8 @@ class IncDiagonalSubtensor(Op):
...
@@ -117,6 +113,8 @@ class IncDiagonalSubtensor(Op):
"""
"""
The gradient of DiagonalSubtensor
The gradient of DiagonalSubtensor
"""
"""
__props__
=
(
"inplace"
,)
def
__str__
(
self
):
def
__str__
(
self
):
if
self
.
inplace
:
if
self
.
inplace
:
return
"
%
s{inplace}"
%
self
.
__class__
.
__name__
return
"
%
s{inplace}"
%
self
.
__class__
.
__name__
...
@@ -127,12 +125,6 @@ class IncDiagonalSubtensor(Op):
...
@@ -127,12 +125,6 @@ class IncDiagonalSubtensor(Op):
if
inplace
:
if
inplace
:
self
.
destroy_map
=
{
0
:
[
0
]}
self
.
destroy_map
=
{
0
:
[
0
]}
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
and
self
.
inplace
==
other
.
inplace
def
__hash__
(
self
):
return
hash
((
type
(
self
),
self
.
inplace
))
def
make_node
(
self
,
x
,
i0
,
i1
,
amt
):
def
make_node
(
self
,
x
,
i0
,
i1
,
amt
):
_i0
=
tensor
.
as_tensor_variable
(
i0
)
_i0
=
tensor
.
as_tensor_variable
(
i0
)
_i1
=
tensor
.
as_tensor_variable
(
i1
)
_i1
=
tensor
.
as_tensor_variable
(
i1
)
...
...
theano/tensor/nnet/neighbours.py
浏览文件 @
cd2272fe
...
@@ -13,6 +13,9 @@ import numpy
...
@@ -13,6 +13,9 @@ import numpy
class
Images2Neibs
(
Op
):
class
Images2Neibs
(
Op
):
__props__
=
(
"mode"
,)
def
__init__
(
self
,
mode
=
'valid'
):
def
__init__
(
self
,
mode
=
'valid'
):
"""
"""
:type mode: str
:type mode: str
...
@@ -33,12 +36,6 @@ class Images2Neibs(Op):
...
@@ -33,12 +36,6 @@ class Images2Neibs(Op):
" implemented for the op Images2Neibs"
)
" implemented for the op Images2Neibs"
)
self
.
mode
=
mode
self
.
mode
=
mode
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
and
self
.
mode
==
other
.
mode
def
__hash__
(
self
):
return
hash
(
type
(
self
))
^
hash
(
self
.
mode
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
__class__
.
__name__
+
"{
%
s}"
%
self
.
mode
return
self
.
__class__
.
__name__
+
"{
%
s}"
%
self
.
mode
...
...
theano/tensor/nnet/nnet.py
浏览文件 @
cd2272fe
...
@@ -44,21 +44,9 @@ class SoftmaxWithBias(gof.Op):
...
@@ -44,21 +44,9 @@ class SoftmaxWithBias(gof.Op):
This L{Op}'s output is softmax(x+b).
This L{Op}'s output is softmax(x+b).
softmax(x[i]) is the i'th distribution over len(x[i]) options.
softmax(x[i]) is the i'th distribution over len(x[i]) options.
"""
"""
nin
=
2
nin
=
2
nout
=
1
nout
=
1
__props__
=
()
def
__init__
(
self
,
**
kwargs
):
gof
.
Op
.
__init__
(
self
,
**
kwargs
)
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
tensor
.
hashtype
(
self
)
def
__str__
(
self
):
return
self
.
__class__
.
__name__
def
make_node
(
self
,
x
,
b
):
def
make_node
(
self
,
x
,
b
):
x
=
tensor
.
as_tensor_variable
(
x
)
x
=
tensor
.
as_tensor_variable
(
x
)
...
@@ -284,7 +272,6 @@ class SoftmaxGrad(gof.Op):
...
@@ -284,7 +272,6 @@ class SoftmaxGrad(gof.Op):
"""Gradient wrt x of the Softmax Op"""
"""Gradient wrt x of the Softmax Op"""
nin
=
2
nin
=
2
nout
=
1
nout
=
1
__props__
=
()
__props__
=
()
def
make_node
(
self
,
dy
,
sm
):
def
make_node
(
self
,
dy
,
sm
):
...
@@ -828,19 +815,11 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
...
@@ -828,19 +815,11 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
"""
"""
nin
=
3
nin
=
3
nout
=
3
nout
=
3
__props__
=
()
def
__init__
(
self
,
**
kwargs
):
def
__init__
(
self
,
**
kwargs
):
gof
.
Op
.
__init__
(
self
,
**
kwargs
)
gof
.
Op
.
__init__
(
self
,
**
kwargs
)
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
tensor
.
hashtype
(
self
)
def
__str__
(
self
):
return
self
.
__class__
.
__name__
def
make_node
(
self
,
x
,
b
,
y_idx
):
def
make_node
(
self
,
x
,
b
,
y_idx
):
x
=
tensor
.
as_tensor_variable
(
x
)
x
=
tensor
.
as_tensor_variable
(
x
)
b
=
tensor
.
as_tensor_variable
(
b
)
b
=
tensor
.
as_tensor_variable
(
b
)
...
@@ -1058,18 +1037,9 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
...
@@ -1058,18 +1037,9 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
class
CrossentropySoftmax1HotWithBiasDx
(
gof
.
Op
):
class
CrossentropySoftmax1HotWithBiasDx
(
gof
.
Op
):
nin
=
3
nin
=
3
nout
=
1
nout
=
1
__props__
=
()
"""Gradient wrt x of the CrossentropySoftmaxArgmax1HotWithBias Op"""
"""Gradient wrt x of the CrossentropySoftmaxArgmax1HotWithBias Op"""
def
__init__
(
self
,
**
kwargs
):
gof
.
Op
.
__init__
(
self
,
**
kwargs
)
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
tensor
.
hashtype
(
self
)
def
__str__
(
self
):
return
self
.
__class__
.
__name__
def
make_node
(
self
,
dy
,
sm
,
y_idx
,
**
kwargs
):
def
make_node
(
self
,
dy
,
sm
,
y_idx
,
**
kwargs
):
dy
=
tensor
.
as_tensor_variable
(
dy
)
dy
=
tensor
.
as_tensor_variable
(
dy
)
...
@@ -1269,15 +1239,8 @@ def crossentropy_softmax_max_and_argmax_1hot(x, y_idx, **kwargs):
...
@@ -1269,15 +1239,8 @@ def crossentropy_softmax_max_and_argmax_1hot(x, y_idx, **kwargs):
class
CrossentropyCategorical1HotGrad
(
gof
.
Op
):
class
CrossentropyCategorical1HotGrad
(
gof
.
Op
):
def
__eq__
(
self
,
other
):
__props__
=
()
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
tensor
.
hashtype
(
self
)
def
__str__
(
self
):
return
self
.
__class__
.
__name__
def
make_node
(
self
,
g_y
,
coding_dist
,
true_one_of_n
):
def
make_node
(
self
,
g_y
,
coding_dist
,
true_one_of_n
):
return
Apply
(
self
,
[
g_y
,
coding_dist
,
true_one_of_n
],
return
Apply
(
self
,
[
g_y
,
coding_dist
,
true_one_of_n
],
...
@@ -1313,15 +1276,7 @@ class CrossentropyCategorical1Hot(gof.Op):
...
@@ -1313,15 +1276,7 @@ class CrossentropyCategorical1Hot(gof.Op):
away in favour of one with a C implementation.
away in favour of one with a C implementation.
"""
"""
__props__
=
()
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
tensor
.
hashtype
(
self
)
def
__str__
(
self
):
return
self
.
__class__
.
__name__
def
make_node
(
self
,
coding_dist
,
true_one_of_n
):
def
make_node
(
self
,
coding_dist
,
true_one_of_n
):
"""
"""
...
@@ -1950,17 +1905,14 @@ from theano import scalar
...
@@ -1950,17 +1905,14 @@ from theano import scalar
class
Prepend_scalar_constant_to_each_row
(
gof
.
Op
):
class
Prepend_scalar_constant_to_each_row
(
gof
.
Op
):
__props__
=
()
def
__init__
(
self
,
val
=
0
):
def
__init__
(
self
,
val
=
0
):
if
isinstance
(
val
,
float
):
if
isinstance
(
val
,
float
):
val
=
scalar
.
constant
(
val
)
val
=
scalar
.
constant
(
val
)
self
.
val
=
val
self
.
val
=
val
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
))
and
(
self
.
val
==
other
.
val
)
def
__hash__
(
self
):
return
tensor
.
hashtype
(
self
)
^
hash
(
self
.
val
.
data
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'
%
s{
%
s}'
%
(
self
.
__class__
.
__name__
,
self
.
val
)
return
'
%
s{
%
s}'
%
(
self
.
__class__
.
__name__
,
self
.
val
)
...
@@ -2007,14 +1959,8 @@ class Prepend_scalar_constant_to_each_row(gof.Op):
...
@@ -2007,14 +1959,8 @@ class Prepend_scalar_constant_to_each_row(gof.Op):
class
Prepend_scalar_to_each_row
(
gof
.
Op
):
class
Prepend_scalar_to_each_row
(
gof
.
Op
):
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
))
def
__hash__
(
self
):
return
tensor
.
hashtype
(
self
)
def
__str__
(
self
):
__props__
=
()
return
self
.
__class__
.
__name__
def
make_node
(
self
,
val
,
mat
):
def
make_node
(
self
,
val
,
mat
):
# check type of input
# check type of input
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论