Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
46eaf9df
提交
46eaf9df
authored
12月 02, 2016
作者:
Reyhane Askari
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
unstable commit-fixed perform on gpujoin
上级
98a120b4
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
34 行增加
和
5 行删除
+34
-5
basic_ops.py
theano/gpuarray/basic_ops.py
+34
-5
没有找到文件。
theano/gpuarray/basic_ops.py
浏览文件 @
46eaf9df
...
@@ -1245,8 +1245,27 @@ class GpuJoin(HideC, Join):
...
@@ -1245,8 +1245,27 @@ class GpuJoin(HideC, Join):
"""
"""
_f16_ok
=
True
_f16_ok
=
True
__props__
=
(
"view"
,)
params_type
=
gpu_context_type
params_type
=
gpu_context_type
def
__init__
(
self
,
view
=-
1
):
self
.
view
=
view
if
view
!=
-
1
:
# since the first input is always the axis, the tensors
# start from index 1.
self
.
view_map
=
{
0
:
[
1
+
view
]}
# def __str__(self):
# if self.view == -1:
# return "Join"
# else:
# return super(Join, self).__str__()
# def __setstate__(self, d):
# self.__dict__.update(d)
# if not hasattr(self, "view"):
# self.view = -1
def
make_node
(
self
,
axis
,
*
tensors
):
def
make_node
(
self
,
axis
,
*
tensors
):
node
=
Join
.
make_node
(
self
,
axis
,
*
tensors
)
node
=
Join
.
make_node
(
self
,
axis
,
*
tensors
)
...
@@ -1265,26 +1284,36 @@ class GpuJoin(HideC, Join):
...
@@ -1265,26 +1284,36 @@ class GpuJoin(HideC, Join):
def
perform
(
self
,
node
,
axis_and_tensors
,
out_
,
ctx
):
def
perform
(
self
,
node
,
axis_and_tensors
,
out_
,
ctx
):
out
,
=
out_
out
,
=
out_
view
=
self
.
view
axis
=
int
(
axis_and_tensors
[
0
])
axis
=
int
(
axis_and_tensors
[
0
])
tensors
=
axis_and_tensors
[
1
:]
if
axis
<
-
axis_and_tensors
[
1
]
.
ndim
:
if
axis
<
-
axis_and_tensors
[
1
]
.
ndim
:
raise
IndexError
raise
IndexError
if
axis
<
0
:
if
axis
<
0
:
axis
+=
axis_and_tensors
[
1
]
.
ndim
axis
+=
axis_and_tensors
[
1
]
.
ndim
tensors
=
axis_and_tensors
[
1
:]
# we check these tensors for being empty.
out
[
0
]
=
pygpu
.
concatenate
(
tensors
,
axis
=
axis
,
context
=
ctx
)
.
astype
(
if
(
view
!=
-
1
)
and
numpy
.
all
(
node
.
outputs
[
0
]
.
dtype
)
[
tensor
.
shape
[
axis
]
==
0
for
tensor
in
tensors
[
0
:
view
]
+
tensors
[
view
+
1
:]]):
import
ipdb
;
ipdb
.
set_trace
()
out
[
0
]
=
tensors
[
view
]
else
:
out
[
0
]
=
pygpu
.
concatenate
(
tensors
,
axis
=
axis
,
context
=
ctx
)
.
astype
(
node
.
outputs
[
0
]
.
dtype
)
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
return
(
2
,)
return
(
2
,)
def
c_support_code
(
self
):
def
c_support_code
_
(
self
):
return
"""
return
"""
#if PY_MAJOR_VERSION >= 3
#if PY_MAJOR_VERSION >= 3
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AsLong PyLong_AsLong
#endif
#endif
"""
"""
def
c_code
(
self
,
node
,
name
,
inputs
,
out_
,
sub
):
def
c_code
_
(
self
,
node
,
name
,
inputs
,
out_
,
sub
):
copy_to_list
=
[]
copy_to_list
=
[]
restype
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
restype
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
for
i
,
inp
in
enumerate
(
inputs
[
1
:]):
for
i
,
inp
in
enumerate
(
inputs
[
1
:]):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论