Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3b819206
提交
3b819206
authored
10月 17, 2016
作者:
sentient07
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reverted changes with Scalars, added Props to few more place, fixed travis
上级
58100e17
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
17 行增加
和
19 行删除
+17
-19
builders.py
theano/compile/builders.py
+1
-0
op.py
theano/gof/op.py
+0
-1
minimal.py
theano/sandbox/minimal.py
+2
-6
solve.py
theano/sandbox/solve.py
+1
-5
basic.py
theano/scalar/basic.py
+13
-7
没有找到文件。
theano/compile/builders.py
浏览文件 @
3b819206
...
@@ -71,6 +71,7 @@ class OpFromGraph(gof.Op):
...
@@ -71,6 +71,7 @@ class OpFromGraph(gof.Op):
fn = function([x, y, z], [e2])
fn = function([x, y, z], [e2])
"""
"""
def
__init__
(
self
,
inputs
,
outputs
,
**
kwargs
):
def
__init__
(
self
,
inputs
,
outputs
,
**
kwargs
):
if
not
isinstance
(
outputs
,
list
):
if
not
isinstance
(
outputs
,
list
):
raise
TypeError
(
'outputs must be list'
,
outputs
)
raise
TypeError
(
'outputs must be list'
,
outputs
)
...
...
theano/gof/op.py
浏览文件 @
3b819206
...
@@ -781,7 +781,6 @@ class Op(utils.object2, PureOp, CLinkerOp):
...
@@ -781,7 +781,6 @@ class Op(utils.object2, PureOp, CLinkerOp):
Convenience class to bundle `PureOp` and `CLinkerOp`.
Convenience class to bundle `PureOp` and `CLinkerOp`.
"""
"""
def
prepare_node
(
self
,
node
,
storage_map
,
compute_map
,
impl
):
def
prepare_node
(
self
,
node
,
storage_map
,
compute_map
,
impl
):
"""
"""
Make any special modifications that the Op needs before doing
Make any special modifications that the Op needs before doing
...
...
theano/sandbox/minimal.py
浏览文件 @
3b819206
...
@@ -15,6 +15,8 @@ class Minimal(gof.Op):
...
@@ -15,6 +15,8 @@ class Minimal(gof.Op):
# If two Apply nodes have the same inputs and the ops compare equal...
# If two Apply nodes have the same inputs and the ops compare equal...
# then they will be MERGED so they had better have computed the same thing!
# then they will be MERGED so they had better have computed the same thing!
__props__
=
()
def
__init__
(
self
):
def
__init__
(
self
):
# If you put things here, think about whether they change the outputs
# If you put things here, think about whether they change the outputs
# computed by # self.perform()
# computed by # self.perform()
...
@@ -25,12 +27,6 @@ class Minimal(gof.Op):
...
@@ -25,12 +27,6 @@ class Minimal(gof.Op):
super
(
Minimal
,
self
)
.
__init__
()
super
(
Minimal
,
self
)
.
__init__
()
def
__eq__
(
self
,
other
):
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
hash
(
type
(
self
))
def
make_node
(
self
,
*
args
):
def
make_node
(
self
,
*
args
):
# HERE `args` must be THEANO VARIABLES
# HERE `args` must be THEANO VARIABLES
return
gof
.
Apply
(
op
=
self
,
inputs
=
args
,
outputs
=
[
tensor
.
lscalar
()])
return
gof
.
Apply
(
op
=
self
,
inputs
=
args
,
outputs
=
[
tensor
.
lscalar
()])
...
...
theano/sandbox/solve.py
浏览文件 @
3b819206
...
@@ -27,11 +27,7 @@ class Solve(gof.Op):
...
@@ -27,11 +27,7 @@ class Solve(gof.Op):
# and keeps a memory workspace from call to call as a non-default Op
# and keeps a memory workspace from call to call as a non-default Op
# output
# output
def
__eq__
(
self
,
other
):
__props__
=
()
return
type
(
self
)
==
type
(
other
)
def
__hash__
(
self
):
return
hash
(
type
(
self
))
def
make_node
(
self
,
A
,
b
):
def
make_node
(
self
,
A
,
b
):
A_
=
tensor
.
as_tensor_variable
(
A
)
A_
=
tensor
.
as_tensor_variable
(
A
)
...
...
theano/scalar/basic.py
浏览文件 @
3b819206
...
@@ -852,7 +852,6 @@ class ScalarOp(Op):
...
@@ -852,7 +852,6 @@ class ScalarOp(Op):
nin
=
-
1
nin
=
-
1
nout
=
1
nout
=
1
__props__
=
(
"output_types_preference"
,
"name"
)
def
__init__
(
self
,
output_types_preference
=
None
,
name
=
None
):
def
__init__
(
self
,
output_types_preference
=
None
,
name
=
None
):
self
.
name
=
name
self
.
name
=
name
...
@@ -861,7 +860,7 @@ class ScalarOp(Op):
...
@@ -861,7 +860,7 @@ class ScalarOp(Op):
raise
TypeError
(
raise
TypeError
(
"Expected a callable for the 'output_types_preference' argument to
%
s. (got:
%
s)"
%
"Expected a callable for the 'output_types_preference' argument to
%
s. (got:
%
s)"
%
(
self
.
__class__
,
output_types_preference
))
(
self
.
__class__
,
output_types_preference
))
self
.
output_types_preference
=
output_types_preference
self
.
output_types_preference
=
output_types_preference
def
make_node
(
self
,
*
inputs
):
def
make_node
(
self
,
*
inputs
):
if
self
.
nin
>=
0
:
if
self
.
nin
>=
0
:
...
@@ -908,6 +907,16 @@ class ScalarOp(Op):
...
@@ -908,6 +907,16 @@ class ScalarOp(Op):
raise
utils
.
MethodNotDefined
(
"grad"
,
type
(
self
),
raise
utils
.
MethodNotDefined
(
"grad"
,
type
(
self
),
self
.
__class__
.
__name__
)
self
.
__class__
.
__name__
)
def
__eq__
(
self
,
other
):
test
=
(
type
(
self
)
==
type
(
other
)
and
getattr
(
self
,
'output_types_preference'
,
None
)
==
getattr
(
other
,
'output_types_preference'
,
None
))
return
test
def
__hash__
(
self
):
return
hash
(
type
(
self
)
.
__name__
)
^
hash
(
getattr
(
self
,
'output_types_preference'
,
0
))
def
__str__
(
self
):
def
__str__
(
self
):
if
hasattr
(
self
,
'name'
)
and
self
.
name
:
if
hasattr
(
self
,
'name'
)
and
self
.
name
:
return
self
.
name
return
self
.
name
...
@@ -1174,7 +1183,6 @@ isinf = IsInf()
...
@@ -1174,7 +1183,6 @@ isinf = IsInf()
class
InRange
(
LogicalComparison
):
class
InRange
(
LogicalComparison
):
nin
=
3
nin
=
3
__props__
=
(
"openlow"
,
"openhi"
)
def
__init__
(
self
,
openlow
,
openhi
):
def
__init__
(
self
,
openlow
,
openhi
):
self
.
openlow
=
openlow
self
.
openlow
=
openlow
...
@@ -2026,8 +2034,6 @@ identity = Identity(same_out, name='identity')
...
@@ -2026,8 +2034,6 @@ identity = Identity(same_out, name='identity')
# CASTING OPERATIONS
# CASTING OPERATIONS
class
Cast
(
UnaryScalarOp
):
class
Cast
(
UnaryScalarOp
):
__props__
=
(
"o_type"
,
"name"
)
def
__init__
(
self
,
o_type
,
name
=
None
):
def
__init__
(
self
,
o_type
,
name
=
None
):
if
not
isinstance
(
o_type
,
Scalar
):
if
not
isinstance
(
o_type
,
Scalar
):
raise
TypeError
(
o_type
)
raise
TypeError
(
o_type
)
...
@@ -3453,7 +3459,7 @@ class Composite(ScalarOp):
...
@@ -3453,7 +3459,7 @@ class Composite(ScalarOp):
Composite depends on all the Ops in its graph having C code.
Composite depends on all the Ops in its graph having C code.
"""
"""
__props__
=
(
'inputs'
,
'outputs'
)
init_param
=
(
'inputs'
,
'outputs'
)
def
__str__
(
self
):
def
__str__
(
self
):
if
self
.
name
is
None
:
if
self
.
name
is
None
:
...
@@ -3467,7 +3473,7 @@ class Composite(ScalarOp):
...
@@ -3467,7 +3473,7 @@ class Composite(ScalarOp):
This fct allow fix patch this.
This fct allow fix patch this.
"""
"""
d
=
dict
([(
k
,
getattr
(
self
,
k
))
for
k
in
self
.
__props__
])
d
=
dict
([(
k
,
getattr
(
self
,
k
))
for
k
in
self
.
init_param
])
out
=
self
.
__class__
(
**
d
)
out
=
self
.
__class__
(
**
d
)
if
name
:
if
name
:
out
.
name
=
name
out
.
name
=
name
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论