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 个修改的文件
包含
58 行增加
和
52 行删除
+58
-52
basic.py
theano/typed_list/basic.py
+2
-2
test_basic.py
theano/typed_list/tests/test_basic.py
+56
-50
没有找到文件。
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
)
...
@@ -423,7 +423,7 @@ class Reverse(Op):
...
@@ -423,7 +423,7 @@ class Reverse(Op):
return
self
.
__class__
.
__name__
return
self
.
__class__
.
__name__
def
c_code
(
self
,
node
,
name
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
name
,
inp
,
out
,
sub
):
x_name
=
inp
[
0
]
x_name
=
inp
[
0
]
output_name
=
out
[
0
]
output_name
=
out
[
0
]
fail
=
sub
[
'fail'
]
fail
=
sub
[
'fail'
]
if
not
self
.
inplace
:
if
not
self
.
inplace
:
...
...
theano/typed_list/tests/test_basic.py
浏览文件 @
0f89dd53
...
@@ -9,8 +9,8 @@ from theano import tensor as T
...
@@ -9,8 +9,8 @@ from theano import tensor as T
from
theano.tensor.type_other
import
SliceType
from
theano.tensor.type_other
import
SliceType
from
theano.typed_list.type
import
TypedListType
from
theano.typed_list.type
import
TypedListType
from
theano.typed_list.basic
import
(
GetItem
,
Insert
,
from
theano.typed_list.basic
import
(
GetItem
,
Insert
,
Append
,
Extend
,
Remove
,
Reverse
,
Append
,
Extend
,
Remove
,
Reverse
,
Index
,
Count
,
Length
)
Index
,
Count
,
Length
)
from
theano
import
sparse
from
theano
import
sparse
from
theano.tests
import
unittest_tools
as
utt
from
theano.tests
import
unittest_tools
as
utt
# TODO, handle the case where scipy isn't installed.
# TODO, handle the case where scipy isn't installed.
...
@@ -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
...
@@ -54,7 +54,7 @@ class test_get_item(unittest.TestCase):
...
@@ -54,7 +54,7 @@ class test_get_item(unittest.TestCase):
def
test_sanity_check_slice
(
self
):
def
test_sanity_check_slice
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
mySymbolicSlice
=
SliceType
()()
mySymbolicSlice
=
SliceType
()()
...
@@ -72,7 +72,7 @@ class test_get_item(unittest.TestCase):
...
@@ -72,7 +72,7 @@ class test_get_item(unittest.TestCase):
def
test_sanity_check_single
(
self
):
def
test_sanity_check_single
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
mySymbolicScalar
=
T
.
scalar
(
dtype
=
'int64'
)
mySymbolicScalar
=
T
.
scalar
(
dtype
=
'int64'
)
...
@@ -84,12 +84,13 @@ class test_get_item(unittest.TestCase):
...
@@ -84,12 +84,13 @@ 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
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
mySymbolicScalar
=
T
.
scalar
(
dtype
=
'int64'
)
mySymbolicScalar
=
T
.
scalar
(
dtype
=
'int64'
)
z
=
mySymbolicMatricesList
[
mySymbolicScalar
]
z
=
mySymbolicMatricesList
[
mySymbolicScalar
]
...
@@ -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
]
...
@@ -111,7 +113,7 @@ class test_get_item(unittest.TestCase):
...
@@ -111,7 +113,7 @@ class test_get_item(unittest.TestCase):
def
test_wrong_input
(
self
):
def
test_wrong_input
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
mySymbolicMatrix
=
T
.
matrix
()
mySymbolicMatrix
=
T
.
matrix
()
self
.
assertRaises
(
TypeError
,
GetItem
(),
mySymbolicMatricesList
,
self
.
assertRaises
(
TypeError
,
GetItem
(),
mySymbolicMatricesList
,
...
@@ -119,7 +121,7 @@ class test_get_item(unittest.TestCase):
...
@@ -119,7 +121,7 @@ class test_get_item(unittest.TestCase):
def
test_constant_input
(
self
):
def
test_constant_input
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
GetItem
()(
mySymbolicMatricesList
,
0
)
z
=
GetItem
()(
mySymbolicMatricesList
,
0
)
...
@@ -142,7 +144,7 @@ class test_append(unittest.TestCase):
...
@@ -142,7 +144,7 @@ class test_append(unittest.TestCase):
def
test_inplace
(
self
):
def
test_inplace
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
z
=
Append
(
True
)(
mySymbolicMatricesList
,
myMatrix
)
z
=
Append
(
True
)(
mySymbolicMatricesList
,
myMatrix
)
...
@@ -158,7 +160,7 @@ class test_append(unittest.TestCase):
...
@@ -158,7 +160,7 @@ class test_append(unittest.TestCase):
def
test_sanity_check
(
self
):
def
test_sanity_check
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
z
=
Append
()(
mySymbolicMatricesList
,
myMatrix
)
z
=
Append
()(
mySymbolicMatricesList
,
myMatrix
)
...
@@ -173,7 +175,7 @@ class test_append(unittest.TestCase):
...
@@ -173,7 +175,7 @@ class test_append(unittest.TestCase):
def
test_interfaces
(
self
):
def
test_interfaces
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
z
=
mySymbolicMatricesList
.
append
(
myMatrix
)
z
=
mySymbolicMatricesList
.
append
(
myMatrix
)
...
@@ -191,9 +193,9 @@ class test_extend(unittest.TestCase):
...
@@ -191,9 +193,9 @@ class test_extend(unittest.TestCase):
def
test_inplace
(
self
):
def
test_inplace
(
self
):
mySymbolicMatricesList1
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList1
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
mySymbolicMatricesList2
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList2
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
Extend
(
True
)(
mySymbolicMatricesList1
,
mySymbolicMatricesList2
)
z
=
Extend
(
True
)(
mySymbolicMatricesList1
,
mySymbolicMatricesList2
)
...
@@ -208,9 +210,9 @@ class test_extend(unittest.TestCase):
...
@@ -208,9 +210,9 @@ class test_extend(unittest.TestCase):
def
test_sanity_check
(
self
):
def
test_sanity_check
(
self
):
mySymbolicMatricesList1
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList1
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
mySymbolicMatricesList2
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList2
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
Extend
()(
mySymbolicMatricesList1
,
mySymbolicMatricesList2
)
z
=
Extend
()(
mySymbolicMatricesList1
,
mySymbolicMatricesList2
)
...
@@ -225,9 +227,9 @@ class test_extend(unittest.TestCase):
...
@@ -225,9 +227,9 @@ class test_extend(unittest.TestCase):
def
test_interface
(
self
):
def
test_interface
(
self
):
mySymbolicMatricesList1
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList1
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
mySymbolicMatricesList2
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList2
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
mySymbolicMatricesList1
.
extend
(
mySymbolicMatricesList2
)
z
=
mySymbolicMatricesList1
.
extend
(
mySymbolicMatricesList2
)
...
@@ -245,7 +247,7 @@ class test_insert(unittest.TestCase):
...
@@ -245,7 +247,7 @@ class test_insert(unittest.TestCase):
def
test_inplace
(
self
):
def
test_inplace
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
myScalar
=
T
.
scalar
(
dtype
=
'int64'
)
myScalar
=
T
.
scalar
(
dtype
=
'int64'
)
...
@@ -258,12 +260,14 @@ class test_insert(unittest.TestCase):
...
@@ -258,12 +260,14 @@ 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
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
myScalar
=
T
.
scalar
(
dtype
=
'int64'
)
myScalar
=
T
.
scalar
(
dtype
=
'int64'
)
...
@@ -280,7 +284,7 @@ class test_insert(unittest.TestCase):
...
@@ -280,7 +284,7 @@ class test_insert(unittest.TestCase):
def
test_interface
(
self
):
def
test_interface
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
myScalar
=
T
.
scalar
(
dtype
=
'int64'
)
myScalar
=
T
.
scalar
(
dtype
=
'int64'
)
...
@@ -292,15 +296,17 @@ class test_insert(unittest.TestCase):
...
@@ -292,15 +296,17 @@ 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
):
def
test_inplace
(
self
):
def
test_inplace
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
z
=
Remove
(
True
)(
mySymbolicMatricesList
,
myMatrix
)
z
=
Remove
(
True
)(
mySymbolicMatricesList
,
myMatrix
)
...
@@ -316,7 +322,7 @@ class test_remove(unittest.TestCase):
...
@@ -316,7 +322,7 @@ class test_remove(unittest.TestCase):
def
test_sanity_check
(
self
):
def
test_sanity_check
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
z
=
Remove
()(
mySymbolicMatricesList
,
myMatrix
)
z
=
Remove
()(
mySymbolicMatricesList
,
myMatrix
)
...
@@ -331,7 +337,7 @@ class test_remove(unittest.TestCase):
...
@@ -331,7 +337,7 @@ class test_remove(unittest.TestCase):
def
test_interface
(
self
):
def
test_interface
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
z
=
mySymbolicMatricesList
.
remove
(
myMatrix
)
z
=
mySymbolicMatricesList
.
remove
(
myMatrix
)
...
@@ -349,7 +355,7 @@ class test_reverse(unittest.TestCase):
...
@@ -349,7 +355,7 @@ class test_reverse(unittest.TestCase):
def
test_inplace
(
self
):
def
test_inplace
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
Reverse
(
True
)(
mySymbolicMatricesList
)
z
=
Reverse
(
True
)(
mySymbolicMatricesList
)
...
@@ -364,7 +370,7 @@ class test_reverse(unittest.TestCase):
...
@@ -364,7 +370,7 @@ class test_reverse(unittest.TestCase):
def
test_sanity_check
(
self
):
def
test_sanity_check
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
Reverse
()(
mySymbolicMatricesList
)
z
=
Reverse
()(
mySymbolicMatricesList
)
...
@@ -378,7 +384,7 @@ class test_reverse(unittest.TestCase):
...
@@ -378,7 +384,7 @@ class test_reverse(unittest.TestCase):
def
test_interface
(
self
):
def
test_interface
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
mySymbolicMatricesList
.
reverse
()
z
=
mySymbolicMatricesList
.
reverse
()
...
@@ -395,7 +401,7 @@ class test_index(unittest.TestCase):
...
@@ -395,7 +401,7 @@ class test_index(unittest.TestCase):
def
test_sanity_check
(
self
):
def
test_sanity_check
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
z
=
Index
()(
mySymbolicMatricesList
,
myMatrix
)
z
=
Index
()(
mySymbolicMatricesList
,
myMatrix
)
...
@@ -410,7 +416,7 @@ class test_index(unittest.TestCase):
...
@@ -410,7 +416,7 @@ class test_index(unittest.TestCase):
def
test_interface
(
self
):
def
test_interface
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
z
=
mySymbolicMatricesList
.
ind
(
myMatrix
)
z
=
mySymbolicMatricesList
.
ind
(
myMatrix
)
...
@@ -425,9 +431,9 @@ class test_index(unittest.TestCase):
...
@@ -425,9 +431,9 @@ class test_index(unittest.TestCase):
def
test_non_tensor_type
(
self
):
def
test_non_tensor_type
(
self
):
mySymbolicNestedMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicNestedMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)),
1
)()
theano
.
config
.
floatX
,
(
False
,
False
)),
1
)()
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
Index
()(
mySymbolicNestedMatricesList
,
mySymbolicMatricesList
)
z
=
Index
()(
mySymbolicNestedMatricesList
,
mySymbolicMatricesList
)
...
@@ -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
)
...
@@ -461,7 +467,7 @@ class test_count(unittest.TestCase):
...
@@ -461,7 +467,7 @@ class test_count(unittest.TestCase):
def
test_sanity_check
(
self
):
def
test_sanity_check
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
z
=
Count
()(
mySymbolicMatricesList
,
myMatrix
)
z
=
Count
()(
mySymbolicMatricesList
,
myMatrix
)
...
@@ -476,7 +482,7 @@ class test_count(unittest.TestCase):
...
@@ -476,7 +482,7 @@ class test_count(unittest.TestCase):
def
test_interface
(
self
):
def
test_interface
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
myMatrix
=
T
.
matrix
()
myMatrix
=
T
.
matrix
()
z
=
mySymbolicMatricesList
.
count
(
myMatrix
)
z
=
mySymbolicMatricesList
.
count
(
myMatrix
)
...
@@ -491,9 +497,9 @@ class test_count(unittest.TestCase):
...
@@ -491,9 +497,9 @@ class test_count(unittest.TestCase):
def
test_non_tensor_type
(
self
):
def
test_non_tensor_type
(
self
):
mySymbolicNestedMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicNestedMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)),
1
)()
theano
.
config
.
floatX
,
(
False
,
False
)),
1
)()
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
Count
()(
mySymbolicNestedMatricesList
,
mySymbolicMatricesList
)
z
=
Count
()(
mySymbolicNestedMatricesList
,
mySymbolicMatricesList
)
...
@@ -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
)
...
@@ -527,7 +533,7 @@ class test_length(unittest.TestCase):
...
@@ -527,7 +533,7 @@ class test_length(unittest.TestCase):
def
test_sanity_check
(
self
):
def
test_sanity_check
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
Length
()(
mySymbolicMatricesList
)
z
=
Length
()(
mySymbolicMatricesList
)
...
@@ -539,7 +545,7 @@ class test_length(unittest.TestCase):
...
@@ -539,7 +545,7 @@ class test_length(unittest.TestCase):
def
test_interface
(
self
):
def
test_interface
(
self
):
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
mySymbolicMatricesList
=
TypedListType
(
T
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,
False
)))()
theano
.
config
.
floatX
,
(
False
,
False
)))()
z
=
mySymbolicMatricesList
.
__len__
()
z
=
mySymbolicMatricesList
.
__len__
()
f
=
theano
.
function
([
mySymbolicMatricesList
],
z
)
f
=
theano
.
function
([
mySymbolicMatricesList
],
z
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论