Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7e4270ce
提交
7e4270ce
authored
5月 28, 2012
作者:
David Warde-Farley
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #664 from delallea/win_py24
Fixes for Python 2.4
上级
7fe951d9
40fac887
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
40 行增加
和
13 行删除
+40
-13
debug.py
theano/sandbox/debug.py
+7
-1
symbolic_module.py
theano/sandbox/symbolic_module.py
+33
-12
没有找到文件。
theano/sandbox/debug.py
浏览文件 @
7e4270ce
...
...
@@ -155,7 +155,13 @@ def print_from(i, node, *thunks):
print
"parents:"
,
", "
.
join
(
str
(
input
.
step
)
for
input
in
node
.
inputs
)
def
print_input_shapes
(
i
,
node
,
*
thunks
):
print
"input shapes:"
,
", "
.
join
(
str
(
input
.
value
.
shape
)
if
hasattr
(
input
.
value
,
'shape'
)
else
'N/A'
for
input
in
node
.
inputs
)
shapes
=
[]
for
input
in
node
.
inputs
:
if
hasattr
(
input
.
value
,
'shape'
):
shapes
.
append
(
str
(
input
.
value
.
shape
))
else
:
shapes
.
append
(
'N/A'
)
print
"input shapes:"
,
", "
.
join
(
shapes
)
def
print_input_types
(
i
,
node
,
*
thunks
):
print
"input types:"
,
", "
.
join
(
str
(
type
(
input
.
value
))
for
input
in
node
.
inputs
)
...
...
theano/sandbox/symbolic_module.py
浏览文件 @
7e4270ce
...
...
@@ -199,12 +199,22 @@ def compile(smod, initial_values=None):
return
rval
@symbolic_module
def
LR
(
x
=
None
,
y
=
None
,
v
=
None
,
c
=
None
,
l2_coef
=
None
):
x
=
x
if
x
else
T
.
dmatrix
()
#our points, one point per row
y
=
y
if
y
else
T
.
dmatrix
()
#targets , one per row
v
=
v
if
v
else
T
.
dmatrix
()
#first layer weights
c
=
c
if
c
else
T
.
dvector
()
#first layer weights
l2_coef
=
l2_coef
if
l2_coef
else
T
.
dscalar
()
def
LR
(
x
=
None
,
y
=
None
,
v
=
None
,
c
=
None
,
l2_coef
=
None
):
# our points, one point per row
if
x
is
None
:
x
=
T
.
dmatrix
()
# targets , one per row
if
y
is
None
:
y
=
T
.
dmatrix
()
# first layer weights
if
v
is
None
:
v
=
T
.
dmatrix
()
# first layer biases
if
c
is
None
:
c
=
T
.
dvector
()
if
l2_coef
is
None
:
l2_coef
=
T
.
dscalar
()
pred
=
T
.
dot
(
x
,
v
)
+
c
sse
=
T
.
sum
((
pred
-
y
)
*
(
pred
-
y
))
...
...
@@ -220,9 +230,15 @@ def LR(x=None, y=None, v=None, c=None, l2_coef = None):
@symbolic_module
def
Layer
(
x
=
None
,
w
=
None
,
b
=
None
):
x
=
x
if
x
else
T
.
dmatrix
()
#our points, one point per row
w
=
w
if
w
else
T
.
dmatrix
()
#first layer weights
b
=
b
if
b
else
T
.
dvector
()
#first layer bias
# our points, one point per row
if
x
is
None
:
x
=
T
.
dmatrix
()
# first layer weights
if
w
is
None
:
w
=
T
.
dmatrix
()
# first layer bias
if
b
is
None
:
b
=
T
.
dvector
()
y
=
T
.
tanh
(
T
.
dot
(
x
,
w
)
+
b
)
@symbolicmethod
def
params
():
return
[
w
,
b
]
...
...
@@ -230,8 +246,12 @@ def Layer(x=None, w=None, b=None):
@symbolic_module
def
NNet
(
x
=
None
,
y
=
None
,
n_hid_layers
=
2
):
x
=
x
if
x
else
T
.
dmatrix
()
#our points, one point per row
y
=
y
if
y
else
T
.
dmatrix
()
#targets , one per row
# our points, one point per row
if
x
is
None
:
x
=
T
.
dmatrix
()
# targets , one per row
if
y
is
None
:
y
=
T
.
dmatrix
()
layers
=
[]
_x
=
x
for
i
in
xrange
(
n_hid_layers
):
...
...
@@ -348,7 +368,8 @@ if 0:
def
include
(
self
,
symbolic_module
,
name
=
None
):
"""This redefines the symbols in the kwargs
"""
name
=
symbolic_module
.
name
if
name
is
None
else
name
if
name
is
None
:
name
=
symbolic_module
.
name
def
__init__
(
self
,
constructor_fn
=
None
):
""" A constructor fn builds
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论