Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5b6448e2
提交
5b6448e2
authored
9月 09, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Type context for test_basic_ops.py
上级
6dc2aac4
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
18 行删除
+13
-18
test_basic_ops.py
theano/sandbox/gpuarray/tests/test_basic_ops.py
+13
-18
没有找到文件。
theano/sandbox/gpuarray/tests/test_basic_ops.py
浏览文件 @
5b6448e2
...
...
@@ -14,22 +14,17 @@ from theano.tensor.tests import test_basic
from
theano.tensor.tests.test_basic
import
rand
,
safe_make_node
from
theano.tests
import
unittest_tools
as
utt
import
theano.sandbox.gpuarray
from
..type
import
(
GpuArrayType
,
from
..type
import
(
GpuArrayType
,
get_context
,
gpuarray_shared_constructor
)
from
..basic_ops
import
(
host_from_gpu
,
gpu_from_host
,
HostFromGpu
,
GpuFromHost
,
GpuReshape
,
gpu_alloc
,
GpuAlloc
,
GpuAllocEmpty
,
GpuContiguous
,
host_from_gpu
,
HostFromGpu
,
GpuFromHost
,
GpuReshape
,
GpuAlloc
,
GpuAllocEmpty
,
GpuContiguous
,
gpu_join
,
GpuJoin
,
GpuSplit
,
GpuEye
,
gpu_contiguous
)
from
..subtensor
import
GpuSubtensor
from
.config
import
mode_with_gpu
,
mode_without_gpu
from
.config
import
mode_with_gpu
,
mode_without_gpu
,
test_ctx_name
try
:
from
pygpu
import
gpuarray
except
:
pass
from
pygpu
import
gpuarray
utt
.
seed_rng
()
rng
=
numpy
.
random
.
RandomState
(
seed
=
utt
.
fetch_seed
())
...
...
@@ -176,7 +171,7 @@ def test_transfer_cpu_gpu():
av
=
numpy
.
asarray
(
rng
.
rand
(
5
,
4
),
dtype
=
'float32'
)
gv
=
gpuarray
.
array
(
av
)
f
=
theano
.
function
([
a
],
gpu_from_host
(
a
))
f
=
theano
.
function
([
a
],
GpuFromHost
(
None
)
(
a
))
fv
=
f
(
av
)
assert
GpuArrayType
.
values_eq
(
fv
,
gv
)
...
...
@@ -198,7 +193,7 @@ def test_transfer_strided():
av
=
av
[:,
::
2
]
gv
=
gv
[:,
::
2
]
f
=
theano
.
function
([
a
],
gpu_from_host
(
a
))
f
=
theano
.
function
([
a
],
GpuFromHost
(
None
)
(
a
))
fv
=
f
(
av
)
assert
GpuArrayType
.
values_eq
(
fv
,
gv
)
...
...
@@ -208,14 +203,14 @@ def test_transfer_strided():
def
gpu_alloc_expected
(
x
,
*
shp
):
g
=
gpuarray
.
empty
(
shp
,
dtype
=
x
.
dtype
)
g
=
gpuarray
.
empty
(
shp
,
dtype
=
x
.
dtype
,
context
=
get_context
(
test_ctx_name
)
)
g
[:]
=
x
return
g
GpuAllocTester
=
makeTester
(
name
=
"GpuAllocTester"
,
op
=
alloc
,
gpu_op
=
gpu_alloc
,
gpu_op
=
GpuAlloc
(
test_ctx_name
)
,
cases
=
dict
(
correct01
=
(
rand
(),
numpy
.
int32
(
7
)),
# just gives a DeepCopyOp with possibly wrong results on the CPU
...
...
@@ -413,10 +408,10 @@ def test_hostfromgpu_shape_i():
cv
=
gpuarray
.
asarray
(
numpy
.
random
.
rand
(
5
,
4
),
dtype
=
'float32'
)
f
=
theano
.
function
([
a
],
gpu_from_host
(
a
),
mode
=
m
)
assert
gpu_from_host
in
[
x
.
op
for
x
in
f
.
maker
.
fgraph
.
toposort
()]
f
=
theano
.
function
([
a
],
gpu_from_host
(
a
)
.
shape
,
mode
=
m
)
f
=
theano
.
function
([
a
],
GpuFromHost
(
None
)
(
a
),
mode
=
m
)
assert
any
([
isinstance
(
x
.
op
,
GpuFromHost
)
for
x
in
f
.
maker
.
fgraph
.
toposort
()])
f
=
theano
.
function
([
a
],
GpuFromHost
(
None
)
(
a
)
.
shape
,
mode
=
m
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
isinstance
(
topo
[
0
]
.
op
,
T
.
opt
.
Shape_i
)
assert
isinstance
(
topo
[
1
]
.
op
,
T
.
opt
.
Shape_i
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论