Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
649b9361
提交
649b9361
authored
9月 12, 2017
作者:
Yikang Shen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test MRG random stream with device=cuda and target=cpu, shared variable +…
test MRG random stream with device=cuda and target=cpu, shared variable + computation in a real model stay on CPU. #6382
上级
404cea07
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
3 行删除
+20
-3
rng_mrg.py
theano/gpuarray/rng_mrg.py
+4
-2
test_rng_mrg.py
theano/sandbox/tests/test_rng_mrg.py
+16
-1
没有找到文件。
theano/gpuarray/rng_mrg.py
浏览文件 @
649b9361
...
@@ -14,7 +14,7 @@ from theano.tensor import as_tensor_variable, get_vector_length
...
@@ -14,7 +14,7 @@ from theano.tensor import as_tensor_variable, get_vector_length
from
theano.scalar
import
int32
as
int_t
from
theano.scalar
import
int32
as
int_t
from
.basic_ops
import
(
GpuKernelBase
,
Kernel
,
infer_context_name
,
from
.basic_ops
import
(
GpuKernelBase
,
Kernel
,
infer_context_name
,
host_from_gpu
,
as_gpuarray_variable
)
GpuFromHost
,
host_from_gpu
,
as_gpuarray_variable
)
from
.type
import
GpuArrayType
,
gpu_context_type
from
.type
import
GpuArrayType
,
gpu_context_type
from
.fp16_help
import
write_w
from
.fp16_help
import
write_w
from
.opt
import
register_opt
,
register_opt2
from
.opt
import
register_opt
,
register_opt2
...
@@ -309,7 +309,9 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
...
@@ -309,7 +309,9 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
@register_opt2
([
mrg_uniform
],
'fast_compile'
)
@register_opt2
([
mrg_uniform
],
'fast_compile'
)
def
local_gpua_mrg_graph
(
op
,
context_name
,
inputs
,
outputs
):
def
local_gpua_mrg_graph
(
op
,
context_name
,
inputs
,
outputs
):
if
(
type
(
op
)
==
mrg_uniform
and
if
(
type
(
op
)
==
mrg_uniform
and
isinstance
(
inputs
[
0
]
.
type
,
GpuArrayType
)):
isinstance
(
inputs
[
0
]
.
type
,
GpuArrayType
)
and
not
isinstance
(
inputs
[
0
]
.
owner
.
op
,
GpuFromHost
)
):
outs
=
GPUA_mrg_uniform
.
new
(
inputs
[
0
],
outs
=
GPUA_mrg_uniform
.
new
(
inputs
[
0
],
op
.
output_type
.
ndim
,
op
.
output_type
.
ndim
,
op
.
output_type
.
dtype
,
op
.
output_type
.
dtype
,
...
...
theano/sandbox/tests/test_rng_mrg.py
浏览文件 @
649b9361
...
@@ -11,7 +11,7 @@ from six.moves import xrange
...
@@ -11,7 +11,7 @@ from six.moves import xrange
import
theano
import
theano
from
theano
import
change_flags
,
config
,
tensor
from
theano
import
change_flags
,
config
,
tensor
from
theano.sandbox
import
rng_mrg
from
theano.sandbox
import
rng_mrg
from
theano.sandbox.rng_mrg
import
MRG_RandomStreams
from
theano.sandbox.rng_mrg
import
MRG_RandomStreams
,
mrg_uniform
from
theano.tests
import
unittest_tools
as
utt
from
theano.tests
import
unittest_tools
as
utt
from
theano.tests.unittest_tools
import
attr
from
theano.tests.unittest_tools
import
attr
...
@@ -760,6 +760,21 @@ def test_target_parameter():
...
@@ -760,6 +760,21 @@ def test_target_parameter():
basic_target_parameter_test
(
srng
.
multinomial_wo_replacement
(
pvals
=
pvals
.
astype
(
'float32'
),
target
=
'cpu'
))
basic_target_parameter_test
(
srng
.
multinomial_wo_replacement
(
pvals
=
pvals
.
astype
(
'float32'
),
target
=
'cpu'
))
def
test_cpu_target_with_shared_variable
():
srng
=
MRG_RandomStreams
()
x
=
theano
.
shared
(
np
.
random
.
rand
(
2
,
3
)
.
astype
(
'float32'
),
name
=
'x'
)
y
=
srng
.
uniform
(
x
.
shape
,
target
=
'cpu'
)
y
.
name
=
'y'
z
=
(
x
*
y
)
.
sum
()
z
.
name
=
'z'
fz
=
theano
.
function
([],
z
)
nodes
=
fz
.
maker
.
fgraph
.
toposort
()
assert
any
([
isinstance
(
node
.
op
,
mrg_uniform
)
for
node
in
nodes
])
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
rng
=
MRG_RandomStreams
(
np
.
random
.
randint
(
2147462579
))
rng
=
MRG_RandomStreams
(
np
.
random
.
randint
(
2147462579
))
print
(
theano
.
__file__
)
print
(
theano
.
__file__
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论