Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
aa14269f
提交
aa14269f
authored
5月 31, 2017
作者:
Adam Becker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add back return_[values/indices]
because __props__ should be read only
上级
73197e70
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
11 行删除
+24
-11
sort.py
theano/gpuarray/sort.py
+14
-8
sort.py
theano/tensor/sort.py
+10
-3
没有找到文件。
theano/gpuarray/sort.py
浏览文件 @
aa14269f
...
@@ -30,13 +30,17 @@ class GpuTopKOp(GpuKernelBase, TopKOp):
...
@@ -30,13 +30,17 @@ class GpuTopKOp(GpuKernelBase, TopKOp):
__props__
=
TopKOp
.
__props__
__props__
=
TopKOp
.
__props__
_f16_ok
=
True
_f16_ok
=
True
def
__init__
(
self
,
axis
=-
1
,
idx_dtype
=
'int64'
):
def
__init__
(
self
,
axis
=-
1
,
idx_dtype
=
'int64'
,
return_values
=
True
,
return_indices
=
True
):
GpuKernelBase
.
__init__
(
self
)
GpuKernelBase
.
__init__
(
self
)
TopKOp
.
__init__
(
TopKOp
.
__init__
(
self
,
axis
=
axis
,
self
,
axis
=
axis
,
idx_dtype
=
idx_dtype
)
idx_dtype
=
idx_dtype
,
self
.
return_values
=
True
return_values
=
return_values
,
self
.
return_indices
=
True
return_indices
=
return_indices
)
def
c_headers
(
self
):
def
c_headers
(
self
):
return
[
'gpuarray_api.h'
,
'gpuarray_helper.h'
,
'numpy_compat.h'
]
return
[
'gpuarray_api.h'
,
'gpuarray_helper.h'
,
'numpy_compat.h'
]
...
@@ -291,8 +295,10 @@ def local_gpua_topkop(op, ctx_name, inputs, outputs):
...
@@ -291,8 +295,10 @@ def local_gpua_topkop(op, ctx_name, inputs, outputs):
x
,
k
=
inputs
x
,
k
=
inputs
x
=
as_gpuarray_variable
(
x
,
ctx_name
)
x
=
as_gpuarray_variable
(
x
,
ctx_name
)
op
=
GpuTopKOp
(
axis
=
axis
,
idx_dtype
=
op
.
idx_dtype
)
gpu_op
=
GpuTopKOp
(
op
.
return_values
=
rv
axis
=
axis
,
op
.
return_indices
=
ri
idx_dtype
=
op
.
idx_dtype
,
rets
=
op
(
x
,
k
)
return_values
=
rv
,
return_indices
=
ri
)
rets
=
gpu_op
(
x
,
k
)
return
rets
return
rets
theano/tensor/sort.py
浏览文件 @
aa14269f
...
@@ -342,16 +342,23 @@ class TopKOp(theano.Op):
...
@@ -342,16 +342,23 @@ class TopKOp(theano.Op):
def
__init__
(
def
__init__
(
self
,
self
,
axis
=-
1
,
axis
=-
1
,
idx_dtype
=
'int64'
):
idx_dtype
=
'int64'
,
return_values
=
True
,
return_indices
=
True
):
if
not
isinstance
(
axis
,
int
):
if
not
isinstance
(
axis
,
int
):
raise
TypeError
(
raise
TypeError
(
'"axis" parameter must be integer, got "
%
s"'
%
type
(
axis
))
'"axis" parameter must be integer, got "
%
s"'
%
type
(
axis
))
if
idx_dtype
not
in
theano
.
tensor
.
integer_dtypes
:
if
idx_dtype
not
in
theano
.
tensor
.
integer_dtypes
:
raise
TypeError
(
raise
TypeError
(
'"idx_dtype" parameter must be an integer dtype, got "
%
s"'
%
idx_dtype
)
'"idx_dtype" parameter must be an integer dtype, got "
%
s"'
%
idx_dtype
)
if
not
(
return_indices
or
return_values
):
raise
ValueError
(
"Neither return_values nor return_indices is True, this isn't allowd"
)
self
.
axis
=
axis
self
.
axis
=
axis
self
.
return_
indices
=
True
self
.
return_
values
=
return_values
self
.
return_
values
=
True
self
.
return_
indices
=
return_indices
self
.
idx_dtype
=
idx_dtype
self
.
idx_dtype
=
idx_dtype
def
__str__
(
self
):
def
__str__
(
self
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论