Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e9ff60c2
提交
e9ff60c2
authored
4月 05, 2017
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Even more test fixes
上级
df97d8e6
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
24 行增加
和
25 行删除
+24
-25
test_type.py
theano/gpuarray/tests/test_type.py
+11
-7
basic_scipy.py
theano/scalar/basic_scipy.py
+1
-0
test_sharedvar.py
theano/tensor/tests/test_sharedvar.py
+12
-18
没有找到文件。
theano/gpuarray/tests/test_type.py
浏览文件 @
e9ff60c2
...
@@ -79,8 +79,9 @@ def test_unpickle_gpuarray_as_numpy_ndarray_flag0():
...
@@ -79,8 +79,9 @@ def test_unpickle_gpuarray_as_numpy_ndarray_flag0():
finally
:
finally
:
config
.
experimental
.
unpickle_gpu_on_cpu
=
oldflag
config
.
experimental
.
unpickle_gpu_on_cpu
=
oldflag
# These tests are disabled because they expect the impossible
test_shared_options
=
makeSharedTester
(
"""
@makeSharedTester(
shared_constructor_=gpuarray_shared_constructor,
shared_constructor_=gpuarray_shared_constructor,
dtype_=theano.config.floatX,
dtype_=theano.config.floatX,
get_value_borrow_true_alias_=True,
get_value_borrow_true_alias_=True,
...
@@ -95,11 +96,12 @@ test_shared_options = makeSharedTester(
...
@@ -95,11 +96,12 @@ test_shared_options = makeSharedTester(
theano_fct_=theano.tensor.exp,
theano_fct_=theano.tensor.exp,
ref_fct_=np.exp,
ref_fct_=np.exp,
cast_value_=lambda v: pygpu.array(v, context=get_context(test_ctx_name),
cast_value_=lambda v: pygpu.array(v, context=get_context(test_ctx_name),
cls
=
pygpu
.
_array
.
ndgpuarray
),
cls=pygpu._array.ndgpuarray))
name
=
'test_shared_options'
)
class test_shared_options(object):
pass
test_shared_options2
=
makeSharedTester
(
@
makeSharedTester(
shared_constructor_=gpuarray_shared_constructor,
shared_constructor_=gpuarray_shared_constructor,
dtype_=theano.config.floatX,
dtype_=theano.config.floatX,
get_value_borrow_true_alias_=False,
get_value_borrow_true_alias_=False,
...
@@ -114,5 +116,7 @@ test_shared_options2 = makeSharedTester(
...
@@ -114,5 +116,7 @@ test_shared_options2 = makeSharedTester(
theano_fct_=theano.tensor.exp,
theano_fct_=theano.tensor.exp,
ref_fct_=np.exp,
ref_fct_=np.exp,
cast_value_=lambda v: pygpu.array(v, context=get_context(test_ctx_name),
cast_value_=lambda v: pygpu.array(v, context=get_context(test_ctx_name),
cls
=
pygpu
.
_array
.
ndgpuarray
),
cls=pygpu._array.ndgpuarray))
name
=
'test_shared_options2'
)
class test_shared_options2(object):
pass
"""
theano/scalar/basic_scipy.py
浏览文件 @
e9ff60c2
...
@@ -304,6 +304,7 @@ class Psi(UnaryScalarOp):
...
@@ -304,6 +304,7 @@ class Psi(UnaryScalarOp):
#ifndef ga_double
#ifndef ga_double
#define ga_double double
#define ga_double double
#endif
#ifndef _PSIFUNCDEFINED
#ifndef _PSIFUNCDEFINED
#define _PSIFUNCDEFINED
#define _PSIFUNCDEFINED
...
...
theano/tensor/tests/test_sharedvar.py
浏览文件 @
e9ff60c2
from
__future__
import
absolute_import
,
print_function
,
division
from
__future__
import
absolute_import
,
print_function
,
division
import
numpy
as
np
import
numpy
as
np
import
unittest
import
unittest
import
warnings
from
functools
import
update_wrapper
import
theano
import
theano
from
theano
import
tensor
from
theano
import
tensor
...
@@ -25,7 +25,6 @@ def makeSharedTester(shared_constructor_,
...
@@ -25,7 +25,6 @@ def makeSharedTester(shared_constructor_,
theano_fct_
,
theano_fct_
,
ref_fct_
,
ref_fct_
,
cast_value_
=
np
.
asarray
,
cast_value_
=
np
.
asarray
,
name
=
None
,
):
):
"""
"""
This is a generic fct to allow reusing the same test function
This is a generic fct to allow reusing the same test function
...
@@ -197,9 +196,7 @@ def makeSharedTester(shared_constructor_,
...
@@ -197,9 +196,7 @@ def makeSharedTester(shared_constructor_,
assert
not
np
.
allclose
(
self
.
ref_fct
(
x
),
total_func
())
assert
not
np
.
allclose
(
self
.
ref_fct
(
x
),
total_func
())
def
test_get_value
(
self
):
def
test_get_value
(
self
):
"""
# Test that get_value returns a ndarray
Test that get_value return the same type as what was gived when creating the shared variable
"""
dtype
=
self
.
dtype
dtype
=
self
.
dtype
if
dtype
is
None
:
if
dtype
is
None
:
dtype
=
theano
.
config
.
floatX
dtype
=
theano
.
config
.
floatX
...
@@ -209,10 +206,9 @@ def makeSharedTester(shared_constructor_,
...
@@ -209,10 +206,9 @@ def makeSharedTester(shared_constructor_,
x_cast
=
self
.
cast_value
(
x_orig
)
x_cast
=
self
.
cast_value
(
x_orig
)
if
self
.
shared_constructor_accept_ndarray
:
if
self
.
shared_constructor_accept_ndarray
:
x_shared
=
self
.
shared_constructor
(
x_orig
,
borrow
=
False
)
x_shared
=
self
.
shared_constructor
(
x_orig
,
borrow
=
False
)
assert
isinstance
(
x_shared
.
get_value
(),
x_orig
.
__class__
)
else
:
x_shared
=
self
.
shared_constructor
(
x_cast
,
borrow
=
False
)
x_shared
=
self
.
shared_constructor
(
x_cast
,
borrow
=
False
)
assert
isinstance
(
x_shared
.
get_value
(),
x_orig
.
__class__
)
assert
isinstance
(
x_shared
.
get_value
(),
x_cast
.
__class__
)
def
test_set_value
(
self
):
def
test_set_value
(
self
):
dtype
=
self
.
dtype
dtype
=
self
.
dtype
...
@@ -573,14 +569,11 @@ def makeSharedTester(shared_constructor_,
...
@@ -573,14 +569,11 @@ def makeSharedTester(shared_constructor_,
assert
not
x_shared
.
type
.
values_eq
(
x
,
y
)
assert
not
x_shared
.
type
.
values_eq
(
x
,
y
)
assert
not
x_shared
.
type
.
values_eq_approx
(
x
,
y
)
assert
not
x_shared
.
type
.
values_eq_approx
(
x
,
y
)
assert
name
is
not
None
def
f
(
cls
):
SharedTester
.
__name__
=
name
return
update_wrapper
(
SharedTester
,
cls
,
updated
=
())
if
hasattr
(
SharedTester
,
'__qualname__'
):
return
f
SharedTester
.
__qualname__
=
name
return
SharedTester
test_shared_options
=
makeSharedTester
(
@
makeSharedTester
(
shared_constructor_
=
tensor
.
_shared
,
shared_constructor_
=
tensor
.
_shared
,
dtype_
=
theano
.
config
.
floatX
,
dtype_
=
theano
.
config
.
floatX
,
get_value_borrow_true_alias_
=
True
,
get_value_borrow_true_alias_
=
True
,
...
@@ -593,8 +586,9 @@ test_shared_options = makeSharedTester(
...
@@ -593,8 +586,9 @@ test_shared_options = makeSharedTester(
test_internal_type_
=
lambda
a
:
isinstance
(
a
,
np
.
ndarray
),
test_internal_type_
=
lambda
a
:
isinstance
(
a
,
np
.
ndarray
),
theano_fct_
=
lambda
a
:
a
*
2
,
theano_fct_
=
lambda
a
:
a
*
2
,
ref_fct_
=
lambda
a
:
np
.
asarray
((
a
*
2
)),
ref_fct_
=
lambda
a
:
np
.
asarray
((
a
*
2
)),
cast_value_
=
np
.
asarray
,
cast_value_
=
np
.
asarray
)
name
=
'test_shared_options'
)
class
test_shared_options
(
object
):
pass
def
test_scalar_shared_options
():
def
test_scalar_shared_options
():
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论