Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4156fa01
提交
4156fa01
authored
5月 02, 2015
作者:
David Warde-Farley
提交者:
Arnaud Bergeron
6月 22, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Numeric literal fixes.
上级
e14e9c33
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
9 行增加
和
9 行删除
+9
-9
compiledir.py
theano/gof/compiledir.py
+1
-1
test_basic.py
theano/tensor/tests/test_basic.py
+6
-6
test_subtensor.py
theano/tensor/tests/test_subtensor.py
+2
-2
没有找到文件。
theano/gof/compiledir.py
浏览文件 @
4156fa01
...
@@ -185,7 +185,7 @@ def filter_compiledir(path):
...
@@ -185,7 +185,7 @@ def filter_compiledir(path):
" or listing permissions."
%
path
)
" or listing permissions."
%
path
)
else
:
else
:
try
:
try
:
os
.
makedirs
(
path
,
0770
)
# read-write-execute for user and group
os
.
makedirs
(
path
,
0
o
770
)
# read-write-execute for user and group
except
OSError
as
e
:
except
OSError
as
e
:
# Maybe another parallel execution of theano was trying to create
# Maybe another parallel execution of theano was trying to create
# the same directory at the same time.
# the same directory at the same time.
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
4156fa01
...
@@ -4980,7 +4980,7 @@ class T_reshape(utt.InferShapeTester, utt.TestOptimizationMixin):
...
@@ -4980,7 +4980,7 @@ class T_reshape(utt.InferShapeTester, utt.TestOptimizationMixin):
def
test_reshape_long_in_shape
(
self
):
def
test_reshape_long_in_shape
(
self
):
v
=
dvector
(
'v'
)
v
=
dvector
(
'v'
)
r
=
v
.
reshape
((
v
.
shape
[
0
],
1
L
))
r
=
v
.
reshape
((
v
.
shape
[
0
],
1
))
print
(
r
.
eval
({
v
:
numpy
.
arange
(
5.
)}))
print
(
r
.
eval
({
v
:
numpy
.
arange
(
5.
)}))
assert
numpy
.
allclose
(
r
.
eval
({
v
:
numpy
.
arange
(
5.
)})
.
T
,
assert
numpy
.
allclose
(
r
.
eval
({
v
:
numpy
.
arange
(
5.
)})
.
T
,
numpy
.
arange
(
5.
))
numpy
.
arange
(
5.
))
...
@@ -6022,7 +6022,7 @@ def _test_autocast_numpy():
...
@@ -6022,7 +6022,7 @@ def _test_autocast_numpy():
def
ok
(
z
):
def
ok
(
z
):
assert
tensor
.
constant
(
z
)
.
dtype
==
numpy
.
asarray
(
z
)
.
dtype
assert
tensor
.
constant
(
z
)
.
dtype
==
numpy
.
asarray
(
z
)
.
dtype
for
x
in
([
2
**
i
for
i
in
xrange
(
63
)]
+
for
x
in
([
2
**
i
for
i
in
xrange
(
63
)]
+
[
0
,
0
L
,
1L
,
2L
**
63
-
1
]
+
[
0
,
0
,
1
,
2
**
63
-
1
]
+
[
0.
,
1.
,
1.1
,
1.5
]):
[
0.
,
1.
,
1.1
,
1.5
]):
n_x
=
numpy
.
asarray
(
x
)
n_x
=
numpy
.
asarray
(
x
)
# Make sure the data type is the same as the one found by numpy.
# Make sure the data type is the same as the one found by numpy.
...
@@ -6055,7 +6055,7 @@ def _test_autocast_numpy_floatX():
...
@@ -6055,7 +6055,7 @@ def _test_autocast_numpy_floatX():
# into int64, as that is the maximal integer type that Theano
# into int64, as that is the maximal integer type that Theano
# supports, and that is the maximal type in Python indexing.
# supports, and that is the maximal type in Python indexing.
for
x
in
([
2
**
i
-
1
for
i
in
xrange
(
64
)]
+
for
x
in
([
2
**
i
-
1
for
i
in
xrange
(
64
)]
+
[
0
,
0
L
,
1L
,
2L
**
63
-
1
]
+
[
0
,
0
,
1
,
2
**
63
-
1
]
+
[
0.
,
1.
,
1.1
,
1.5
]):
[
0.
,
1.
,
1.1
,
1.5
]):
ok
(
x
,
floatX
)
ok
(
x
,
floatX
)
ok
(
-
x
,
floatX
)
ok
(
-
x
,
floatX
)
...
@@ -6215,7 +6215,7 @@ class test_arithmetic_cast(unittest.TestCase):
...
@@ -6215,7 +6215,7 @@ class test_arithmetic_cast(unittest.TestCase):
class
T_long_tensor
(
unittest
.
TestCase
):
class
T_long_tensor
(
unittest
.
TestCase
):
def
test_fit_int64
(
self
):
def
test_fit_int64
(
self
):
for
exp
in
xrange
(
64
):
for
exp
in
xrange
(
64
):
val
=
2
L
**
exp
-
1
val
=
2
**
exp
-
1
scalar_ct
=
constant
(
val
)
scalar_ct
=
constant
(
val
)
assert
scalar_ct
.
dtype
.
startswith
(
'int'
)
assert
scalar_ct
.
dtype
.
startswith
(
'int'
)
assert
scalar_ct
.
value
==
val
assert
scalar_ct
.
value
==
val
...
@@ -6229,7 +6229,7 @@ class T_long_tensor(unittest.TestCase):
...
@@ -6229,7 +6229,7 @@ class T_long_tensor(unittest.TestCase):
assert
numpy
.
all
(
matrix_ct
.
value
==
val
)
assert
numpy
.
all
(
matrix_ct
.
value
==
val
)
def
test_too_big
(
self
):
def
test_too_big
(
self
):
val
=
2
L
**
63
val
=
2
**
63
# NumPy 1.7 this will raise an exception
# NumPy 1.7 this will raise an exception
# NumPy 1.7.1 this will work
# NumPy 1.7.1 this will work
try
:
try
:
...
@@ -6256,7 +6256,7 @@ class T_long_tensor(unittest.TestCase):
...
@@ -6256,7 +6256,7 @@ class T_long_tensor(unittest.TestCase):
except
TypeError
:
except
TypeError
:
pass
pass
val
=
2
L
**
64
val
=
2
**
64
# This fail for all NumPy version.
# This fail for all NumPy version.
self
.
assertRaises
(
Exception
,
constant
,
val
)
self
.
assertRaises
(
Exception
,
constant
,
val
)
self
.
assertRaises
(
Exception
,
constant
,
[
val
,
val
])
self
.
assertRaises
(
Exception
,
constant
,
[
val
,
val
])
...
...
theano/tensor/tests/test_subtensor.py
浏览文件 @
4156fa01
...
@@ -303,7 +303,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
...
@@ -303,7 +303,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
def
test_long
(
self
):
def
test_long
(
self
):
n
=
self
.
shared
(
numpy
.
arange
(
12
,
dtype
=
self
.
dtype
)
.
reshape
((
4
,
3
)))
n
=
self
.
shared
(
numpy
.
arange
(
12
,
dtype
=
self
.
dtype
)
.
reshape
((
4
,
3
)))
t
=
n
[
1
L
:
4L
:
2L
,
1L
]
t
=
n
[
1
:
4
:
2
,
1
]
self
.
assertTrue
(
isinstance
(
t
.
owner
.
op
,
Subtensor
))
self
.
assertTrue
(
isinstance
(
t
.
owner
.
op
,
Subtensor
))
tval
=
self
.
eval_output_and_check
(
t
)
tval
=
self
.
eval_output_and_check
(
t
)
self
.
assertTrue
(
tval
.
shape
==
(
2
,))
self
.
assertTrue
(
tval
.
shape
==
(
2
,))
...
@@ -313,7 +313,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
...
@@ -313,7 +313,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
# Currently, we cast Python longs to int64 when used for indexing.
# Currently, we cast Python longs to int64 when used for indexing.
# This test checks that using a long that does not fit raises an error.
# This test checks that using a long that does not fit raises an error.
n
=
self
.
shared
(
numpy
.
arange
(
12
,
dtype
=
self
.
dtype
)
.
reshape
((
4
,
3
)))
n
=
self
.
shared
(
numpy
.
arange
(
12
,
dtype
=
self
.
dtype
)
.
reshape
((
4
,
3
)))
self
.
assertRaises
(
Exception
,
lambda
:
n
[:(
2
L
**
63
)])
self
.
assertRaises
(
Exception
,
lambda
:
n
[:(
2
**
63
)])
def
test_list_slice
(
self
):
def
test_list_slice
(
self
):
x
=
theano
.
tensor
.
arange
(
100
)
.
reshape
((
5
,
5
,
4
))
x
=
theano
.
tensor
.
arange
(
100
)
.
reshape
((
5
,
5
,
4
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论