Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ef4041d7
提交
ef4041d7
authored
8月 11, 2011
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
auto white space fix.
上级
3144103b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
11 行增加
和
13 行删除
+11
-13
symbolic_module.py
theano/sandbox/symbolic_module.py
+10
-11
blas.py
theano/tensor/blas.py
+0
-1
opt.py
theano/tensor/opt.py
+1
-1
没有找到文件。
theano/sandbox/symbolic_module.py
浏览文件 @
ef4041d7
...
@@ -40,14 +40,14 @@ class InitGraph(type):
...
@@ -40,14 +40,14 @@ class InitGraph(type):
class
SymbolicModule
(
object
):
class
SymbolicModule
(
object
):
#installs class attributes from build_graph after declaration
#installs class attributes from build_graph after declaration
__metaclass__
=
InitGraph
__metaclass__
=
InitGraph
#if we call this function, it will return a new SymbolicModule
#if we call this function, it will return a new SymbolicModule
def
__new__
(
self
,
**
kwargs
):
def
__new__
(
self
,
**
kwargs
):
class
SymMod
(
SymbolicModule
):
class
SymMod
(
SymbolicModule
):
@staticmethod
@staticmethod
def
build_graph
(
*
bg_args
,
**
bg_kwargs
):
def
build_graph
(
*
bg_args
,
**
bg_kwargs
):
#this one is like self.build_graph,
#this one is like self.build_graph,
#except that the kwargs are automatically inserted
#except that the kwargs are automatically inserted
kwcopy
=
copy
.
copy
(
kwargs
)
kwcopy
=
copy
.
copy
(
kwargs
)
kwcopy
.
update
(
bg_kwargs
)
kwcopy
.
update
(
bg_kwargs
)
...
@@ -55,7 +55,7 @@ class SymbolicModule(object):
...
@@ -55,7 +55,7 @@ class SymbolicModule(object):
setattr
(
SymMod
,
'__name__'
,
self
.
__name__
+
'_derived'
)
setattr
(
SymMod
,
'__name__'
,
self
.
__name__
+
'_derived'
)
return
SymMod
return
SymMod
@staticmethod
@staticmethod
def
build_graph
():
def
build_graph
():
return
{}
return
{}
def
issymbolicmodule
(
thing
):
def
issymbolicmodule
(
thing
):
...
@@ -87,7 +87,7 @@ def compile_fn(f, path_locals, common_inputs):
...
@@ -87,7 +87,7 @@ def compile_fn(f, path_locals, common_inputs):
#make new inputs for the vars named in args
#make new inputs for the vars named in args
# this has the effect of creating new storage for these arguments
# this has the effect of creating new storage for these arguments
# The common storage doesn't get messed with.
# The common storage doesn't get messed with.
inputs
=
[
In
(
path_locals
.
get
(
name
,
name
))
for
name
in
args
]
inputs
=
[
In
(
path_locals
.
get
(
name
,
name
))
for
name
in
args
]
inputs
.
extend
([
v
for
k
,
v
in
common_inputs
.
items
()
if
k
not
in
args
])
inputs
.
extend
([
v
for
k
,
v
in
common_inputs
.
items
()
if
k
not
in
args
])
outputs
=
f
()
outputs
=
f
()
#print 'inputs', inputs
#print 'inputs', inputs
...
@@ -136,7 +136,7 @@ def compile(smod, initial_values={}):
...
@@ -136,7 +136,7 @@ def compile(smod, initial_values={}):
inputs
=
{}
inputs
=
{}
for
path_locals
,
val
in
walker
(
smod
):
for
path_locals
,
val
in
walker
(
smod
):
if
isinstance
(
val
,
theano
.
Variable
)
and
(
val
.
owner
is
None
)
and
(
val
not
in
inputs
):
if
isinstance
(
val
,
theano
.
Variable
)
and
(
val
.
owner
is
None
)
and
(
val
not
in
inputs
):
inputs
[
val
]
=
theano
.
In
(
val
,
value
=
theano
.
gof
.
Container
(
val
,
[
'a'
]))
inputs
[
val
]
=
theano
.
In
(
val
,
value
=
theano
.
gof
.
Container
(
val
,
[
'a'
]))
assert
len
(
inputs
)
==
len
([
v
for
v
in
inputs
.
items
()])
assert
len
(
inputs
)
==
len
([
v
for
v
in
inputs
.
items
()])
...
@@ -188,7 +188,7 @@ def compile(smod, initial_values={}):
...
@@ -188,7 +188,7 @@ def compile(smod, initial_values={}):
else
:
else
:
# check for weird objects that we would like to disallow
# check for weird objects that we would like to disallow
# not all objects can be transfered by the clone mechanism below
# not all objects can be transfered by the clone mechanism below
raise
TypeError
(
'reflecting not supported for'
,
raise
TypeError
(
'reflecting not supported for'
,
(
thing
,
type
(
thing
),
getattr
(
thing
,
'__name__'
,
None
)))
(
thing
,
type
(
thing
),
getattr
(
thing
,
'__name__'
,
None
)))
return
reflected
[
thing
]
return
reflected
[
thing
]
rval
=
reflect
(
smod
)
rval
=
reflect
(
smod
)
...
@@ -320,7 +320,7 @@ if 0:
...
@@ -320,7 +320,7 @@ if 0:
else
:
else
:
def
params
():
return
[
w
,
b
]
def
params
():
return
[
w
,
b
]
return
just_symbolic
(
locals
())
return
just_symbolic
(
locals
())
if
0
:
if
0
:
print
'logistic_regression'
,
logistic_regression
print
'logistic_regression'
,
logistic_regression
print
'tanh_layer'
,
tanh_layer
print
'tanh_layer'
,
tanh_layer
...
@@ -349,7 +349,7 @@ if 0:
...
@@ -349,7 +349,7 @@ if 0:
name
=
symbolic_module
.
name
if
name
is
None
else
name
name
=
symbolic_module
.
name
if
name
is
None
else
name
def
__init__
(
self
,
constructor_fn
=
None
):
def
__init__
(
self
,
constructor_fn
=
None
):
""" A constructor fn builds
""" A constructor fn builds
- a graph on top of the variable table, and
- a graph on top of the variable table, and
- compilable methods.
- compilable methods.
"""
"""
...
@@ -387,7 +387,7 @@ if 0:
...
@@ -387,7 +387,7 @@ if 0:
return
locals
()
return
locals
()
#at this point there is a neural_net module all built and compiled,
#at this point there is a neural_net module all built and compiled,
# there is also a neural_net.symbolic_module which can be imported.
# there is also a neural_net.symbolic_module which can be imported.
@SymbolicModule_fromFn
@SymbolicModule_fromFn
...
@@ -404,7 +404,7 @@ if 0:
...
@@ -404,7 +404,7 @@ if 0:
transform
=
d
[:
npc
,:]
.
T
/
v
[:
npc
]
transform
=
d
[:
npc
,:]
.
T
/
v
[:
npc
]
return
locals
()
return
locals
()
#at this point there is a neural_net module all built and compiled,
#at this point there is a neural_net module all built and compiled,
# there is also a neural_net.symbolic_module which can be imported.
# there is also a neural_net.symbolic_module which can be imported.
...
@@ -431,4 +431,3 @@ if 0:
...
@@ -431,4 +431,3 @@ if 0:
"""stats_collector(nnet_on_pca.x, 'mean')
"""stats_collector(nnet_on_pca.x, 'mean')
"""
"""
return
mean_collector
(
x
=
r
)
return
mean_collector
(
x
=
r
)
theano/tensor/blas.py
浏览文件 @
ef4041d7
...
@@ -1608,4 +1608,3 @@ from opt import register_specialize, register_canonicalize
...
@@ -1608,4 +1608,3 @@ from opt import register_specialize, register_canonicalize
def
local_print_as_we_go_along
(
node
):
def
local_print_as_we_go_along
(
node
):
if
node
.
op
in
(
T
.
sub
,
T
.
add
):
if
node
.
op
in
(
T
.
sub
,
T
.
add
):
debugprint
(
node
)
debugprint
(
node
)
theano/tensor/opt.py
浏览文件 @
ef4041d7
...
@@ -1291,7 +1291,7 @@ def local_useless_subtensor(node):
...
@@ -1291,7 +1291,7 @@ def local_useless_subtensor(node):
# tracker keep. Subtensor accept any scalar int{8,16,32,64}
# tracker keep. Subtensor accept any scalar int{8,16,32,64}
# as index type.
# as index type.
assert
str
(
length_pos
.
type
.
dtype
)
==
"int64"
assert
str
(
length_pos
.
type
.
dtype
)
==
"int64"
assert
str
(
length_pos_shape_i
.
type
.
dtype
)
in
[
"int8"
,
"int16"
,
assert
str
(
length_pos_shape_i
.
type
.
dtype
)
in
[
"int8"
,
"int16"
,
"int32"
,
"int64"
]
"int32"
,
"int64"
]
# We already know that start and step are not variables
# We already know that start and step are not variables
# and so they don't appear in the input of the node
# and so they don't appear in the input of the node
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论