Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
172c047c
提交
172c047c
authored
4月 20, 2017
作者:
Pascal Lamblin
提交者:
GitHub
4月 20, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5870 from lamblin/fix_5869
Prevent gpu initialization when not required
上级
318dd6af
751dc281
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
8 行增加
和
6 行删除
+8
-6
config.py
theano/gpuarray/tests/config.py
+2
-1
test_cgpukernelbase.py
theano/gpuarray/tests/test_cgpukernelbase.py
+6
-5
没有找到文件。
theano/gpuarray/tests/config.py
浏览文件 @
172c047c
...
@@ -8,7 +8,8 @@ if theano.gpuarray.pygpu is None:
...
@@ -8,7 +8,8 @@ if theano.gpuarray.pygpu is None:
raise
SkipTest
(
"pygpu not installed"
)
raise
SkipTest
(
"pygpu not installed"
)
if
(
not
theano
.
gpuarray
.
pygpu_activated
and
if
(
not
theano
.
gpuarray
.
pygpu_activated
and
not
theano
.
config
.
init_gpu_device
.
startswith
(
'gpu'
)):
not
theano
.
config
.
init_gpu_device
.
startswith
(
'gpu'
)
and
not
theano
.
config
.
force_device
):
theano
.
gpuarray
.
init_dev
(
'cuda'
)
theano
.
gpuarray
.
init_dev
(
'cuda'
)
if
not
theano
.
gpuarray
.
pygpu_activated
:
if
not
theano
.
gpuarray
.
pygpu_activated
:
...
...
theano/gpuarray/tests/test_cgpukernelbase.py
浏览文件 @
172c047c
...
@@ -6,15 +6,10 @@ import theano
...
@@ -6,15 +6,10 @@ import theano
from
theano
import
tensor
,
config
,
Apply
,
Op
from
theano
import
tensor
,
config
,
Apply
,
Op
from
theano.gradient
import
grad_undefined
from
theano.gradient
import
grad_undefined
from
.config
import
mode_with_gpu
,
test_ctx_name
from
..basic_ops
import
CGpuKernelBase
from
..basic_ops
import
CGpuKernelBase
from
..type
import
GpuArrayType
,
get_context
from
..type
import
GpuArrayType
,
get_context
from
pygpu.gpuarray
import
dtype_to_typecode
# This is an implementation to test that CGpuKernelBase works and also
# This is an implementation to test that CGpuKernelBase works and also
# to use as an example in the docs. It is not used for user graphs.
# to use as an example in the docs. It is not used for user graphs.
class
GpuEye
(
CGpuKernelBase
,
Op
):
class
GpuEye
(
CGpuKernelBase
,
Op
):
...
@@ -58,10 +53,16 @@ class GpuEye(CGpuKernelBase, Op):
...
@@ -58,10 +53,16 @@ class GpuEye(CGpuKernelBase, Op):
for
i
in
xrange
(
2
)]
for
i
in
xrange
(
2
)]
def
get_op_params
(
self
):
def
get_op_params
(
self
):
from
pygpu.gpuarray
import
dtype_to_typecode
return
[(
'TYPECODE'
,
str
(
dtype_to_typecode
(
self
.
dtype
)))]
return
[(
'TYPECODE'
,
str
(
dtype_to_typecode
(
self
.
dtype
)))]
def
test_cgpukernelbase
():
def
test_cgpukernelbase
():
# Import inside the function to prevent the back-end from being
# initialized when reloading the GpuEye object from cache.
from
.config
import
mode_with_gpu
,
test_ctx_name
op
=
GpuEye
(
dtype
=
'int32'
,
context_name
=
test_ctx_name
)
op
=
GpuEye
(
dtype
=
'int32'
,
context_name
=
test_ctx_name
)
f
=
theano
.
function
([],
op
(
4
,
5
),
mode
=
mode_with_gpu
)
f
=
theano
.
function
([],
op
(
4
,
5
),
mode
=
mode_with_gpu
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论