Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f85f469d
提交
f85f469d
authored
12月 09, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
GpuIncSubtensor continued, not finished.
上级
3143c789
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
12 行删除
+13
-12
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+13
-12
没有找到文件。
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
f85f469d
...
...
@@ -168,17 +168,17 @@ class GpuIncSubtensor(HideC, IncSubtensor):
"""
def
make_node
(
self
,
x
,
y
,
*
inputs
):
x
=
as_
cuda_nd
array_variable
(
x
)
y
=
as_
cuda_nd
array_variable
(
y
)
x
=
as_
gpu
array_variable
(
x
)
y
=
as_
gpu
array_variable
(
y
)
rval
=
tensor
.
IncSubtensor
.
make_node
(
self
,
x
,
y
,
*
inputs
)
return
Apply
(
self
,
[
x
,
y
]
+
rval
.
inputs
[
2
:],
[
x
.
type
()])
return
gof
.
Apply
(
self
,
[
x
,
y
]
+
rval
.
inputs
[
2
:],
[
x
.
type
()])
def
do_type_checking
(
self
,
node
):
""" Should raise NotImplementedError if c_code does not support
the types involved in this node.
"""
if
not
isinstance
(
node
.
inputs
[
0
]
.
type
,
CudaNda
rrayType
):
if
not
isinstance
(
node
.
inputs
[
0
]
.
type
,
GpuA
rrayType
):
raise
NotImplementedError
()
def
copy_of_x
(
self
,
x
):
...
...
@@ -191,13 +191,13 @@ class GpuIncSubtensor(HideC, IncSubtensor):
Base class uses `PyArrayObject *`, subclasses may override for
different types of arrays.
"""
return
"""
(CudaNdarray*) CudaNdarray_Copy(
%(x)
s
)"""
%
locals
()
return
"""
pygpu_copy(
%(x)
s, GA_ANY_ORDER
)"""
%
locals
()
def
decl_view
(
self
):
return
"
CudaNda
rray* zview = NULL;"
return
"
PyGpuA
rray* 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
...
...
@@ -230,8 +230,8 @@ class GpuIncSubtensor(HideC, IncSubtensor):
def
get_helper_c_code_args
(
self
):
""" Return a dictionary of arguments to use with helper_c_code"""
return
{
'c_prefix'
:
'
CudaNda
rray'
,
'strides_mul'
:
4
return
{
'c_prefix'
:
'
PyGpuA
rray'
,
'strides_mul'
:
1
}
def
copy_into
(
self
,
view
,
source
):
...
...
@@ -242,10 +242,10 @@ class GpuIncSubtensor(HideC, IncSubtensor):
returns a C code expression to copy source into view, and
return 0 on success
"""
return
"""
CudaNdarray_CopyFromCudaNdarray
(
%(view)
s,
%(source)
s)"""
%
locals
()
return
"""
GpuArray_move
(
%(view)
s,
%(source)
s)"""
%
locals
()
def
set_view_base
(
self
,
x
,
fail
):
return
"""
return
"""
//TODO
//Set the base only now
if(CudaNdarray_set_device_data(zview, CudaNdarray_DEV_DATA(zview),
...
...
@@ -258,7 +258,7 @@ class GpuIncSubtensor(HideC, IncSubtensor):
}"""
%
locals
()
def
add_to_zview
(
self
,
x
,
fail
):
#TODO
return
"""
PyObject * add_result = CudaNdarray_inplace_add((PyObject *) zview,
(PyObject *) py_
%(x)
s);
...
...
@@ -275,6 +275,7 @@ class GpuIncSubtensor(HideC, IncSubtensor):
"""
%
locals
()
def
c_code_cache_version
(
self
):
return
()
parent_version
=
super
(
GpuIncSubtensor
,
self
)
.
c_code_cache_version
()
if
parent_version
:
return
parent_version
+
(
0
,)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论