Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c67185bb
提交
c67185bb
authored
7月 05, 2017
作者:
notoraptor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Wrap op params for theano.gpuarray.blocksparse.GpuSparseBlockGemv.
上级
d7f7854a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
10 行增加
和
14 行删除
+10
-14
blockgemv.c
theano/gpuarray/blockgemv.c
+5
-5
blocksparse.py
theano/gpuarray/blocksparse.py
+5
-9
没有找到文件。
theano/gpuarray/blockgemv.c
浏览文件 @
c67185bb
...
@@ -4,19 +4,19 @@ int APPLY_SPECIFIC(blockgemv)(PyGpuArrayObject *o, PyGpuArrayObject *W,
...
@@ -4,19 +4,19 @@ int APPLY_SPECIFIC(blockgemv)(PyGpuArrayObject *o, PyGpuArrayObject *W,
PyGpuArrayObject
*
h
,
PyArrayObject
*
inputIdx
,
PyGpuArrayObject
*
h
,
PyArrayObject
*
inputIdx
,
PyArrayObject
*
outputIdx
,
PyArrayObject
*
outputIdx
,
PyGpuArrayObject
**
_out
,
PyGpuArrayObject
**
_out
,
P
yGpuContextObject
*
ctx
)
{
P
ARAMS_TYPE
*
params
)
{
PyGpuArrayObject
*
out
=
*
_out
;
PyGpuArrayObject
*
out
=
*
_out
;
#ifdef INPLACE
if
(
params
->
inplace
)
{
Py_XDECREF
(
out
);
Py_XDECREF
(
out
);
out
=
o
;
out
=
o
;
Py_INCREF
(
out
);
Py_INCREF
(
out
);
#else
}
else
{
out
=
theano_try_copy
(
out
,
o
);
out
=
theano_try_copy
(
out
,
o
);
if
(
out
==
NULL
)
{
if
(
out
==
NULL
)
{
// Error already set
// Error already set
return
-
1
;
return
-
1
;
}
}
#endif
}
gpudata
**
W_list
=
NULL
;
gpudata
**
W_list
=
NULL
;
gpudata
**
inp_list
=
NULL
;
gpudata
**
inp_list
=
NULL
;
...
@@ -26,7 +26,7 @@ int APPLY_SPECIFIC(blockgemv)(PyGpuArrayObject *o, PyGpuArrayObject *W,
...
@@ -26,7 +26,7 @@ int APPLY_SPECIFIC(blockgemv)(PyGpuArrayObject *o, PyGpuArrayObject *W,
size_t
*
offOut
=
NULL
;
size_t
*
offOut
=
NULL
;
int
err
;
int
err
;
err
=
gpublas_setup
(
ctx
->
ctx
);
err
=
gpublas_setup
(
params
->
context
->
ctx
);
if
(
err
!=
GA_NO_ERROR
)
{
if
(
err
!=
GA_NO_ERROR
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"Can't setup blas"
);
PyErr_SetString
(
PyExc_RuntimeError
,
"Can't setup blas"
);
return
-
1
;
return
-
1
;
...
...
theano/gpuarray/blocksparse.py
浏览文件 @
c67185bb
...
@@ -4,8 +4,9 @@ import os
...
@@ -4,8 +4,9 @@ import os
import
numpy
as
np
import
numpy
as
np
from
theano
import
Apply
,
tensor
from
theano
import
Apply
,
tensor
from
theano.gof
import
COp
from
theano.gof
import
COp
,
ParamsType
from
theano.tensor
import
discrete_dtypes
,
as_tensor_variable
from
theano.tensor
import
discrete_dtypes
,
as_tensor_variable
from
theano.scalar
import
bool
as
bool_t
from
theano.gradient
import
grad_undefined
from
theano.gradient
import
grad_undefined
...
@@ -25,7 +26,8 @@ class GpuSparseBlockGemv(COp):
...
@@ -25,7 +26,8 @@ class GpuSparseBlockGemv(COp):
function for a stable interface.
function for a stable interface.
"""
"""
__props__
=
(
'inplace'
,)
__props__
=
(
'inplace'
,)
params_type
=
gpu_context_type
params_type
=
ParamsType
(
inplace
=
bool_t
,
context
=
gpu_context_type
)
# NB: DTYPE_INPUT_* is used in C code, so I think we should not set check_input to False.
def
__init__
(
self
,
inplace
=
False
):
def
__init__
(
self
,
inplace
=
False
):
COp
.
__init__
(
self
,
"blockgemv.c"
,
"APPLY_SPECIFIC(blockgemv)"
)
COp
.
__init__
(
self
,
"blockgemv.c"
,
"APPLY_SPECIFIC(blockgemv)"
)
...
@@ -34,13 +36,7 @@ class GpuSparseBlockGemv(COp):
...
@@ -34,13 +36,7 @@ class GpuSparseBlockGemv(COp):
self
.
destroy_map
=
{
0
:
[
0
]}
self
.
destroy_map
=
{
0
:
[
0
]}
def
get_params
(
self
,
node
):
def
get_params
(
self
,
node
):
return
node
.
inputs
[
0
]
.
type
.
context
return
self
.
params_type
.
get_params
(
self
,
context
=
node
.
inputs
[
0
]
.
type
.
context
)
def
get_op_params
(
self
):
if
self
.
inplace
:
return
[(
'INPLACE'
,
'1'
)]
else
:
return
[]
def
c_header_dirs
(
self
):
def
c_header_dirs
(
self
):
return
[
os
.
path
.
dirname
(
__file__
)]
return
[
os
.
path
.
dirname
(
__file__
)]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论