Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ae17e382
提交
ae17e382
authored
10月 21, 2011
作者:
David Warde-Farley
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
10**-4 -> 1e-4
上级
7720d2d2
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
7 行增加
和
6 行删除
+7
-6
test_basic.py
theano/sparse/tests/test_basic.py
+7
-6
没有找到文件。
theano/sparse/tests/test_basic.py
浏览文件 @
ae17e382
...
@@ -534,7 +534,6 @@ class DotTests(unittest.TestCase):
...
@@ -534,7 +534,6 @@ class DotTests(unittest.TestCase):
self
.
y_csr
=
scipy
.
sparse
.
csr_matrix
(
numpy
.
random
.
binomial
(
1
,
0.5
,
y_size
),
dtype
=
theano
.
config
.
floatX
)
self
.
y_csr
=
scipy
.
sparse
.
csr_matrix
(
numpy
.
random
.
binomial
(
1
,
0.5
,
y_size
),
dtype
=
theano
.
config
.
floatX
)
self
.
y_csc
=
scipy
.
sparse
.
csc_matrix
(
numpy
.
random
.
binomial
(
1
,
0.5
,
y_size
),
dtype
=
theano
.
config
.
floatX
)
self
.
y_csc
=
scipy
.
sparse
.
csc_matrix
(
numpy
.
random
.
binomial
(
1
,
0.5
,
y_size
),
dtype
=
theano
.
config
.
floatX
)
def
test_csr_dense
(
self
):
def
test_csr_dense
(
self
):
x
=
theano
.
sparse
.
csr_matrix
(
'x'
)
x
=
theano
.
sparse
.
csr_matrix
(
'x'
)
y
=
theano
.
tensor
.
matrix
(
'y'
)
y
=
theano
.
tensor
.
matrix
(
'y'
)
...
@@ -542,7 +541,7 @@ class DotTests(unittest.TestCase):
...
@@ -542,7 +541,7 @@ class DotTests(unittest.TestCase):
f_a
=
theano
.
function
([
x
,
y
],
theano
.
sparse
.
dot
(
x
,
y
))
f_a
=
theano
.
function
([
x
,
y
],
theano
.
sparse
.
dot
(
x
,
y
))
f_b
=
lambda
x
,
y
:
x
*
y
f_b
=
lambda
x
,
y
:
x
*
y
assert
abs
(
f_a
(
self
.
x_csr
,
self
.
y
)
-
f_b
(
self
.
x_csr
,
self
.
y
))
.
max
()
<
1
0
**
-
4
assert
abs
(
f_a
(
self
.
x_csr
,
self
.
y
)
-
f_b
(
self
.
x_csr
,
self
.
y
))
.
max
()
<
1
e
-4
def
test_csc_dense
(
self
):
def
test_csc_dense
(
self
):
x
=
theano
.
sparse
.
csc_matrix
(
'x'
)
x
=
theano
.
sparse
.
csc_matrix
(
'x'
)
...
@@ -551,7 +550,9 @@ class DotTests(unittest.TestCase):
...
@@ -551,7 +550,9 @@ class DotTests(unittest.TestCase):
f_a
=
theano
.
function
([
x
,
y
],
theano
.
sparse
.
dot
(
x
,
y
))
f_a
=
theano
.
function
([
x
,
y
],
theano
.
sparse
.
dot
(
x
,
y
))
f_b
=
lambda
x
,
y
:
x
*
y
f_b
=
lambda
x
,
y
:
x
*
y
assert
abs
(
f_a
(
self
.
x_csc
,
self
.
y
)
-
f_b
(
self
.
x_csc
,
self
.
y
))
.
max
()
<
10
**-
4
assert
(
abs
(
f_a
(
self
.
x_csc
,
self
.
y
)
-
f_b
(
self
.
x_csc
,
self
.
y
))
.
max
()
<
1e-4
)
def
test_sparse_sparse
(
self
):
def
test_sparse_sparse
(
self
):
for
d1
,
d2
in
[(
'float32'
,
'float32'
),
for
d1
,
d2
in
[(
'float32'
,
'float32'
),
(
'float32'
,
'float64'
),
(
'float32'
,
'float64'
),
...
@@ -571,7 +572,7 @@ class DotTests(unittest.TestCase):
...
@@ -571,7 +572,7 @@ class DotTests(unittest.TestCase):
vx
=
getattr
(
self
,
'x_'
+
x_f
)
.
astype
(
d1
)
vx
=
getattr
(
self
,
'x_'
+
x_f
)
.
astype
(
d1
)
vy
=
getattr
(
self
,
'y_'
+
y_f
)
.
astype
(
d2
)
vy
=
getattr
(
self
,
'y_'
+
y_f
)
.
astype
(
d2
)
assert
abs
(
f_a
(
vx
,
vy
)
-
f_b
(
vx
,
vy
))
.
max
()
<
1
0
**
-
4
assert
abs
(
f_a
(
vx
,
vy
)
-
f_b
(
vx
,
vy
))
.
max
()
<
1
e
-4
class
UsmmTests
(
unittest
.
TestCase
):
class
UsmmTests
(
unittest
.
TestCase
):
...
@@ -627,12 +628,12 @@ class UsmmTests(unittest.TestCase):
...
@@ -627,12 +628,12 @@ class UsmmTests(unittest.TestCase):
updates
=
{
z
:
z
-
a
*
theano
.
sparse
.
dot
(
x
,
y
)},
updates
=
{
z
:
z
-
a
*
theano
.
sparse
.
dot
(
x
,
y
)},
mode
=
mode
)
mode
=
mode
)
f_a
(
1
,
x_data
,
y_data
)
f_a
(
1
,
x_data
,
y_data
)
assert
abs
(
z
.
get_value
(
borrow
=
True
)
-
f_b_out
)
.
max
()
<
1
0
**
-
4
assert
abs
(
z
.
get_value
(
borrow
=
True
)
-
f_b_out
)
.
max
()
<
1
e
-4
else
:
else
:
f_a
=
theano
.
function
([
a
,
x
,
y
],
z
-
a
*
theano
.
sparse
.
dot
(
x
,
y
),
f_a
=
theano
.
function
([
a
,
x
,
y
],
z
-
a
*
theano
.
sparse
.
dot
(
x
,
y
),
mode
=
mode
)
mode
=
mode
)
f_a_out
=
f_a
(
1
,
x_data
,
y_data
)
f_a_out
=
f_a
(
1
,
x_data
,
y_data
)
assert
abs
(
f_a_out
-
f_b_out
)
.
max
()
<
1
0
**
-
4
assert
abs
(
f_a_out
-
f_b_out
)
.
max
()
<
1
e
-4
topo
=
f_a
.
maker
.
env
.
toposort
()
topo
=
f_a
.
maker
.
env
.
toposort
()
if
(
y
.
type
.
dtype
==
theano
.
scalar
.
upcast
(
dtype1
,
dtype2
,
dtype3
,
dtype4
)
if
(
y
.
type
.
dtype
==
theano
.
scalar
.
upcast
(
dtype1
,
dtype2
,
dtype3
,
dtype4
)
and
format1
==
'csc'
and
format2
==
'dense'
):
and
format1
==
'csc'
and
format2
==
'dense'
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论