Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
b54abbe8
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b54abbe8
编写于
8月 09, 2022
作者:
A
Allen Guo
提交者:
GitHub
8月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix format for paddle/phi/api/lib/tensor.cc (#44972)
上级
e84250e8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
123 addition
and
103 deletion
+123
-103
paddle/fluid/inference/tests/api/analyzer_rnn1_tester.cc
paddle/fluid/inference/tests/api/analyzer_rnn1_tester.cc
+0
-2
paddle/fluid/operators/fused/fused_softmax_mask.cu.h
paddle/fluid/operators/fused/fused_softmax_mask.cu.h
+5
-7
paddle/fluid/pybind/pybind.cc
paddle/fluid/pybind/pybind.cc
+64
-67
paddle/infrt/common/type.h
paddle/infrt/common/type.h
+48
-14
paddle/phi/api/lib/data_transform.cc
paddle/phi/api/lib/data_transform.cc
+0
-2
paddle/phi/api/lib/tensor.cc
paddle/phi/api/lib/tensor.cc
+2
-4
paddle/phi/api/lib/tensor_method.cc
paddle/phi/api/lib/tensor_method.cc
+4
-7
未找到文件。
paddle/fluid/inference/tests/api/analyzer_rnn1_tester.cc
浏览文件 @
b54abbe8
...
@@ -126,7 +126,6 @@ void PrepareInputs(std::vector<PaddleTensor> *input_slots,
...
@@ -126,7 +126,6 @@ void PrepareInputs(std::vector<PaddleTensor> *input_slots,
init_zero_tensor
.
lod
.
assign
({
one_batch
.
lod3
});
init_zero_tensor
.
lod
.
assign
({
one_batch
.
lod3
});
lod_tensor_tensor
.
shape
=
rnn_link_data_shape
;
lod_tensor_tensor
.
shape
=
rnn_link_data_shape
;
lod_tensor_tensor
.
lod
.
assign
({
one_batch
.
lod1
});
lod_tensor_tensor
.
lod
.
assign
({
one_batch
.
lod1
});
// clang-format off
week_tensor
.
shape
.
assign
(
week_tensor
.
shape
.
assign
(
{
static_cast
<
int
>
(
one_batch
.
rnn_week_datas
.
size
()),
{
static_cast
<
int
>
(
one_batch
.
rnn_week_datas
.
size
()),
static_cast
<
int
>
(
one_batch
.
rnn_week_datas
.
front
().
size
())});
static_cast
<
int
>
(
one_batch
.
rnn_week_datas
.
front
().
size
())});
...
@@ -135,7 +134,6 @@ void PrepareInputs(std::vector<PaddleTensor> *input_slots,
...
@@ -135,7 +134,6 @@ void PrepareInputs(std::vector<PaddleTensor> *input_slots,
{
static_cast
<
int
>
(
one_batch
.
rnn_minute_datas
.
size
()),
{
static_cast
<
int
>
(
one_batch
.
rnn_minute_datas
.
size
()),
static_cast
<
int
>
(
one_batch
.
rnn_minute_datas
.
front
().
size
())});
static_cast
<
int
>
(
one_batch
.
rnn_minute_datas
.
front
().
size
())});
minute_tensor
.
lod
.
assign
({
one_batch
.
lod3
});
minute_tensor
.
lod
.
assign
({
one_batch
.
lod3
});
// clang-format on
// assign data
// assign data
TensorAssignData
<
float
>
(
&
lod_attention_tensor
,
TensorAssignData
<
float
>
(
&
lod_attention_tensor
,
std
::
vector
<
std
::
vector
<
float
>>
({{
0
,
0
}}));
std
::
vector
<
std
::
vector
<
float
>>
({{
0
,
0
}}));
...
...
paddle/fluid/operators/fused/fused_softmax_mask.cu.h
浏览文件 @
b54abbe8
...
@@ -173,7 +173,6 @@ void LaunchFusedSoftmaxMaskKernel(const T* src,
...
@@ -173,7 +173,6 @@ void LaunchFusedSoftmaxMaskKernel(const T* src,
dim3
block
(
warp_size
,
warps_per_block
);
dim3
block
(
warp_size
,
warps_per_block
);
dim3
grid
(
DIV_UP
(
seq_len
,
warps_per_block
),
batch_size
,
head_num
);
dim3
grid
(
DIV_UP
(
seq_len
,
warps_per_block
),
batch_size
,
head_num
);
// clang-format off
int
elements
=
ElementsCeil
(
seq_len
);
int
elements
=
ElementsCeil
(
seq_len
);
switch
(
elements
)
{
switch
(
elements
)
{
case
1
:
{
// <=32
case
1
:
{
// <=32
...
@@ -193,17 +192,16 @@ void LaunchFusedSoftmaxMaskKernel(const T* src,
...
@@ -193,17 +192,16 @@ void LaunchFusedSoftmaxMaskKernel(const T* src,
SELECT_SOFTMAX_MASK_KERNEL
(
4
);
SELECT_SOFTMAX_MASK_KERNEL
(
4
);
break
;
break
;
}
}
CASE_SOFTMAX_MASK_KERNEL
(
8
);
// <=256
CASE_SOFTMAX_MASK_KERNEL
(
8
);
// <=256
CASE_SOFTMAX_MASK_KERNEL
(
16
);
// <=512
CASE_SOFTMAX_MASK_KERNEL
(
16
);
// <=512
CASE_SOFTMAX_MASK_KERNEL
(
32
);
// <=1024
CASE_SOFTMAX_MASK_KERNEL
(
32
);
// <=1024
CASE_SOFTMAX_MASK_KERNEL
(
64
);
// <=2048
CASE_SOFTMAX_MASK_KERNEL
(
64
);
// <=2048
CASE_SOFTMAX_MASK_KERNEL
(
128
);
// <=4096
CASE_SOFTMAX_MASK_KERNEL
(
128
);
// <=4096
default:
default:
PADDLE_THROW
(
platform
::
errors
::
InvalidArgument
(
PADDLE_THROW
(
platform
::
errors
::
InvalidArgument
(
"seq_len must be between (0, 4096], received the seq_len is %d"
,
"seq_len must be between (0, 4096], received the seq_len is %d"
,
seq_len
));
seq_len
));
}
}
// clang-format on
}
}
}
// namespace operators
}
// namespace operators
...
...
paddle/fluid/pybind/pybind.cc
浏览文件 @
b54abbe8
...
@@ -1167,34 +1167,33 @@ All parameter, weight, gradient are variables in Paddle.
...
@@ -1167,34 +1167,33 @@ All parameter, weight, gradient are variables in Paddle.
.
def
(
"empty"
,
[]()
{
return
kEmptyVarName
;
})
.
def
(
"empty"
,
[]()
{
return
kEmptyVarName
;
})
.
def
(
"temp"
,
[]()
{
return
kTempVarName
;
});
.
def
(
"temp"
,
[]()
{
return
kTempVarName
;
});
// clang-format off
py
::
class_
<
paddle
::
platform
::
DeviceContext
>
(
m
,
"DeviceContext"
)
py
::
class_
<
paddle
::
platform
::
DeviceContext
>
(
m
,
"DeviceContext"
)
.
def_static
(
"create"
,
.
def_static
(
"create"
,
[](
paddle
::
platform
::
CPUPlace
&
place
)
[](
paddle
::
platform
::
CPUPlace
&
place
)
->
paddle
::
platform
::
DeviceContext
*
{
->
paddle
::
platform
::
DeviceContext
*
{
auto
*
context
=
new
phi
::
CPUContext
();
auto
*
context
=
new
phi
::
CPUContext
();
context
->
SetAllocator
(
context
->
SetAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
.
GetAllocator
(
place
)
.
GetAllocator
(
place
)
.
get
());
.
get
());
context
->
SetHostAllocator
(
context
->
SetHostAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
.
GetAllocator
(
paddle
::
platform
::
CPUPlace
())
.
GetAllocator
(
paddle
::
platform
::
CPUPlace
())
.
get
());
.
get
());
context
->
SetZeroAllocator
(
context
->
SetZeroAllocator
(
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
paddle
::
memory
::
allocation
::
AllocatorFacade
::
Instance
()
.
GetZeroAllocator
(
place
)
.
GetZeroAllocator
(
place
)
.
get
());
.
get
());
return
context
;
return
context
;
})
})
.
def_static
(
"create"
,
.
def_static
(
[](
paddle
::
platform
::
XPUPlace
&
place
)
"create"
,
->
paddle
::
platform
::
DeviceContext
*
{
[](
paddle
::
platform
::
XPUPlace
&
place
)
->
paddle
::
platform
::
DeviceContext
*
{
#ifndef PADDLE_WITH_XPU
#ifndef PADDLE_WITH_XPU
PADDLE_THROW
(
PADDLE_THROW
(
platform
::
errors
::
PermissionDenied
(
platform
::
errors
::
PermissionDenied
(
"Cannot use XPUPlace in CPU/GPU version, "
"Cannot use XPUPlace in CPU/GPU version, "
"Please recompile or reinstall Paddle with XPU support."
));
"Please recompile or reinstall Paddle with XPU support."
));
#else
#else
auto
*
context
=
new
paddle
::
platform
::
XPUDeviceContext
(
place
);
auto
*
context
=
new
paddle
::
platform
::
XPUDeviceContext
(
place
);
context
->
SetAllocator
(
context
->
SetAllocator
(
...
@@ -1211,52 +1210,51 @@ All parameter, weight, gradient are variables in Paddle.
...
@@ -1211,52 +1210,51 @@ All parameter, weight, gradient are variables in Paddle.
.
get
());
.
get
());
return
context
;
return
context
;
#endif
#endif
})
})
.
def_static
(
"create"
,
.
def_static
(
[](
paddle
::
platform
::
MLUPlace
&
place
)
"create"
,
->
paddle
::
platform
::
DeviceContext
*
{
[](
paddle
::
platform
::
MLUPlace
&
place
)
->
paddle
::
platform
::
DeviceContext
*
{
#ifndef PADDLE_WITH_MLU
#ifndef PADDLE_WITH_MLU
PADDLE_THROW
(
PADDLE_THROW
(
platform
::
errors
::
PermissionDenied
(
platform
::
errors
::
PermissionDenied
(
"Cannot use MLUPlace in CPU/GPU version, "
"Cannot use MLUPlace in CPU/GPU version, "
"Please recompile or reinstall Paddle with MLU support."
));
"Please recompile or reinstall Paddle with MLU support."
));
#else
#else
return
new
paddle
::
platform
::
MLUDeviceContext
(
place
);
return
new
paddle
::
platform
::
MLUDeviceContext
(
place
);
#endif
#endif
})
})
.
def_static
(
"create"
,
.
def_static
(
[](
paddle
::
platform
::
NPUPlace
&
place
)
"create"
,
->
paddle
::
platform
::
DeviceContext
*
{
[](
paddle
::
platform
::
NPUPlace
&
place
)
->
paddle
::
platform
::
DeviceContext
*
{
#ifndef PADDLE_WITH_ASCEND_CL
#ifndef PADDLE_WITH_ASCEND_CL
PADDLE_THROW
(
PADDLE_THROW
(
platform
::
errors
::
PermissionDenied
(
platform
::
errors
::
PermissionDenied
(
"Cannot use NPUPlace in CPU/GPU/XPU version, "
"Cannot use NPUPlace in CPU/GPU/XPU version, "
"Please recompile or reinstall Paddle with NPU support."
));
"Please recompile or reinstall Paddle with NPU support."
));
#else
#else
return
new
paddle
::
platform
::
NPUDeviceContext
(
place
);
return
new
paddle
::
platform
::
NPUDeviceContext
(
place
);
#endif
#endif
})
})
.
def_static
(
"create"
,
.
def_static
(
"create"
,
[](
paddle
::
platform
::
CustomPlace
&
place
)
[](
paddle
::
platform
::
CustomPlace
&
place
)
->
paddle
::
platform
::
DeviceContext
*
{
->
paddle
::
platform
::
DeviceContext
*
{
#ifndef PADDLE_WITH_CUSTOM_DEVICE
#ifndef PADDLE_WITH_CUSTOM_DEVICE
PADDLE_THROW
(
PADDLE_THROW
(
platform
::
errors
::
PermissionDenied
(
platform
::
errors
::
PermissionDenied
(
"Cannot use CustomPlace in CPU/GPU/XPU version, "
"Cannot use CustomPlace in CPU/GPU/XPU version, "
"Please recompile or reinstall Paddle with "
"Please recompile or reinstall Paddle with "
"CustomDevice support."
));
"CustomDevice support."
));
#else
#else
return
new
paddle
::
platform
::
CustomDeviceContext
(
place
);
return
new
paddle
::
platform
::
CustomDeviceContext
(
place
);
#endif
#endif
})
})
.
def_static
(
"create"
,
.
def_static
(
[](
paddle
::
platform
::
CUDAPlace
&
place
)
"create"
,
->
paddle
::
platform
::
DeviceContext
*
{
[](
paddle
::
platform
::
CUDAPlace
&
place
)
->
paddle
::
platform
::
DeviceContext
*
{
#if !defined(PADDLE_WITH_CUDA) && !defined(PADDLE_WITH_HIP)
#if !defined(PADDLE_WITH_CUDA) && !defined(PADDLE_WITH_HIP)
PADDLE_THROW
(
PADDLE_THROW
(
platform
::
errors
::
PermissionDenied
(
platform
::
errors
::
PermissionDenied
(
"Cannot use CUDAPlace in CPU only version, "
"Cannot use CUDAPlace in CPU only version, "
"Please recompile or reinstall Paddle with CUDA support."
));
"Please recompile or reinstall Paddle with CUDA support."
));
#else
#else
auto
*
context
=
new
phi
::
GPUContext
(
place
);
auto
*
context
=
new
phi
::
GPUContext
(
place
);
context
->
SetAllocator
(
context
->
SetAllocator
(
...
@@ -1278,20 +1276,19 @@ All parameter, weight, gradient are variables in Paddle.
...
@@ -1278,20 +1276,19 @@ All parameter, weight, gradient are variables in Paddle.
context
->
PartialInitWithAllocator
();
context
->
PartialInitWithAllocator
();
return
context
;
return
context
;
#endif
#endif
})
})
.
def_static
(
"create"
,
.
def_static
(
[](
paddle
::
platform
::
CUDAPinnedPlace
&
place
)
"create"
,
->
paddle
::
platform
::
DeviceContext
*
{
[](
paddle
::
platform
::
CUDAPinnedPlace
&
place
)
->
paddle
::
platform
::
DeviceContext
*
{
#if !defined(PADDLE_WITH_CUDA) && !defined(PADDLE_WITH_HIP)
#if !defined(PADDLE_WITH_CUDA) && !defined(PADDLE_WITH_HIP)
PADDLE_THROW
(
PADDLE_THROW
(
platform
::
errors
::
PermissionDenied
(
platform
::
errors
::
PermissionDenied
(
"Cannot use CUDAPinnedPlace in CPU only version, "
"Cannot use CUDAPinnedPlace in CPU only version, "
"Please recompile or reinstall Paddle with CUDA support."
));
"Please recompile or reinstall Paddle with CUDA support."
));
#else
#else
return
new
paddle
::
platform
::
CUDAPinnedDeviceContext
(
place
);
return
new
paddle
::
platform
::
CUDAPinnedDeviceContext
(
place
);
#endif
#endif
});;
});
// clang-format on
#if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL)
#if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL)
py
::
class_
<
platform
::
Communicator
>
(
m
,
"Communicator"
).
def
(
py
::
init
<>
());
py
::
class_
<
platform
::
Communicator
>
(
m
,
"Communicator"
).
def
(
py
::
init
<>
());
#endif
#endif
...
...
paddle/infrt/common/type.h
浏览文件 @
b54abbe8
...
@@ -172,20 +172,54 @@ const Type& UI1();
...
@@ -172,20 +172,54 @@ const Type& UI1();
template
<
typename
T
>
template
<
typename
T
>
Type
type_of
();
Type
type_of
();
// clang-format off
template
<
>
template
<
>
inline
Type
type_of
<
float
>
()
{
return
F32
();
}
inline
Type
type_of
<
float
>
()
{
template
<
>
inline
Type
type_of
<
double
>
()
{
return
F64
();
}
return
F32
();
template
<
>
inline
Type
type_of
<
unsigned
char
>
()
{
return
UI8
();
}
}
template
<
>
inline
Type
type_of
<
int16_t
>
()
{
return
UI16
();
}
template
<
>
template
<
>
inline
Type
type_of
<
int32_t
>
()
{
return
I32
();
}
inline
Type
type_of
<
double
>
()
{
template
<
>
inline
Type
type_of
<
uint32_t
>
()
{
return
UI32
();
}
return
F64
();
template
<
>
inline
Type
type_of
<
bool
>
()
{
return
UI1
();
}
}
template
<
>
inline
Type
type_of
<
char
>
()
{
return
I8
();
}
template
<
>
template
<
>
inline
Type
type_of
<
int64_t
>
()
{
return
I64
();
}
inline
Type
type_of
<
unsigned
char
>
()
{
template
<
>
inline
Type
type_of
<
uint64_t
>
()
{
return
UI64
();
}
return
UI8
();
template
<
>
inline
Type
type_of
<
signed
char
>
()
{
return
I8
();
}
}
template
<
>
inline
Type
type_of
<
void
>
()
{
return
Void
();
}
template
<
>
// clang-format on
inline
Type
type_of
<
int16_t
>
()
{
return
UI16
();
}
template
<
>
inline
Type
type_of
<
int32_t
>
()
{
return
I32
();
}
template
<
>
inline
Type
type_of
<
uint32_t
>
()
{
return
UI32
();
}
template
<
>
inline
Type
type_of
<
bool
>
()
{
return
UI1
();
}
template
<
>
inline
Type
type_of
<
char
>
()
{
return
I8
();
}
template
<
>
inline
Type
type_of
<
int64_t
>
()
{
return
I64
();
}
template
<
>
inline
Type
type_of
<
uint64_t
>
()
{
return
UI64
();
}
template
<
>
inline
Type
type_of
<
signed
char
>
()
{
return
I8
();
}
template
<
>
inline
Type
type_of
<
void
>
()
{
return
Void
();
}
template
<
>
template
<
>
inline
Type
type_of
<
int8_t
*>
()
{
inline
Type
type_of
<
int8_t
*>
()
{
Type
x
=
Int
(
8
);
Type
x
=
Int
(
8
);
...
...
paddle/phi/api/lib/data_transform.cc
浏览文件 @
b54abbe8
...
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
// clang-format off
#include "paddle/phi/api/lib/data_transform.h"
#include "paddle/phi/api/lib/data_transform.h"
#include "paddle/phi/api/lib/kernel_dispatch.h"
#include "paddle/phi/api/lib/kernel_dispatch.h"
...
@@ -24,7 +23,6 @@ limitations under the License. */
...
@@ -24,7 +23,6 @@ limitations under the License. */
#include "paddle/phi/kernels/transfer_layout_kernel.h"
#include "paddle/phi/kernels/transfer_layout_kernel.h"
#include "paddle/fluid/framework/tensor_util.h"
#include "paddle/fluid/framework/tensor_util.h"
// clang-format on
namespace
paddle
{
namespace
paddle
{
namespace
experimental
{
namespace
experimental
{
...
...
paddle/phi/api/lib/tensor.cc
浏览文件 @
b54abbe8
...
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
// clang-format off
#include "paddle/phi/api/include/tensor.h"
#include "paddle/phi/api/include/tensor.h"
#include <memory>
#include <memory>
...
@@ -35,7 +34,6 @@ limitations under the License. */
...
@@ -35,7 +34,6 @@ limitations under the License. */
#include "paddle/phi/core/tensor_base.h"
#include "paddle/phi/core/tensor_base.h"
#include "paddle/phi/core/tensor_meta.h"
#include "paddle/phi/core/tensor_meta.h"
#include "paddle/phi/core/tensor_utils.h"
#include "paddle/phi/core/tensor_utils.h"
// clang-format off
namespace
paddle
{
namespace
paddle
{
namespace
experimental
{
namespace
experimental
{
...
@@ -312,8 +310,8 @@ void Tensor::set_impl(std::shared_ptr<phi::TensorBase> &&impl) {
...
@@ -312,8 +310,8 @@ void Tensor::set_impl(std::shared_ptr<phi::TensorBase> &&impl) {
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
gpuStream_t
Tensor
::
stream
()
const
{
gpuStream_t
Tensor
::
stream
()
const
{
int
device_id
=
phi
::
backends
::
gpu
::
GetCurrentDeviceId
();
int
device_id
=
phi
::
backends
::
gpu
::
GetCurrentDeviceId
();
auto
*
gpu_context
=
DeviceContextPool
::
Instance
()
auto
*
gpu_context
=
DeviceContextPool
::
Instance
().
Get
<
AllocationType
::
GPU
>
(
.
Get
<
AllocationType
::
GPU
>
(
GPUPlace
(
device_id
));
GPUPlace
(
device_id
));
return
gpu_context
->
stream
();
return
gpu_context
->
stream
();
}
}
#endif
#endif
...
...
paddle/phi/api/lib/tensor_method.cc
浏览文件 @
b54abbe8
...
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
// clang-format off
#include "paddle/phi/api/include/tensor.h"
#include "paddle/phi/api/include/tensor.h"
#include "paddle/phi/common/int_array.h"
#include "paddle/phi/common/int_array.h"
...
@@ -25,7 +24,6 @@ limitations under the License. */
...
@@ -25,7 +24,6 @@ limitations under the License. */
#include "paddle/phi/api/lib/kernel_dispatch.h"
#include "paddle/phi/api/lib/kernel_dispatch.h"
#include "paddle/phi/core/tensor_utils.h"
#include "paddle/phi/core/tensor_utils.h"
#include "paddle/phi/infermeta/unary.h"
#include "paddle/phi/infermeta/unary.h"
// clang-format off
namespace
paddle
{
namespace
paddle
{
namespace
experimental
{
namespace
experimental
{
...
@@ -115,13 +113,12 @@ void Tensor::copy_(const Tensor &src,
...
@@ -115,13 +113,12 @@ void Tensor::copy_(const Tensor &src,
// Deep Copy AutoGrad info from src to self.
// Deep Copy AutoGrad info from src to self.
*
autograd_meta_
=
*
(
src
.
autograd_meta_
);
*
autograd_meta_
=
*
(
src
.
autograd_meta_
);
}
}
kernel_key_set
.
backend_set
=
kernel_key_set
.
backend_set
=
kernel_key_set
.
backend_set
|
kernel_key_set
.
backend_set
|
BackendSet
(
phi
::
TransToPhiBackend
(
target_place
));
BackendSet
(
phi
::
TransToPhiBackend
(
target_place
));
auto
kernel_key
=
kernel_key_set
.
GetHighestPriorityKernelKey
();
auto
kernel_key
=
kernel_key_set
.
GetHighestPriorityKernelKey
();
auto
place
=
phi
::
TransToPhiPlace
(
kernel_key
.
backend
());
auto
place
=
phi
::
TransToPhiPlace
(
kernel_key
.
backend
());
auto
&
pool
=
paddle
::
experimental
::
DeviceContextPool
::
Instance
();
auto
&
pool
=
paddle
::
experimental
::
DeviceContextPool
::
Instance
();
auto
*
dev_ctx
=
pool
.
GetMutable
(
auto
*
dev_ctx
=
pool
.
GetMutable
(
place
.
GetType
()
==
target_place
.
GetType
()
?
target_place
:
place
);
place
.
GetType
()
==
target_place
.
GetType
()
?
target_place
:
place
);
Backend
kernel_backend
=
Backend
::
UNDEFINED
;
Backend
kernel_backend
=
Backend
::
UNDEFINED
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录