Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1da5a694
提交
1da5a694
authored
10月 31, 2016
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bonus flake8.
上级
a75dd96e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
25 行增加
和
25 行删除
+25
-25
test_basic.py
theano/scalar/tests/test_basic.py
+25
-24
test_flake8.py
theano/tests/test_flake8.py
+0
-1
没有找到文件。
theano/scalar/tests/test_basic.py
浏览文件 @
1da5a694
...
@@ -59,12 +59,12 @@ class test_ScalarOps(unittest.TestCase):
...
@@ -59,12 +59,12 @@ class test_ScalarOps(unittest.TestCase):
as Python. That is what we want.
as Python. That is what we want.
"""
"""
x
,
y
=
ints
(
'xy'
)
x
,
y
=
ints
(
'xy'
)
fn
=
gof
.
DualLinker
()
.
accept
(
FunctionGraph
([
x
,
y
],
[
x
%
y
]))
.
make_function
()
fn
=
gof
.
DualLinker
()
.
accept
(
FunctionGraph
([
x
,
y
],
[
x
%
y
]))
.
make_function
()
for
a
,
b
in
((
0
,
1
),
(
1
,
1
),
(
0
,
-
1
),
(
1
,
-
1
),
(
-
1
,
-
1
),
for
a
,
b
in
((
0
,
1
),
(
1
,
1
),
(
0
,
-
1
),
(
1
,
-
1
),
(
-
1
,
-
1
),
(
1
,
2
),
(
-
1
,
2
),
(
1
,
-
2
),
(
-
1
,
-
2
),
(
1
,
2
),
(
-
1
,
2
),
(
1
,
-
2
),
(
-
1
,
-
2
),
(
5
,
3
),
(
-
5
,
3
),
(
5
,
-
3
),
(
-
5
,
-
3
)
(
5
,
3
),
(
-
5
,
3
),
(
5
,
-
3
),
(
-
5
,
-
3
)
):
):
self
.
assertTrue
(
fn
(
a
,
b
)
==
a
%
b
,
(
a
,))
self
.
assertTrue
(
fn
(
a
,
b
)
==
a
%
b
,
(
a
,))
def
has_f16
(
comp
):
def
has_f16
(
comp
):
...
@@ -145,7 +145,7 @@ class test_composite(unittest.TestCase):
...
@@ -145,7 +145,7 @@ class test_composite(unittest.TestCase):
C
=
Composite
([
x
,
y
,
z
],
[
e0
,
e1
,
e2
,
e3
,
e4
,
e5
,
e6
,
e7
])
C
=
Composite
([
x
,
y
,
z
],
[
e0
,
e1
,
e2
,
e3
,
e4
,
e5
,
e6
,
e7
])
c
=
C
.
make_node
(
x
,
y
,
z
)
c
=
C
.
make_node
(
x
,
y
,
z
)
g
=
FunctionGraph
([
x
,
y
,
z
],
c
.
outputs
)
g
=
FunctionGraph
([
x
,
y
,
z
],
c
.
outputs
)
fn
=
gof
.
DualLinker
()
.
accept
(
g
)
.
make_function
()
gof
.
DualLinker
()
.
accept
(
g
)
.
make_function
()
assert
str
(
g
)
==
(
'[*1 -> Composite{((i0 + i1) + i2),'
assert
str
(
g
)
==
(
'[*1 -> Composite{((i0 + i1) + i2),'
' (i0 + (i1 * i2)), (i0 / i1), '
' (i0 + (i1 * i2)), (i0 / i1), '
...
@@ -225,13 +225,13 @@ class test_logical(unittest.TestCase):
...
@@ -225,13 +225,13 @@ class test_logical(unittest.TestCase):
def
test_or
(
self
):
def
test_or
(
self
):
x
,
y
,
z
=
ints
(
'xyz'
)
x
,
y
,
z
=
ints
(
'xyz'
)
fn
=
gof
.
DualLinker
()
.
accept
(
FunctionGraph
([
x
,
y
],
[
x
|
y
]))
.
make_function
()
fn
=
gof
.
DualLinker
()
.
accept
(
FunctionGraph
([
x
,
y
],
[
x
|
y
]))
.
make_function
()
for
a
,
b
in
((
0
,
1
),
(
0
,
0
),
(
1
,
0
),
(
1
,
1
)):
for
a
,
b
in
((
0
,
1
),
(
0
,
0
),
(
1
,
0
),
(
1
,
1
)):
self
.
assertTrue
(
fn
(
a
,
b
)
==
(
a
|
b
),
(
a
,
b
))
self
.
assertTrue
(
fn
(
a
,
b
)
==
(
a
|
b
),
(
a
,
b
))
def
test_xor
(
self
):
def
test_xor
(
self
):
x
,
y
,
z
=
ints
(
'xyz'
)
x
,
y
,
z
=
ints
(
'xyz'
)
fn
=
gof
.
DualLinker
()
.
accept
(
FunctionGraph
([
x
,
y
],
[
x
^
y
]))
.
make_function
()
fn
=
gof
.
DualLinker
()
.
accept
(
FunctionGraph
([
x
,
y
],
[
x
^
y
]))
.
make_function
()
for
a
,
b
in
((
0
,
1
),
(
0
,
0
),
(
1
,
0
),
(
1
,
1
)):
for
a
,
b
in
((
0
,
1
),
(
0
,
0
),
(
1
,
0
),
(
1
,
1
)):
self
.
assertTrue
(
fn
(
a
,
b
)
==
(
a
^
b
),
(
a
,
b
))
self
.
assertTrue
(
fn
(
a
,
b
)
==
(
a
^
b
),
(
a
,
b
))
...
@@ -365,8 +365,9 @@ class test_upgrade_to_float(object):
...
@@ -365,8 +365,9 @@ class test_upgrade_to_float(object):
# Automatically define all individual unary tests
# Automatically define all individual unary tests
for
unary_op
,
x_range
in
self
.
unary_ops_vals
:
for
unary_op
,
x_range
in
self
.
unary_ops_vals
:
test_name
=
'test_
%
s'
%
unary_op
.
name
test_name
=
'test_
%
s'
%
unary_op
.
name
# Make a lambda function so we can name the test
test
=
lambda
:
self
.
_test_unary
(
unary_op
,
x_range
)
def
test
():
self
.
_test_unary
(
unary_op
,
x_range
)
test
.
description
=
test_name
test
.
description
=
test_name
yield
test
yield
test
...
@@ -374,8 +375,9 @@ class test_upgrade_to_float(object):
...
@@ -374,8 +375,9 @@ class test_upgrade_to_float(object):
# Automatically define all individual binary tests
# Automatically define all individual binary tests
for
binary_op
,
x_range
,
y_range
in
self
.
binary_ops_vals
:
for
binary_op
,
x_range
,
y_range
in
self
.
binary_ops_vals
:
test_name
=
'test_
%
s'
%
binary_op
.
name
test_name
=
'test_
%
s'
%
binary_op
.
name
# Make a lambda function so we can name the test
test
=
lambda
:
self
.
_test_binary
(
binary_op
,
x_range
,
y_range
)
def
test
():
self
.
_test_binary
(
binary_op
,
x_range
,
y_range
)
test
.
description
=
test_name
test
.
description
=
test_name
yield
test
yield
test
...
@@ -401,16 +403,15 @@ class test_div(unittest.TestCase):
...
@@ -401,16 +403,15 @@ class test_div(unittest.TestCase):
d
=
float64
()
d
=
float64
()
f
=
float32
()
f
=
float32
()
#print (a//b).owner.op
assert
isinstance
((
a
//
b
)
.
owner
.
op
,
IntDiv
)
assert
isinstance
((
a
//
b
)
.
owner
.
op
,
IntDiv
)
assert
isinstance
((
b
//
a
)
.
owner
.
op
,
IntDiv
)
assert
isinstance
((
b
//
a
)
.
owner
.
op
,
IntDiv
)
assert
isinstance
((
b
/
d
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
b
/
d
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
b
/
f
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
b
/
f
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
f
/
a
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
f
/
a
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
d
/
b
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
d
/
b
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
d
/
f
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
d
/
f
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
f
/
c
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
f
/
c
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
a
/
c
)
.
owner
.
op
,
TrueDiv
)
assert
isinstance
((
a
/
c
)
.
owner
.
op
,
TrueDiv
)
def
test_grad_gt
():
def
test_grad_gt
():
...
@@ -418,7 +419,7 @@ def test_grad_gt():
...
@@ -418,7 +419,7 @@ def test_grad_gt():
y
=
float32
(
name
=
'y'
)
y
=
float32
(
name
=
'y'
)
z
=
x
>
y
z
=
x
>
y
g
=
theano
.
gradient
.
grad
(
z
,
y
)
g
=
theano
.
gradient
.
grad
(
z
,
y
)
assert
g
.
eval
({
y
:
1.
})
==
0.
assert
g
.
eval
({
y
:
1.
})
==
0.
def
test_grad_switch
():
def
test_grad_switch
():
...
...
theano/tests/test_flake8.py
浏览文件 @
1da5a694
...
@@ -77,7 +77,6 @@ whitelist_flake8 = [
...
@@ -77,7 +77,6 @@ whitelist_flake8 = [
"tensor/signal/tests/__init__.py"
,
"tensor/signal/tests/__init__.py"
,
"scalar/__init__.py"
,
"scalar/__init__.py"
,
"scalar/tests/__init__.py"
,
"scalar/tests/__init__.py"
,
"scalar/tests/test_basic.py"
,
"sandbox/__init__.py"
,
"sandbox/__init__.py"
,
"sandbox/tests/test_theano_object.py"
,
"sandbox/tests/test_theano_object.py"
,
"sandbox/tests/test_scan.py"
,
"sandbox/tests/test_scan.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论