Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6b3003fe
提交
6b3003fe
authored
10月 18, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make imports from theano.gof.utils explicit
上级
70a12a17
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
8 行删除
+15
-8
graph.py
theano/gof/graph.py
+15
-8
没有找到文件。
theano/gof/graph.py
浏览文件 @
6b3003fe
...
@@ -13,8 +13,15 @@ from itertools import count
...
@@ -13,8 +13,15 @@ from itertools import count
from
six
import
string_types
,
integer_types
from
six
import
string_types
,
integer_types
from
theano
import
config
from
theano
import
config
from
theano.gof
import
utils
from
theano.gof.utils
import
(
from
theano.gof.utils
import
TestValueError
TestValueError
,
object2
,
MethodNotDefined
,
Scratchpad
,
ValidatingScratchpad
,
get_variable_trace_string
,
add_tag_trace
,
)
from
theano.misc.ordered_set
import
OrderedSet
from
theano.misc.ordered_set
import
OrderedSet
__docformat__
=
"restructuredtext en"
__docformat__
=
"restructuredtext en"
...
@@ -22,7 +29,7 @@ __docformat__ = "restructuredtext en"
...
@@ -22,7 +29,7 @@ __docformat__ = "restructuredtext en"
NoParams
=
object
()
NoParams
=
object
()
class
Node
(
utils
.
object2
):
class
Node
(
object2
):
"""A `Node` in a Theano graph.
"""A `Node` in a Theano graph.
Currently, graphs contain two kinds of `Nodes`: `Variable`s and `Apply`s.
Currently, graphs contain two kinds of `Nodes`: `Variable`s and `Apply`s.
...
@@ -90,7 +97,7 @@ class Apply(Node):
...
@@ -90,7 +97,7 @@ class Apply(Node):
def
__init__
(
self
,
op
,
inputs
,
outputs
):
def
__init__
(
self
,
op
,
inputs
,
outputs
):
self
.
op
=
op
self
.
op
=
op
self
.
inputs
=
[]
self
.
inputs
=
[]
self
.
tag
=
utils
.
Scratchpad
()
self
.
tag
=
Scratchpad
()
if
not
isinstance
(
inputs
,
(
list
,
tuple
)):
if
not
isinstance
(
inputs
,
(
list
,
tuple
)):
raise
TypeError
(
"The inputs of an Apply must be a list or tuple"
)
raise
TypeError
(
"The inputs of an Apply must be a list or tuple"
)
...
@@ -132,7 +139,7 @@ class Apply(Node):
...
@@ -132,7 +139,7 @@ class Apply(Node):
"""
"""
try
:
try
:
return
self
.
op
.
get_params
(
self
)
return
self
.
op
.
get_params
(
self
)
except
theano
.
gof
.
utils
.
MethodNotDefined
:
except
MethodNotDefined
:
return
NoParams
return
NoParams
def
__getstate__
(
self
):
def
__getstate__
(
self
):
...
@@ -381,7 +388,7 @@ class Variable(Node):
...
@@ -381,7 +388,7 @@ class Variable(Node):
def
__init__
(
self
,
type
,
owner
=
None
,
index
=
None
,
name
=
None
):
def
__init__
(
self
,
type
,
owner
=
None
,
index
=
None
,
name
=
None
):
super
()
.
__init__
()
super
()
.
__init__
()
self
.
tag
=
utils
.
ValidatingScratchpad
(
"test_value"
,
type
.
filter
)
self
.
tag
=
ValidatingScratchpad
(
"test_value"
,
type
.
filter
)
self
.
type
=
type
self
.
type
=
type
...
@@ -410,7 +417,7 @@ class Variable(Node):
...
@@ -410,7 +417,7 @@ class Variable(Node):
"""
"""
if
not
hasattr
(
self
.
tag
,
"test_value"
):
if
not
hasattr
(
self
.
tag
,
"test_value"
):
detailed_err_msg
=
utils
.
get_variable_trace_string
(
self
)
detailed_err_msg
=
get_variable_trace_string
(
self
)
raise
TestValueError
(
raise
TestValueError
(
"{} has no test value {}"
.
format
(
self
,
detailed_err_msg
)
"{} has no test value {}"
.
format
(
self
,
detailed_err_msg
)
)
)
...
@@ -602,7 +609,7 @@ class Constant(Variable):
...
@@ -602,7 +609,7 @@ class Constant(Variable):
def
__init__
(
self
,
type
,
data
,
name
=
None
):
def
__init__
(
self
,
type
,
data
,
name
=
None
):
super
()
.
__init__
(
type
,
None
,
None
,
name
)
super
()
.
__init__
(
type
,
None
,
None
,
name
)
self
.
data
=
type
.
filter
(
data
)
self
.
data
=
type
.
filter
(
data
)
utils
.
add_tag_trace
(
self
)
add_tag_trace
(
self
)
def
get_test_value
(
self
):
def
get_test_value
(
self
):
return
self
.
data
return
self
.
data
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论