Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4936e630
提交
4936e630
authored
12月 09, 2015
作者:
Ramana.S
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Test added, code made complaint with pep8 standards
上级
db6fc48d
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
29 行增加
和
6 行删除
+29
-6
ops.py
theano/compile/ops.py
+3
-3
test_ops.py
theano/compile/tests/test_ops.py
+1
-1
op.py
theano/gof/op.py
+0
-0
test_op.py
theano/gof/tests/test_op.py
+25
-2
没有找到文件。
theano/compile/ops.py
浏览文件 @
4936e630
...
...
@@ -509,7 +509,7 @@ class FromFunctionOp(gof.Op):
self
.
infer_shape
=
self
.
_infer_shape
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
)
and
return
(
isinstance
(
self
,
type
(
other
)
)
and
self
.
__fn
==
other
.
__fn
)
def
__hash__
(
self
):
...
...
@@ -523,9 +523,9 @@ class FromFunctionOp(gof.Op):
if
not
self
.
itypes
:
raise
NotImplementedError
(
"itypes not defined"
)
if
not
self
.
otypes
:
if
not
self
.
otypes
:
raise
NotImplementedError
(
"otypes not defined"
)
if
len
(
inputs
)
!=
len
(
self
.
itypes
):
raise
ValueError
(
"We expected
%
d inputs but got
%
d."
%
(
len
(
self
.
itypes
),
len
(
inputs
)))
...
...
theano/compile/tests/test_ops.py
浏览文件 @
4936e630
...
...
@@ -16,7 +16,7 @@ import pickle
# reachable from pickle (as in it cannot be defined inline)
@as_op
([
dmatrix
,
dmatrix
],
dmatrix
)
def
mul
(
a
,
b
):
return
a
*
b
return
a
*
b
class
OpDecoratorTests
(
utt
.
InferShapeTester
):
...
...
theano/gof/op.py
浏览文件 @
4936e630
差异被折叠。
点击展开。
theano/gof/tests/test_op.py
浏览文件 @
4936e630
...
...
@@ -29,7 +29,7 @@ class MyType(Type):
self
.
thingy
=
thingy
def
__eq__
(
self
,
other
):
return
type
(
other
)
==
type
(
self
)
and
other
.
thingy
==
self
.
thingy
return
isinstance
(
other
,
type
(
self
)
)
and
other
.
thingy
==
self
.
thingy
def
__str__
(
self
):
return
str
(
self
.
thingy
)
...
...
@@ -58,7 +58,7 @@ class MyType(Type):
class
MyOp
(
Op
):
__props__
=
()
def
make_node
(
self
,
*
inputs
):
inputs
=
list
(
map
(
as_variable
,
inputs
))
for
input
in
inputs
:
...
...
@@ -157,6 +157,7 @@ class TestOp:
class
TestMakeThunk
(
unittest
.
TestCase
):
def
test_no_c_code
(
self
):
class
IncOnePython
(
Op
):
"""An Op with only a Python (perform) implementation"""
...
...
@@ -234,6 +235,28 @@ class TestMakeThunk(unittest.TestCase):
self
.
assertRaises
((
NotImplementedError
,
utils
.
MethodNotDefined
),
thunk
)
def
test_no_make_node
(
self
):
class
IncOne
(
Op
):
"""An Op without make_node"""
__props__
=
()
itypes
=
[
T
.
fmatrix
]
otypes
=
[
T
.
fmatrix
]
def
perform
(
self
,
node
,
inputs
,
outputs
):
input
,
=
inputs
output
,
=
outputs
output
[
0
]
=
input
+
1
x_input
=
T
.
fmatrix
(
'x'
)
o
=
IncOne
()(
x_input
)
# Confirming that make_node method is implemented
try
:
self
.
assertRaises
((
NotImplementedError
,
utils
.
MethodNotDefined
),
o
.
owner
.
op
.
make_node
,
x_input
)
except
AssertionError
:
pass
def
test_test_value_python_objects
():
for
x
in
([
0
,
1
,
2
],
0
,
0.5
,
1
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论