Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f1366d58
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
f1366d58
编写于
12月 31, 2021
作者:
C
Chen Weihang
提交者:
GitHub
12月 31, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
replace contextt to context (#38619)
上级
a1275c8b
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
57 addition
and
57 deletion
+57
-57
paddle/pten/kernels/complex_kernel.h
paddle/pten/kernels/complex_kernel.h
+2
-2
paddle/pten/kernels/copy_kernel.h
paddle/pten/kernels/copy_kernel.h
+2
-2
paddle/pten/kernels/cpu/copy_kernel.cc
paddle/pten/kernels/cpu/copy_kernel.cc
+2
-2
paddle/pten/kernels/cpu/dot_kernel.cc
paddle/pten/kernels/cpu/dot_kernel.cc
+2
-2
paddle/pten/kernels/dot_kernel.h
paddle/pten/kernels/dot_kernel.h
+2
-2
paddle/pten/kernels/flatten_kernel.cc
paddle/pten/kernels/flatten_kernel.cc
+5
-5
paddle/pten/kernels/flatten_kernel.h
paddle/pten/kernels/flatten_kernel.h
+4
-4
paddle/pten/kernels/full_kernel.h
paddle/pten/kernels/full_kernel.h
+4
-4
paddle/pten/kernels/gpu/copy_kernel.cu
paddle/pten/kernels/gpu/copy_kernel.cu
+2
-2
paddle/pten/kernels/gpu/dot_kernel.cu
paddle/pten/kernels/gpu/dot_kernel.cu
+2
-2
paddle/pten/kernels/impl/complex_kernel_impl.h
paddle/pten/kernels/impl/complex_kernel_impl.h
+3
-3
paddle/pten/kernels/impl/full_kernel_impl.h
paddle/pten/kernels/impl/full_kernel_impl.h
+9
-9
paddle/pten/kernels/impl/scale_kernel_impl.h
paddle/pten/kernels/impl/scale_kernel_impl.h
+2
-2
paddle/pten/kernels/impl/sign_kernel_impl.h
paddle/pten/kernels/impl/sign_kernel_impl.h
+2
-2
paddle/pten/kernels/reshape_kernel.cc
paddle/pten/kernels/reshape_kernel.cc
+4
-4
paddle/pten/kernels/reshape_kernel.h
paddle/pten/kernels/reshape_kernel.h
+4
-4
paddle/pten/kernels/scale_kernel.h
paddle/pten/kernels/scale_kernel.h
+2
-2
paddle/pten/kernels/sign_kernel.h
paddle/pten/kernels/sign_kernel.h
+2
-2
paddle/pten/kernels/xpu/copy_kernel.cc
paddle/pten/kernels/xpu/copy_kernel.cc
+2
-2
未找到文件。
paddle/pten/kernels/complex_kernel.h
浏览文件 @
f1366d58
...
...
@@ -18,7 +18,7 @@ limitations under the License. */
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Conj
(
const
Context
T
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
);
template
<
typename
T
,
typename
Context
>
void
Conj
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
);
}
// namespace pten
paddle/pten/kernels/copy_kernel.h
浏览文件 @
f1366d58
...
...
@@ -18,8 +18,8 @@ limitations under the License. */
namespace
pten
{
template
<
typename
Context
T
>
void
Copy
(
const
Context
T
&
dev_ctx
,
template
<
typename
Context
>
void
Copy
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
src
,
bool
blocking
,
DenseTensor
*
dst
);
...
...
paddle/pten/kernels/cpu/copy_kernel.cc
浏览文件 @
f1366d58
...
...
@@ -25,8 +25,8 @@ limitations under the License. */
namespace
pten
{
// NOTE(chenweihang): blocking is useless in cpu kernel
template
<
typename
Context
T
>
void
Copy
(
const
Context
T
&
dev_ctx
,
template
<
typename
Context
>
void
Copy
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
src
,
bool
blocking
,
DenseTensor
*
dst
)
{
...
...
paddle/pten/kernels/cpu/dot_kernel.cc
浏览文件 @
f1366d58
...
...
@@ -22,8 +22,8 @@
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Dot
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
Dot
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
DenseTensor
&
y
,
DenseTensor
*
out
)
{
...
...
paddle/pten/kernels/dot_kernel.h
浏览文件 @
f1366d58
...
...
@@ -18,8 +18,8 @@
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Dot
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
Dot
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
DenseTensor
&
y
,
DenseTensor
*
out
);
...
...
paddle/pten/kernels/flatten_kernel.cc
浏览文件 @
f1366d58
...
...
@@ -21,8 +21,8 @@
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Flatten
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
Flatten
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
int
start_axis
,
int
stop_axis
,
...
...
@@ -35,14 +35,14 @@ void Flatten(const ContextT& dev_ctx,
// TODO(yuanrisheng): this kernel is for training and xshape is a Intermediate
// Output Tensor,
// is there a more flexible way to deal with this case?
template
<
typename
T
,
typename
Context
T
>
void
FlattenWithXShape
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
FlattenWithXShape
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
int
start_axis
,
int
stop_axis
,
DenseTensor
*
out
,
DenseTensor
*
xshape
)
{
Flatten
<
T
,
Context
T
>
(
dev_ctx
,
x
,
start_axis
,
stop_axis
,
out
);
Flatten
<
T
,
Context
>
(
dev_ctx
,
x
,
start_axis
,
stop_axis
,
out
);
funcs
::
SetXShape
(
x
,
xshape
);
}
...
...
paddle/pten/kernels/flatten_kernel.h
浏览文件 @
f1366d58
...
...
@@ -18,15 +18,15 @@ limitations under the License. */
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Flatten
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
Flatten
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
int
start_axis
,
int
stop_axis
,
DenseTensor
*
out
);
template
<
typename
T
,
typename
Context
T
>
void
FlattenWithXShape
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
FlattenWithXShape
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
int
start_axis
,
int
stop_axis
,
...
...
paddle/pten/kernels/full_kernel.h
浏览文件 @
f1366d58
...
...
@@ -20,13 +20,13 @@
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Full
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
Full
(
const
Context
&
dev_ctx
,
const
ScalarArray
&
shape
,
const
Scalar
&
val
,
DenseTensor
*
out
);
template
<
typename
T
,
typename
Context
T
>
void
FullLike
(
const
Context
T
&
dev_ctx
,
const
Scalar
&
val
,
DenseTensor
*
out
);
template
<
typename
T
,
typename
Context
>
void
FullLike
(
const
Context
&
dev_ctx
,
const
Scalar
&
val
,
DenseTensor
*
out
);
}
// namespace pten
paddle/pten/kernels/gpu/copy_kernel.cu
浏览文件 @
f1366d58
...
...
@@ -24,8 +24,8 @@ limitations under the License. */
namespace
pten
{
template
<
typename
Context
T
>
void
Copy
(
const
Context
T
&
dev_ctx
,
template
<
typename
Context
>
void
Copy
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
src
,
bool
blocking
,
DenseTensor
*
dst
)
{
...
...
paddle/pten/kernels/gpu/dot_kernel.cu
浏览文件 @
f1366d58
...
...
@@ -24,8 +24,8 @@
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Dot
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
Dot
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
DenseTensor
&
y
,
DenseTensor
*
out
)
{
...
...
paddle/pten/kernels/impl/complex_kernel_impl.h
浏览文件 @
f1366d58
...
...
@@ -20,13 +20,13 @@
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Conj
(
const
Context
T
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
)
{
template
<
typename
T
,
typename
Context
>
void
Conj
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
)
{
auto
numel
=
x
.
numel
();
auto
*
x_data
=
x
.
data
<
T
>
();
auto
*
out_data
=
out
->
mutable_data
<
T
>
();
paddle
::
platform
::
ForRange
<
Context
T
>
for_range
(
dev_ctx
,
numel
);
paddle
::
platform
::
ForRange
<
Context
>
for_range
(
dev_ctx
,
numel
);
paddle
::
operators
::
math
::
ConjFunctor
<
T
>
functor
(
x_data
,
numel
,
out_data
);
for_range
(
functor
);
}
...
...
paddle/pten/kernels/impl/full_kernel_impl.h
浏览文件 @
f1366d58
...
...
@@ -24,24 +24,24 @@ limitations under the License. */
namespace
pten
{
template
<
typename
Device
Context
,
typename
T
,
typename
VType
>
void
fill_
(
const
DeviceContext
&
context
,
DenseTensor
*
tensor
,
VType
val
)
{
template
<
typename
Context
,
typename
T
,
typename
VType
>
void
FullValue
(
const
Context
&
dev_ctx
,
DenseTensor
*
tensor
,
VType
val
)
{
tensor
->
mutable_data
<
T
>
();
auto
t
=
pten
::
EigenVector
<
T
>::
Flatten
(
*
tensor
);
t
.
device
(
*
context
.
eigen_device
())
=
t
.
constant
(
static_cast
<
T
>
(
val
));
t
.
device
(
*
dev_ctx
.
eigen_device
())
=
t
.
constant
(
static_cast
<
T
>
(
val
));
}
template
<
typename
T
,
typename
Context
T
>
void
Full
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
Full
(
const
Context
&
dev_ctx
,
const
ScalarArray
&
shape
,
const
Scalar
&
val
,
DenseTensor
*
out
)
{
out
->
Resize
(
paddle
::
framework
::
make_ddim
(
shape
.
GetData
()));
fill_
<
ContextT
,
T
>
(
dev_ctx
,
out
,
val
.
to
<
T
>
());
FullValue
<
Context
,
T
>
(
dev_ctx
,
out
,
val
.
to
<
T
>
());
}
template
<
typename
T
,
typename
Context
T
>
void
FullLike
(
const
Context
T
&
dev_ctx
,
const
Scalar
&
val
,
DenseTensor
*
out
)
{
template
<
typename
T
,
typename
Context
>
void
FullLike
(
const
Context
&
dev_ctx
,
const
Scalar
&
val
,
DenseTensor
*
out
)
{
auto
value
=
val
.
to
<
float
>
();
using
CommonType
=
typename
std
::
common_type
<
float
,
...
...
@@ -66,7 +66,7 @@ void FullLike(const ContextT& dev_ctx, const Scalar& val, DenseTensor* out) {
static_cast
<
CommonType
>
(
std
::
numeric_limits
<
T
>::
lowest
()),
static_cast
<
CommonType
>
(
std
::
numeric_limits
<
T
>::
max
()),
static_cast
<
float
>
(
value
)));
fill_
<
ContextT
,
T
>
(
dev_ctx
,
out
,
value
);
FullValue
<
Context
,
T
>
(
dev_ctx
,
out
,
value
);
}
}
// namespace pten
paddle/pten/kernels/impl/scale_kernel_impl.h
浏览文件 @
f1366d58
...
...
@@ -23,8 +23,8 @@ limitations under the License. */
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Scale
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
Scale
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
Scalar
&
scale
,
float
bias
,
...
...
paddle/pten/kernels/impl/sign_kernel_impl.h
浏览文件 @
f1366d58
...
...
@@ -22,8 +22,8 @@ limitations under the License. */
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Sign
(
const
Context
T
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
)
{
template
<
typename
T
,
typename
Context
>
void
Sign
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
)
{
out
->
mutable_data
<
T
>
();
auto
eigen_out
=
pten
::
EigenVector
<
T
>::
Flatten
(
*
out
);
auto
eigen_x
=
pten
::
EigenVector
<
T
>::
Flatten
(
x
);
...
...
paddle/pten/kernels/reshape_kernel.cc
浏览文件 @
f1366d58
...
...
@@ -21,8 +21,8 @@
namespace
pten
{
template
<
typename
Context
T
>
void
Reshape
(
const
Context
T
&
dev_ctx
,
template
<
typename
Context
>
void
Reshape
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
ScalarArray
&
shape
,
DenseTensor
*
out
)
{
...
...
@@ -36,8 +36,8 @@ void Reshape(const ContextT& dev_ctx,
out
->
ResetLoD
(
x
.
lod
());
}
template
<
typename
Context
T
>
void
ReshapeWithXShape
(
const
Context
T
&
dev_ctx
,
template
<
typename
Context
>
void
ReshapeWithXShape
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
ScalarArray
&
shape
,
DenseTensor
*
xshape
,
...
...
paddle/pten/kernels/reshape_kernel.h
浏览文件 @
f1366d58
...
...
@@ -19,14 +19,14 @@ limitations under the License. */
namespace
pten
{
template
<
typename
Context
T
>
void
Reshape
(
const
Context
T
&
dev_ctx
,
template
<
typename
Context
>
void
Reshape
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
ScalarArray
&
shape
,
DenseTensor
*
out
);
template
<
typename
Context
T
>
void
ReshapeWithXShape
(
const
Context
T
&
dev_ctx
,
template
<
typename
Context
>
void
ReshapeWithXShape
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
ScalarArray
&
shape
,
DenseTensor
*
xshape
,
...
...
paddle/pten/kernels/scale_kernel.h
浏览文件 @
f1366d58
...
...
@@ -19,8 +19,8 @@ limitations under the License. */
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Scale
(
const
Context
T
&
dev_ctx
,
template
<
typename
T
,
typename
Context
>
void
Scale
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
const
Scalar
&
scale
,
float
bias
,
...
...
paddle/pten/kernels/sign_kernel.h
浏览文件 @
f1366d58
...
...
@@ -18,7 +18,7 @@ limitations under the License. */
namespace
pten
{
template
<
typename
T
,
typename
Context
T
>
void
Sign
(
const
Context
T
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
);
template
<
typename
T
,
typename
Context
>
void
Sign
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
);
}
// namespace pten
paddle/pten/kernels/xpu/copy_kernel.cc
浏览文件 @
f1366d58
...
...
@@ -24,8 +24,8 @@ limitations under the License. */
namespace
pten
{
template
<
typename
Context
T
>
void
Copy
(
const
Context
T
&
dev_ctx
,
template
<
typename
Context
>
void
Copy
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
src
,
bool
blocking
,
DenseTensor
*
dst
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录