Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0f89dd53
提交
0f89dd53
authored
10月 03, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pep8
上级
0884f7d3
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
22 行增加
和
16 行删除
+22
-16
basic.py
theano/typed_list/basic.py
+1
-1
test_basic.py
theano/typed_list/tests/test_basic.py
+21
-15
没有找到文件。
theano/typed_list/basic.py
浏览文件 @
0f89dd53
...
@@ -36,7 +36,7 @@ class _typed_list_py_operators:
...
@@ -36,7 +36,7 @@ class _typed_list_py_operators:
def
count
(
self
,
elem
):
def
count
(
self
,
elem
):
return
count
(
self
,
elem
)
return
count
(
self
,
elem
)
#name "index" is already used by an attribute
#
name "index" is already used by an attribute
def
ind
(
self
,
elem
):
def
ind
(
self
,
elem
):
return
index_
(
self
,
elem
)
return
index_
(
self
,
elem
)
...
...
theano/typed_list/tests/test_basic.py
浏览文件 @
0f89dd53
...
@@ -21,13 +21,13 @@ except ImportError:
...
@@ -21,13 +21,13 @@ except ImportError:
scipy_imported
=
False
scipy_imported
=
False
#took from tensors/tests/test_basic.py
#
took from tensors/tests/test_basic.py
def
rand_ranged_matrix
(
minimum
,
maximum
,
shape
):
def
rand_ranged_matrix
(
minimum
,
maximum
,
shape
):
return
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
)
*
(
maximum
-
minimum
)
return
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
)
*
(
maximum
-
minimum
)
+
minimum
,
dtype
=
theano
.
config
.
floatX
)
+
minimum
,
dtype
=
theano
.
config
.
floatX
)
#took from sparse/tests/test_basic.py
#
took from sparse/tests/test_basic.py
def
random_lil
(
shape
,
dtype
,
nnz
):
def
random_lil
(
shape
,
dtype
,
nnz
):
rval
=
sp
.
lil_matrix
(
shape
,
dtype
=
dtype
)
rval
=
sp
.
lil_matrix
(
shape
,
dtype
=
dtype
)
huge
=
2
**
30
huge
=
2
**
30
...
@@ -35,7 +35,7 @@ def random_lil(shape, dtype, nnz):
...
@@ -35,7 +35,7 @@ def random_lil(shape, dtype, nnz):
# set non-zeros in random locations (row x, col y)
# set non-zeros in random locations (row x, col y)
idx
=
numpy
.
random
.
random_integers
(
huge
,
size
=
2
)
%
shape
idx
=
numpy
.
random
.
random_integers
(
huge
,
size
=
2
)
%
shape
value
=
numpy
.
random
.
rand
()
value
=
numpy
.
random
.
rand
()
#if dtype *int*, value will always be zeros!
#
if dtype *int*, value will always be zeros!
if
"int"
in
dtype
:
if
"int"
in
dtype
:
value
=
int
(
value
*
100
)
value
=
int
(
value
*
100
)
# The call to tuple is needed as scipy 0.13.1 do not support
# The call to tuple is needed as scipy 0.13.1 do not support
...
@@ -84,8 +84,9 @@ class test_get_item(unittest.TestCase):
...
@@ -84,8 +84,9 @@ class test_get_item(unittest.TestCase):
x
=
rand_ranged_matrix
(
-
1000
,
1000
,
[
100
,
101
])
x
=
rand_ranged_matrix
(
-
1000
,
1000
,
[
100
,
101
])
y
=
rand_ranged_matrix
(
-
1000
,
1000
,
[
100
,
101
])
y
=
rand_ranged_matrix
(
-
1000
,
1000
,
[
100
,
101
])
self
.
assertTrue
(
numpy
.
array_equal
(
f
([
x
],
numpy
.
asarray
(
0
,
self
.
assertTrue
(
numpy
.
array_equal
(
f
([
x
],
dtype
=
'int64'
)),
x
))
numpy
.
asarray
(
0
,
dtype
=
'int64'
)),
x
))
def
test_interface
(
self
):
def
test_interface
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
...
@@ -99,8 +100,9 @@ class test_get_item(unittest.TestCase):
...
@@ -99,8 +100,9 @@ class test_get_item(unittest.TestCase):
x
=
rand_ranged_matrix
(
-
1000
,
1000
,
[
100
,
101
])
x
=
rand_ranged_matrix
(
-
1000
,
1000
,
[
100
,
101
])
self
.
assertTrue
(
numpy
.
array_equal
(
f
([
x
],
numpy
.
asarray
(
0
,
self
.
assertTrue
(
numpy
.
array_equal
(
f
([
x
],
dtype
=
'int64'
)),
x
))
numpy
.
asarray
(
0
,
dtype
=
'int64'
)),
x
))
z
=
mySymbolicMatricesList
[
0
]
z
=
mySymbolicMatricesList
[
0
]
...
@@ -258,8 +260,10 @@ class test_insert(unittest.TestCase):
...
@@ -258,8 +260,10 @@ class test_insert(unittest.TestCase):
y
=
rand_ranged_matrix
(
-
1000
,
1000
,
[
100
,
101
])
y
=
rand_ranged_matrix
(
-
1000
,
1000
,
[
100
,
101
])
self
.
assertTrue
(
numpy
.
array_equal
(
f
([
x
],
numpy
.
asarray
(
1
,
self
.
assertTrue
(
numpy
.
array_equal
(
f
([
x
],
dtype
=
'int64'
),
y
),
[
x
,
y
]))
numpy
.
asarray
(
1
,
dtype
=
'int64'
),
y
),
[
x
,
y
]))
def
test_sanity_check
(
self
):
def
test_sanity_check
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
...
@@ -292,8 +296,10 @@ class test_insert(unittest.TestCase):
...
@@ -292,8 +296,10 @@ class test_insert(unittest.TestCase):
y
=
rand_ranged_matrix
(
-
1000
,
1000
,
[
100
,
101
])
y
=
rand_ranged_matrix
(
-
1000
,
1000
,
[
100
,
101
])
self
.
assertTrue
(
numpy
.
array_equal
(
f
([
x
],
numpy
.
asarray
(
1
,
self
.
assertTrue
(
numpy
.
array_equal
(
f
([
x
],
dtype
=
'int64'
),
y
),
[
x
,
y
]))
numpy
.
asarray
(
1
,
dtype
=
'int64'
),
y
),
[
x
,
y
]))
class
test_remove
(
unittest
.
TestCase
):
class
test_remove
(
unittest
.
TestCase
):
...
@@ -443,8 +449,8 @@ class test_index(unittest.TestCase):
...
@@ -443,8 +449,8 @@ class test_index(unittest.TestCase):
def
test_sparse
(
self
):
def
test_sparse
(
self
):
if
not
scipy_imported
:
if
not
scipy_imported
:
raise
SkipTest
(
'Optional package SciPy not installed'
)
raise
SkipTest
(
'Optional package SciPy not installed'
)
mySymbolicSparseList
=
TypedListType
(
sparse
.
SparseType
(
'csr'
,
mySymbolicSparseList
=
TypedListType
(
theano
.
config
.
floatX
))()
sparse
.
SparseType
(
'csr'
,
theano
.
config
.
floatX
))()
mySymbolicSparse
=
sparse
.
csr_matrix
()
mySymbolicSparse
=
sparse
.
csr_matrix
()
z
=
Index
()(
mySymbolicSparseList
,
mySymbolicSparse
)
z
=
Index
()(
mySymbolicSparseList
,
mySymbolicSparse
)
...
@@ -509,8 +515,8 @@ class test_count(unittest.TestCase):
...
@@ -509,8 +515,8 @@ class test_count(unittest.TestCase):
def
test_sparse
(
self
):
def
test_sparse
(
self
):
if
not
scipy_imported
:
if
not
scipy_imported
:
raise
SkipTest
(
'Optional package SciPy not installed'
)
raise
SkipTest
(
'Optional package SciPy not installed'
)
mySymbolicSparseList
=
TypedListType
(
sparse
.
SparseType
(
'csr'
,
mySymbolicSparseList
=
TypedListType
(
theano
.
config
.
floatX
))()
sparse
.
SparseType
(
'csr'
,
theano
.
config
.
floatX
))()
mySymbolicSparse
=
sparse
.
csr_matrix
()
mySymbolicSparse
=
sparse
.
csr_matrix
()
z
=
Count
()(
mySymbolicSparseList
,
mySymbolicSparse
)
z
=
Count
()(
mySymbolicSparseList
,
mySymbolicSparse
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论