Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
fc65ba59
提交
fc65ba59
authored
11月 05, 2011
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added tests of some assumptions made on Numpy
上级
50a4ab3d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
32 行增加
和
1 行删除
+32
-1
test_basic.py
theano/tensor/tests/test_basic.py
+32
-1
没有找到文件。
theano/tensor/tests/test_basic.py
浏览文件 @
fc65ba59
...
...
@@ -5,7 +5,7 @@ import StringIO
import
sys
import
unittest
import
warnings
from
copy
import
copy
from
copy
import
copy
,
deepcopy
from
nose.plugins.skip
import
SkipTest
import
numpy
...
...
@@ -5141,6 +5141,37 @@ class test_size(unittest.TestCase):
assert
y
.
size
==
function
([],
x
.
size
)()
class
test_numpy_assumptions
(
unittest
.
TestCase
):
"""
Verify that some assumptions Theano makes on Numpy's behavior still hold.
"""
def
test_ndarray_copy
(
self
):
"""
A copy or deepcopy of the ndarray type should not create a new object.
This is because Theano makes some comparisons of the form:
if type(x) is numpy.ndarray
"""
assert
copy
(
numpy
.
ndarray
)
is
numpy
.
ndarray
assert
deepcopy
(
numpy
.
ndarray
)
is
numpy
.
ndarray
def
test_dtype_equality
(
self
):
"""
Ensure dtype string comparisons are consistent.
Theano often uses string representations of dtypes (e.g. 'float32'). We
need to make sure that comparing the string representations is the same
as comparing the dtype objects themselves.
"""
dtypes
=
get_numeric_types
(
with_complex
=
True
)
# Perform all pairwise comparisons of dtypes, making sure comparing
# their string representation yields the same result.
for
dtype1_idx
,
dtype1
in
enumerate
(
dtypes
):
for
dtype2
in
dtypes
[
dtype1_idx
+
1
:]:
assert
(
dtype1
==
dtype2
)
==
(
str
(
dtype1
)
==
str
(
dtype2
))
if
__name__
==
'__main__'
:
if
0
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论