Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6f424ab5
提交
6f424ab5
authored
8月 11, 2015
作者:
Iban Harlouchet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
numpydoc for theano/sandbox/gpuarray/subtensor.py
上级
8c4c9d67
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
50 行增加
和
16 行删除
+50
-16
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+50
-16
没有找到文件。
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
6f424ab5
...
...
@@ -163,12 +163,16 @@ class GpuIncSubtensor(IncSubtensor):
"""
Implement IncSubtensor on the gpu.
Note: The optimization to make this inplace is in tensor/opt.
Notes
-----
The optimization to make this inplace is in tensor/opt.
The same optimization handles IncSubtensor and GpuIncSubtensor.
This Op has c_code too; it inherits tensor.IncSubtensor's c_code.
The helper methods like do_type_checking, copy_of_x, etc. specialize
the c_code for this Op.
"""
@property
def
_f16_ok
(
self
):
return
self
.
iadd_node
.
op
.
_f16_ok
...
...
@@ -256,8 +260,10 @@ class GpuIncSubtensor(IncSubtensor):
return
d
def
do_type_checking
(
self
,
node
):
""" Should raise NotImplementedError if c_code does not support
"""
Should raise NotImplementedError if c_code does not support
the types involved in this node.
"""
if
not
isinstance
(
node
.
inputs
[
0
]
.
type
,
GpuArrayType
):
...
...
@@ -265,13 +271,21 @@ class GpuIncSubtensor(IncSubtensor):
def
copy_of_x
(
self
,
x
):
"""
:param x: a string giving the name of a C variable
pointing to an array
:return: C code expression to make a copy of x
Parameters
----------
x
A string giving the name of a C variable pointing to an array.
Returns
-------
C code expression to make a copy of x.
Notes
-----
Base class uses `PyArrayObject *`, subclasses may override for
different types of arrays.
"""
return
"""pygpu_copy(
%(x)
s, GA_ANY_ORDER)"""
%
locals
()
...
...
@@ -279,13 +293,18 @@ class GpuIncSubtensor(IncSubtensor):
return
"PyGpuArrayObject* zview = NULL;"
def
make_view_array
(
self
,
x
,
view_ndim
):
"""//TODO
:param x: a string identifying an array to be viewed
:param view_ndim: a string specifying the number of dimensions
to have in the view
"""
//TODO
Parameters
----------
x
A string identifying an array to be viewed.
view_ndim
A string specifying the number of dimensions to have in the view.
This doesn't need to actually set up the view with the
right indexing; we'll do that manually later.
"""
ret
=
"""
size_t dims[
%(view_ndim)
s];
...
...
@@ -305,18 +324,28 @@ class GpuIncSubtensor(IncSubtensor):
return
ret
def
get_helper_c_code_args
(
self
):
""" Return a dictionary of arguments to use with helper_c_code"""
"""
Return a dictionary of arguments to use with helper_c_code.
"""
return
{
'c_prefix'
:
'PyGpuArray'
,
'strides_mul'
:
1
}
def
copy_into
(
self
,
view
,
source
):
"""
view: string, C code expression for an array
source: string, C code expression for an array
returns a C code expression to copy source into view, and
return 0 on success
Parameters
----------
view : string
C code expression for an array.
source : string
C code expression for an array.
Returns
-------
C code expression to copy source into view, and 0 on success.
"""
return
"""GpuArray_setarray(&
%(view)
s->ga, &
%(source)
s->ga)"""
%
locals
()
...
...
@@ -365,7 +394,9 @@ class GpuIncSubtensor(IncSubtensor):
class
GpuAdvancedIncSubtensor1
(
HideC
,
tensor
.
AdvancedIncSubtensor1
):
"""
Implement AdvancedIncSubtensor1 on the gpu.
"""
def
make_node
(
self
,
x
,
y
,
ilist
):
x_
=
as_gpuarray_variable
(
x
)
y_
=
as_gpuarray_variable
(
y
)
...
...
@@ -454,9 +485,12 @@ class GpuAdvancedIncSubtensor1(HideC, tensor.AdvancedIncSubtensor1):
class
GpuAdvancedIncSubtensor1_dev20
(
GpuAdvancedIncSubtensor1
):
"""Implement AdvancedIncSubtensor1 on the gpu, but use function
"""
Implement AdvancedIncSubtensor1 on the gpu, but use function
only avail on compute capability 2.0 and more recent.
"""
_f16_ok
=
True
def
make_node
(
self
,
x
,
y
,
ilist
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论