Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
NiuTrans.Tensor
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
8
Issues
8
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
NiuTrans
NiuTrans.Tensor
Commits
467c2ed7
Commit
467c2ed7
authored
Oct 17, 2019
by
张裕浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reduceMin operation using #define
parent
c9ef15f8
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
26 行增加
和
0 行删除
+26
-0
source/tensor/core/reduce/ReduceMax.cpp
+0
-0
source/tensor/core/reduce/ReduceMax.cu
+0
-0
source/tensor/core/reduce/ReduceMax.cuh
+3
-0
source/tensor/core/reduce/ReduceMax.h
+9
-0
source/tensor/core/reduce/VectorBuffer.cpp
+10
-0
source/tensor/core/reduce/VectorBuffer.h
+4
-0
没有找到文件。
source/tensor/core/reduce/ReduceMax.cpp
查看文件 @
467c2ed7
差异被折叠。
点击展开。
source/tensor/core/reduce/ReduceMax.cu
查看文件 @
467c2ed7
差异被折叠。
点击展开。
source/tensor/core/reduce/ReduceMax.cuh
查看文件 @
467c2ed7
...
...
@@ -31,6 +31,9 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
/* get the max-valued items along a dimension of the tensor (cuda version) */
void _CudaReduceMax(const XTensor * input, XTensor * output, int dim);
/* get the min-valued items along a dimension of the tensor (cuda version) */
void _CudaReduceMin(const XTensor * input, XTensor * output, int dim);
#endif // USE_CUDA
} // namespace nts(NiuTrans.Tensor)
...
...
source/tensor/core/reduce/ReduceMax.h
查看文件 @
467c2ed7
...
...
@@ -29,12 +29,21 @@ namespace nts{ // namespace nts(NiuTrans.Tensor)
/* get the max value of the items along a dimension of the tensor. */
void
_ReduceMax
(
const
XTensor
*
input
,
XTensor
*
output
,
int
dim
);
/* get the min value of the items along a dimension of the tensor. */
void
_ReduceMin
(
const
XTensor
*
input
,
XTensor
*
output
,
int
dim
);
/*
get the max value of the items along a dimension of the tensor (return an XTensor structure)
make a new tensor to keep the result and return it
*/
XTensor
ReduceMax
(
const
XTensor
&
input
,
int
dim
);
/*
get the min value of the items along a dimension of the tensor (return an XTensor structure)
make a new tensor to keep the result and return it
*/
XTensor
ReduceMin
(
const
XTensor
&
input
,
int
dim
);
}
// namespace nts(NiuTrans.Tensor)
#endif // __REDUCEMAX_H__
source/tensor/core/reduce/VectorBuffer.cpp
查看文件 @
467c2ed7
...
...
@@ -168,4 +168,13 @@ VectorBuffer VectorBuffer::maxData(const VectorBuffer &a) {
return
*
this
;
}
/* conculte the max of two buffer */
VectorBuffer
VectorBuffer
::
minData
(
const
VectorBuffer
&
a
)
{
for
(
int
i
=
0
;
i
!=
a
.
size
();
i
++
)
{
this
->
values
[
i
]
=
MIN
(
a
[
i
],
this
->
values
[
i
]);
printf
(
"runhere"
);
}
return
*
this
;
}
}
/* end of the nts (NiuTrans.Tensor) namespace */
\ No newline at end of file
source/tensor/core/reduce/VectorBuffer.h
查看文件 @
467c2ed7
...
...
@@ -48,5 +48,8 @@ public:
/* conculte the max of two buffer */
VectorBuffer
maxData
(
const
VectorBuffer
&
a
);
/* conculte the max of two buffer */
VectorBuffer
minData
(
const
VectorBuffer
&
a
);
};
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论