diff --git a/paddle/fluid/framework/operator.h b/paddle/fluid/framework/operator.h index 575ce8956d44c1bc672438c815bb23ac2e73f6d2..b75dcade6fccf703b36e705b6171b65d93f0d723 100644 --- a/paddle/fluid/framework/operator.h +++ b/paddle/fluid/framework/operator.h @@ -40,7 +40,7 @@ limitations under the License. */ #include "paddle/fluid/platform/variant.h" #include "paddle/utils/flat_hash_map.h" -#include "paddle/pten/api/include/core.h" +#include "paddle/pten/include/core.h" namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/pten_utils.h b/paddle/fluid/framework/pten_utils.h index aab756f50e395aa37942ceb7d42655969661b354..6fe02ad4a4ae4a87c4d053e353da2474186b5d53 100644 --- a/paddle/fluid/framework/pten_utils.h +++ b/paddle/fluid/framework/pten_utils.h @@ -25,8 +25,8 @@ limitations under the License. */ #include "paddle/fluid/imperative/type_defs.h" #include "paddle/fluid/platform/macros.h" #include "paddle/fluid/platform/place.h" -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/hapi/lib/utils/tensor_utils.h" +#include "paddle/pten/api/lib/utils/tensor_utils.h" +#include "paddle/pten/include/core.h" #include "paddle/utils/flat_hash_map.h" #include "paddle/utils/small_vector.h" diff --git a/paddle/fluid/imperative/prepared_operator.h b/paddle/fluid/imperative/prepared_operator.h index fab67e87c79480100293904670f1154b6e93c7fc..144f921861f9e1c0d4ace3a2d2ae089425e1e80b 100644 --- a/paddle/fluid/imperative/prepared_operator.h +++ b/paddle/fluid/imperative/prepared_operator.h @@ -27,7 +27,7 @@ #include "paddle/fluid/imperative/layer.h" #include "paddle/fluid/imperative/type_defs.h" -#include "paddle/pten/api/include/core.h" +#include "paddle/pten/include/core.h" DECLARE_bool(use_mkldnn); diff --git a/paddle/fluid/operators/dot_op.h b/paddle/fluid/operators/dot_op.h index 6a025fdd9ccc6b6f5b5a0edeeea96ddff671d32a..f6877c57a5c18262b1610baf172a971c8c60c95e 100644 --- a/paddle/fluid/operators/dot_op.h +++ b/paddle/fluid/operators/dot_op.h @@ -20,9 +20,9 @@ #include "paddle/fluid/platform/for_range.h" // only can include the headers in paddle/pten/api dirs -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/api/include/linalg.h" -#include "paddle/pten/hapi/lib/utils/tensor_utils.h" +#include "paddle/pten/api/lib/utils/tensor_utils.h" +#include "paddle/pten/include/core.h" +#include "paddle/pten/include/linalg.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/fill_any_like_op.h b/paddle/fluid/operators/fill_any_like_op.h index fc649f42c51a1b479015ab25ace57425615dda15..5e2d06672c3c17d0ff83b8055f10b4afcf507aac 100644 --- a/paddle/fluid/operators/fill_any_like_op.h +++ b/paddle/fluid/operators/fill_any_like_op.h @@ -19,8 +19,8 @@ limitations under the License. */ #include "paddle/fluid/framework/op_registry.h" #include "paddle/fluid/framework/pten_utils.h" -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/api/include/creation.h" +#include "paddle/pten/include/core.h" +#include "paddle/pten/include/creation.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/matmul_v2_op.h b/paddle/fluid/operators/matmul_v2_op.h index 1d361ae45dad9bd6bbb58dfd4e58fadcab9d7e4b..ee95881caa9c53b07dd52e101fb924c7566ac6f6 100644 --- a/paddle/fluid/operators/matmul_v2_op.h +++ b/paddle/fluid/operators/matmul_v2_op.h @@ -26,9 +26,9 @@ limitations under the License. */ #include "paddle/fluid/operators/reduce_ops/reduce_sum_op.h" // only can include the headers in paddle/pten/api dirs -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/api/include/linalg.h" -#include "paddle/pten/hapi/lib/utils/tensor_utils.h" +#include "paddle/pten/api/lib/utils/tensor_utils.h" +#include "paddle/pten/include/core.h" +#include "paddle/pten/include/linalg.h" #if defined(__NVCC__) || defined(__HIPCC__) #include "paddle/fluid/operators/reduce_ops/cub_reduce.h" diff --git a/paddle/fluid/operators/mean_op.h b/paddle/fluid/operators/mean_op.h index f909b96c9193c019e4d043c0f974b84a68dcf131..2b398771c5c9689c4243b435336c1bfeca9093ab 100644 --- a/paddle/fluid/operators/mean_op.h +++ b/paddle/fluid/operators/mean_op.h @@ -18,9 +18,9 @@ limitations under the License. */ #include "paddle/fluid/framework/pten_utils.h" // only can include the headers in paddle/top/api dirs -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/api/include/math.h" -#include "paddle/pten/hapi/lib/utils/tensor_utils.h" +#include "paddle/pten/api/lib/utils/tensor_utils.h" +#include "paddle/pten/include/core.h" +#include "paddle/pten/include/math.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/scale_op.h b/paddle/fluid/operators/scale_op.h index 0d7113a6f4de90da930e005c04b6400f63c0a444..a75c9fd4fd2450a86fb2e59ac492c897f68d1bb7 100644 --- a/paddle/fluid/operators/scale_op.h +++ b/paddle/fluid/operators/scale_op.h @@ -18,9 +18,9 @@ limitations under the License. */ #include "paddle/fluid/framework/pten_utils.h" // only can include the headers in paddle/top/api dirs -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/api/include/math.h" -#include "paddle/pten/hapi/lib/utils/tensor_utils.h" +#include "paddle/pten/api/lib/utils/tensor_utils.h" +#include "paddle/pten/include/core.h" +#include "paddle/pten/include/math.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/sign_op.h b/paddle/fluid/operators/sign_op.h index 0e3036115e3c14fc0feaa00b281871764ba554b4..b7a46cc5467978bd0dbf53b45c1725b5055f682a 100644 --- a/paddle/fluid/operators/sign_op.h +++ b/paddle/fluid/operators/sign_op.h @@ -20,8 +20,8 @@ limitations under the License. */ #include "paddle/fluid/operators/eigen/eigen_function.h" // only can include the headers in paddle/pten/api dirs -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/api/include/math.h" +#include "paddle/pten/include/core.h" +#include "paddle/pten/include/math.h" namespace paddle { namespace operators { diff --git a/paddle/pten/CMakeLists.txt b/paddle/pten/CMakeLists.txt index c1fe2d552af136648b6a416333802cb8c7b24a68..0444fa593c0ac392de49a3b44d8a1a77a96aabd5 100644 --- a/paddle/pten/CMakeLists.txt +++ b/paddle/pten/CMakeLists.txt @@ -1,7 +1,6 @@ -# pten api +# pten (low level) api headers: include +# pten (high level) api add_subdirectory(api) -# pten high level api -add_subdirectory(hapi) # pten core components add_subdirectory(core) # pten kernels for diff device @@ -10,3 +9,13 @@ add_subdirectory(kernels) add_subdirectory(infershape) # pten tests add_subdirectory(tests) + +# make an unity target for compile deps +set(PTEN_DEPS convert_utils dense_tensor kernel_factory kernel_context) +set(PTEN_DEPS ${PTEN_DEPS} math_cpu linalg_cpu creation_cpu manipulation_cpu) +set(PTEN_DEPS ${PTEN_DEPS} unary binary) +if(WITH_GPU OR WITH_ROCM) + set(PTEN_DEPS ${PTEN_DEPS} math_cuda linalg_cuda creation_cuda manipulation_cuda) +endif() + +cc_library(pten SRCS all.cc DEPS ${PTEN_DEPS}) diff --git a/paddle/pten/hapi/all.cc b/paddle/pten/all.cc similarity index 82% rename from paddle/pten/hapi/all.cc rename to paddle/pten/all.cc index 4ea6fabeecf2e52c222be9c22dae70e50880b99a..d8d96e1cd461edf74c2f29cab61f1fbf4191138b 100644 --- a/paddle/pten/hapi/all.cc +++ b/paddle/pten/all.cc @@ -12,8 +12,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/pten/hapi/all.h" +#include "paddle/pten/all.h" -namespace paddle { -namespace experimental {} // namespace experimental -} // namespace paddle +namespace pten {} // namespace pten diff --git a/paddle/pten/hapi/all.h b/paddle/pten/all.h similarity index 69% rename from paddle/pten/hapi/all.h rename to paddle/pten/all.h index 1a2a4199e7bf7cf43547e78c11483b2ee0e289d3..e8e41a8c3eabc860799dfd63b33ea8dc2a4c232b 100644 --- a/paddle/pten/hapi/all.h +++ b/paddle/pten/all.h @@ -14,9 +14,10 @@ limitations under the License. */ #pragma once -// user apis -#include "paddle/pten/hapi/include/creation.h" -#include "paddle/pten/hapi/include/linalg.h" -#include "paddle/pten/hapi/include/manipulation.h" -#include "paddle/pten/hapi/include/math.h" -#include "paddle/pten/hapi/include/tensor.h" +// develop apis +#include "paddle/pten/include/core.h" +#include "paddle/pten/include/creation.h" +#include "paddle/pten/include/infershape.h" +#include "paddle/pten/include/linalg.h" +#include "paddle/pten/include/manipulation.h" +#include "paddle/pten/include/math.h" diff --git a/paddle/pten/api/CMakeLists.txt b/paddle/pten/api/CMakeLists.txt index 1c107519324e218c31883282b5929e105f6393f8..4b427b3b4a38349f672aa8c643bd06ad7f39d360 100644 --- a/paddle/pten/api/CMakeLists.txt +++ b/paddle/pten/api/CMakeLists.txt @@ -1,8 +1,3 @@ -set(PTEN_DEPS convert_utils dense_tensor kernel_factory kernel_context) -set(PTEN_DEPS ${PTEN_DEPS} math_cpu linalg_cpu creation_cpu manipulation_cpu) -set(PTEN_DEPS ${PTEN_DEPS} unary binary) -if(WITH_GPU OR WITH_ROCM) - set(PTEN_DEPS ${PTEN_DEPS} math_cuda linalg_cuda creation_cuda manipulation_cuda) -endif() +add_subdirectory(lib) -cc_library(pten SRCS all.cc DEPS ${PTEN_DEPS}) +cc_library(pten_hapi SRCS all.cc DEPS linalg_api math_api creation_api) diff --git a/paddle/pten/api/all.cc b/paddle/pten/api/all.cc index 0704d6c516fa62db9a7af403fb66cffc3a384abe..c270fbb070689611a76d8fa2dde9ae5016cbd407 100644 --- a/paddle/pten/api/all.cc +++ b/paddle/pten/api/all.cc @@ -14,4 +14,6 @@ limitations under the License. */ #include "paddle/pten/api/all.h" -namespace pten {} // namespace pten +namespace paddle { +namespace experimental {} // namespace experimental +} // namespace paddle diff --git a/paddle/pten/api/all.h b/paddle/pten/api/all.h index c760960967d9563e06d3c96f099804b01f49f0f2..3a2c7b3fa98fe4adb813e7178bb6ebfad84fbec6 100644 --- a/paddle/pten/api/all.h +++ b/paddle/pten/api/all.h @@ -14,10 +14,9 @@ limitations under the License. */ #pragma once -// develop apis -#include "paddle/pten/api/include/core.h" +// user apis #include "paddle/pten/api/include/creation.h" -#include "paddle/pten/api/include/infershape.h" #include "paddle/pten/api/include/linalg.h" #include "paddle/pten/api/include/manipulation.h" #include "paddle/pten/api/include/math.h" +#include "paddle/pten/api/include/tensor.h" diff --git a/paddle/pten/hapi/include/backend_set.h b/paddle/pten/api/include/backend_set.h similarity index 100% rename from paddle/pten/hapi/include/backend_set.h rename to paddle/pten/api/include/backend_set.h diff --git a/paddle/pten/api/include/creation.h b/paddle/pten/api/include/creation.h index 9795d88f81880b9f84491ff4c9ebe9428391510f..755038adb1f71c97496d40dafafcb8fff5a79193 100644 --- a/paddle/pten/api/include/creation.h +++ b/paddle/pten/api/include/creation.h @@ -14,26 +14,20 @@ #pragma once -#include "paddle/pten/api/include/infershape.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/kernels/cpu/creation.h" -#include "paddle/pten/kernels/cuda/creation.h" +#include "paddle/pten/api/include/tensor.h" +#include "paddle/pten/common/data_type.h" +#include "paddle/pten/common/scalar.h" -namespace pten { +namespace paddle { +namespace experimental { -// TODO(YuanRisheng) This function name should be same as User API name. -// TODO(zyfncg) Automatic code generation -template -DenseTensor FillAnyLike(const ContextT& dev_ctx, - const DenseTensor& x, - const Scalar& val) { - auto out_meta = UnchangedInferShape(x.meta()); - const auto allocator = - std::make_shared( - dev_ctx.GetPlace()); - pten::DenseTensor dense_out(allocator, out_meta); - FillAnyLike(dev_ctx, x, val, &dense_out); - return dense_out; -} +Tensor full_like(const Tensor& x, + const Scalar& value, + DataType dtype = DataType::UNDEFINED); -} // namespace pten +Tensor ones_like(const Tensor& x, DataType dtype = DataType::UNDEFINED); + +Tensor zeros_like(const Tensor& x, DataType dtype = DataType::UNDEFINED); + +} // namespace experimental +} // namespace paddle diff --git a/paddle/pten/api/include/linalg.h b/paddle/pten/api/include/linalg.h index 0d4c7a60fbc1456d0ec4dcc06f1e3af51117e3b6..c28c133018464b635cd9c6b9037d3b12b8e91a5a 100644 --- a/paddle/pten/api/include/linalg.h +++ b/paddle/pten/api/include/linalg.h @@ -14,25 +14,17 @@ #pragma once -// See Note: [ How do we organize the kernel directory ] -#include "paddle/pten/api/include/infershape.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/kernels/cpu/linalg.h" -#include "paddle/pten/kernels/cuda/linalg.h" +#include "paddle/pten/api/include/tensor.h" -namespace pten { +namespace paddle { +namespace experimental { -template -DenseTensor Dot(const ContextT& dev_ctx, - const DenseTensor& x, - const DenseTensor& y) { - auto out_meta = DotInferShape(x.meta(), y.meta()); - const auto allocator = - std::make_shared( - dev_ctx.GetPlace()); - pten::DenseTensor dense_out(allocator, out_meta); - Dot(dev_ctx, x, y, &dense_out); - return dense_out; -} +Tensor dot(const Tensor& x, const Tensor& y); -} // namespace pten +Tensor matmul(const Tensor& x, + const Tensor& y, + bool transpose_x, + bool transpose_y); + +} // namespace experimental +} // namespace paddle diff --git a/paddle/pten/api/include/manipulation.h b/paddle/pten/api/include/manipulation.h index 1f867686a6eb7ee006ed6979939ca2e2e2531ad8..fe8c01cb74b95fe3c6159413df5e1f0e8b618eb1 100644 --- a/paddle/pten/api/include/manipulation.h +++ b/paddle/pten/api/include/manipulation.h @@ -1,39 +1,25 @@ -// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ #pragma once -// See Note: [ How do we organize the kernel directory ] -#include "paddle/pten/api/include/infershape.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/kernels/cpu/manipulation.h" -#include "paddle/pten/kernels/cuda/manipulation.h" - -namespace pten { - -template -DenseTensor Flatten(const ContextT& dev_ctx, - const DenseTensor& x, - int start_axis, - int stop_axis) { - auto out_meta = FlattenInferShape(x.meta(), start_axis, stop_axis); - const auto allocator = - std::make_shared( - dev_ctx.GetPlace()); - pten::DenseTensor dense_out(allocator, out_meta); - Flatten(dev_ctx, x, start_axis, stop_axis, &dense_out); - return dense_out; -} - -} // namespace pten +#include "paddle/pten/api/include/tensor.h" + +namespace paddle { +namespace experimental { + +Tensor flatten(const Tensor& x, int start_axis, int stop_axis); + +} // namespace experimental +} // namespace paddle diff --git a/paddle/pten/api/include/math.h b/paddle/pten/api/include/math.h index fa512e8d6db0d7f8dfc28b642ecd91e51066b648..9fea515646d6ec10a08a288e7cb1174728506164 100644 --- a/paddle/pten/api/include/math.h +++ b/paddle/pten/api/include/math.h @@ -14,63 +14,14 @@ limitations under the License. */ #pragma once -// See Note: [ How do we organize the kernel directory ] -#include "paddle/pten/api/include/infershape.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/kernels/cpu/math.h" -#include "paddle/pten/kernels/cuda/math.h" +#include "paddle/pten/api/include/tensor.h" -namespace pten { +namespace paddle { +namespace experimental { -template -DenseTensor Sign(const ContextT& dev_ctx, const DenseTensor& x) { - auto out_meta = UnchangedInferShape(x.meta()); - const auto allocator = - std::make_shared( - dev_ctx.GetPlace()); - pten::DenseTensor dense_out(allocator, out_meta); - Sign(dev_ctx, x, &dense_out); - return dense_out; -} +// TODO(chenweihang): add scale API +// TODO(chenweihang): move mean API into stat.h/cc +Tensor mean(const Tensor& x); -template -DenseTensor Mean(const ContextT& dev_ctx, const DenseTensor& x) { - auto out_meta = ReductionInferShape(x.meta()); - const auto allocator = - std::make_shared( - dev_ctx.GetPlace()); - pten::DenseTensor dense_out(allocator, out_meta); - Mean(dev_ctx, x, &dense_out); - return dense_out; -} - -template -DenseTensor Scale(const ContextT& dev_ctx, - const DenseTensor& x, - float scale, - float bias, - bool bias_after_scale) { - auto out_meta = UnchangedInferShape(x.meta()); - const auto allocator = - std::make_shared( - dev_ctx.GetPlace()); - pten::DenseTensor dense_out(allocator, out_meta); - Scale(dev_ctx, x, scale, bias, bias_after_scale, &dense_out); - return dense_out; -} - -template -DenseTensor Scale(const ContextT& dev_ctx, - const DenseTensor& x, - const DenseTensor& scale, - float bias, - bool bias_after_scale) { - auto out_meta = UnchangedInferShape(x.meta()); - const auto allocator = - std::make_shared( - dev_ctx.GetPlace()); - pten::DenseTensor dense_out(allocator, out_meta); - ScaleHost(dev_ctx, x, scale, bias, bias_after_scale, &dense_out); - return dense_out; -} -} // namespace pten +} // namespace experimental +} // namespace paddle diff --git a/paddle/pten/hapi/include/tensor.h b/paddle/pten/api/include/tensor.h similarity index 100% rename from paddle/pten/hapi/include/tensor.h rename to paddle/pten/api/include/tensor.h diff --git a/paddle/pten/hapi/lib/CMakeLists.txt b/paddle/pten/api/lib/CMakeLists.txt similarity index 100% rename from paddle/pten/hapi/lib/CMakeLists.txt rename to paddle/pten/api/lib/CMakeLists.txt diff --git a/paddle/pten/hapi/lib/creation.cc b/paddle/pten/api/lib/creation.cc similarity index 90% rename from paddle/pten/hapi/lib/creation.cc rename to paddle/pten/api/lib/creation.cc index cda8d24b5e6ad791c8705a9396e51a1e4d367228..893f8b6fbc6f422d139fdb9b14c54a3484bbbe15 100644 --- a/paddle/pten/hapi/lib/creation.cc +++ b/paddle/pten/api/lib/creation.cc @@ -12,16 +12,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/pten/hapi/include/creation.h" +#include "paddle/pten/api/include/creation.h" #include #include "glog/logging.h" -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/api/include/infershape.h" -#include "paddle/pten/hapi/lib/kernel_dispatch.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" +#include "paddle/pten/api/lib/kernel_dispatch.h" +#include "paddle/pten/api/lib/utils/allocator.h" +#include "paddle/pten/include/core.h" +#include "paddle/pten/include/infershape.h" namespace paddle { namespace experimental { diff --git a/paddle/pten/hapi/lib/kernel_dispatch.h b/paddle/pten/api/lib/kernel_dispatch.h similarity index 97% rename from paddle/pten/hapi/lib/kernel_dispatch.h rename to paddle/pten/api/lib/kernel_dispatch.h index f61f3297d6d6c872b244a27319c6de7b16cabff4..567c21eeee9e86757db8842d49afd6ad5cfa02f6 100644 --- a/paddle/pten/hapi/lib/kernel_dispatch.h +++ b/paddle/pten/api/lib/kernel_dispatch.h @@ -18,10 +18,10 @@ limitations under the License. */ #include #include +#include "paddle/pten/api/include/backend_set.h" +#include "paddle/pten/api/include/tensor.h" #include "paddle/pten/common/data_type.h" #include "paddle/pten/common/layout.h" -#include "paddle/pten/hapi/include/backend_set.h" -#include "paddle/pten/hapi/include/tensor.h" // TODO(chenweihang): split KernelName, Key, Kernel, Factory into diff files #include "paddle/pten/core/convert_utils.h" diff --git a/paddle/pten/hapi/lib/linalg.cc b/paddle/pten/api/lib/linalg.cc similarity index 93% rename from paddle/pten/hapi/lib/linalg.cc rename to paddle/pten/api/lib/linalg.cc index 3f13f546ee25e0351c6157f356462fc6d48990ce..587b9cd0f2726fc80d7674a8faa1f222c5e5d2fc 100644 --- a/paddle/pten/hapi/lib/linalg.cc +++ b/paddle/pten/api/lib/linalg.cc @@ -12,19 +12,19 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/pten/hapi/include/linalg.h" +#include "paddle/pten/api/include/linalg.h" #include #include "glog/logging.h" -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/api/include/infershape.h" +#include "paddle/pten/api/lib/kernel_dispatch.h" +#include "paddle/pten/api/lib/utils/allocator.h" #include "paddle/pten/core/convert_utils.h" #include "paddle/pten/core/dense_tensor.h" #include "paddle/pten/core/kernel_context.h" -#include "paddle/pten/hapi/lib/kernel_dispatch.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" +#include "paddle/pten/include/core.h" +#include "paddle/pten/include/infershape.h" namespace paddle { namespace experimental { diff --git a/paddle/pten/hapi/lib/manipulation.cc b/paddle/pten/api/lib/manipulation.cc similarity index 91% rename from paddle/pten/hapi/lib/manipulation.cc rename to paddle/pten/api/lib/manipulation.cc index fa60bac6d1aed95662ecde2aa26fe2f0a5908bb8..9f071ce8c2d14be013d69e14fa387457b28b27cf 100644 --- a/paddle/pten/hapi/lib/manipulation.cc +++ b/paddle/pten/api/lib/manipulation.cc @@ -12,14 +12,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/pten/hapi/include/manipulation.h" +#include "paddle/pten/api/include/manipulation.h" #include #include "glog/logging.h" -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/hapi/lib/kernel_dispatch.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" +#include "paddle/pten/api/lib/kernel_dispatch.h" +#include "paddle/pten/api/lib/utils/allocator.h" +#include "paddle/pten/include/core.h" #include "paddle/pten/infershape/unary.h" namespace paddle { diff --git a/paddle/pten/hapi/lib/math.cc b/paddle/pten/api/lib/math.cc similarity index 88% rename from paddle/pten/hapi/lib/math.cc rename to paddle/pten/api/lib/math.cc index 5e4e96d333030370787137a6c29d632e50676c3d..6cb7849e529e038eb8e253749d3876c1bec87029 100644 --- a/paddle/pten/hapi/lib/math.cc +++ b/paddle/pten/api/lib/math.cc @@ -12,16 +12,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/pten/hapi/include/math.h" +#include "paddle/pten/api/include/math.h" #include #include "glog/logging.h" -#include "paddle/pten/api/include/core.h" -#include "paddle/pten/api/include/infershape.h" -#include "paddle/pten/hapi/lib/kernel_dispatch.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" +#include "paddle/pten/api/lib/kernel_dispatch.h" +#include "paddle/pten/api/lib/utils/allocator.h" +#include "paddle/pten/include/core.h" +#include "paddle/pten/include/infershape.h" #include "paddle/pten/infershape/unary.h" namespace paddle { diff --git a/paddle/pten/hapi/lib/utils/CMakeLists.txt b/paddle/pten/api/lib/utils/CMakeLists.txt similarity index 100% rename from paddle/pten/hapi/lib/utils/CMakeLists.txt rename to paddle/pten/api/lib/utils/CMakeLists.txt diff --git a/paddle/pten/hapi/lib/utils/allocator.cc b/paddle/pten/api/lib/utils/allocator.cc similarity index 93% rename from paddle/pten/hapi/lib/utils/allocator.cc rename to paddle/pten/api/lib/utils/allocator.cc index 0c364c97e4d1cdd75edcbf1b9a6a8f44233596e7..e80152431e71292fcd34c96108c191f8c799a220 100644 --- a/paddle/pten/hapi/lib/utils/allocator.cc +++ b/paddle/pten/api/lib/utils/allocator.cc @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/pten/hapi/lib/utils/allocator.h" +#include "paddle/pten/api/lib/utils/allocator.h" namespace paddle { namespace experimental { diff --git a/paddle/pten/hapi/lib/utils/allocator.h b/paddle/pten/api/lib/utils/allocator.h similarity index 100% rename from paddle/pten/hapi/lib/utils/allocator.h rename to paddle/pten/api/lib/utils/allocator.h diff --git a/paddle/pten/hapi/lib/utils/storage.cc b/paddle/pten/api/lib/utils/storage.cc similarity index 96% rename from paddle/pten/hapi/lib/utils/storage.cc rename to paddle/pten/api/lib/utils/storage.cc index 0682b25c6e0dd7c3c746c4e11ee8f25ebdf4826a..ba26e7f600d60c07df1179fdd1a4ff84d2383b5c 100644 --- a/paddle/pten/hapi/lib/utils/storage.cc +++ b/paddle/pten/api/lib/utils/storage.cc @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/pten/hapi/lib/utils/storage.h" +#include "paddle/pten/api/lib/utils/storage.h" namespace paddle { namespace experimental { diff --git a/paddle/pten/hapi/lib/utils/storage.h b/paddle/pten/api/lib/utils/storage.h similarity index 100% rename from paddle/pten/hapi/lib/utils/storage.h rename to paddle/pten/api/lib/utils/storage.h diff --git a/paddle/pten/hapi/lib/utils/tensor_utils.cc b/paddle/pten/api/lib/utils/tensor_utils.cc similarity index 98% rename from paddle/pten/hapi/lib/utils/tensor_utils.cc rename to paddle/pten/api/lib/utils/tensor_utils.cc index f7641f424f4910d69c9ca71ddfa7968979a66c81..628fde3a1a4ddb089979356292e23df01f3afb4b 100644 --- a/paddle/pten/hapi/lib/utils/tensor_utils.cc +++ b/paddle/pten/api/lib/utils/tensor_utils.cc @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/pten/hapi/lib/utils/tensor_utils.h" +#include "paddle/pten/api/lib/utils/tensor_utils.h" namespace paddle { namespace experimental { diff --git a/paddle/pten/hapi/lib/utils/tensor_utils.h b/paddle/pten/api/lib/utils/tensor_utils.h similarity index 94% rename from paddle/pten/hapi/lib/utils/tensor_utils.h rename to paddle/pten/api/lib/utils/tensor_utils.h index a2b2688362a4cfffc5a66c055994d021663d3bfb..625d6702f8b6d4814b2fbc52154ed4e4efc6fbdd 100644 --- a/paddle/pten/hapi/lib/utils/tensor_utils.h +++ b/paddle/pten/api/lib/utils/tensor_utils.h @@ -19,11 +19,11 @@ limitations under the License. */ #include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/variable.h" +#include "paddle/pten/api/lib/utils/allocator.h" +#include "paddle/pten/api/lib/utils/storage.h" #include "paddle/pten/core/convert_utils.h" #include "paddle/pten/core/dense_tensor.h" #include "paddle/pten/core/kernel_factory.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/hapi/lib/utils/storage.h" namespace paddle { namespace experimental { diff --git a/paddle/pten/hapi/lib/utils/tests/CMakeLists.txt b/paddle/pten/api/lib/utils/tests/CMakeLists.txt similarity index 100% rename from paddle/pten/hapi/lib/utils/tests/CMakeLists.txt rename to paddle/pten/api/lib/utils/tests/CMakeLists.txt diff --git a/paddle/pten/hapi/lib/utils/tests/test_storage.cc b/paddle/pten/api/lib/utils/tests/test_storage.cc similarity index 95% rename from paddle/pten/hapi/lib/utils/tests/test_storage.cc rename to paddle/pten/api/lib/utils/tests/test_storage.cc index fbbcd2a3ee0e5c2f535103281fe5a1a5cd9fdf59..fc95f95f26e0b0099ad6b8a88529433eb5386b54 100644 --- a/paddle/pten/hapi/lib/utils/tests/test_storage.cc +++ b/paddle/pten/api/lib/utils/tests/test_storage.cc @@ -16,8 +16,8 @@ limitations under the License. */ #include "gtest/gtest.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/hapi/lib/utils/storage.h" +#include "paddle/pten/api/lib/utils/allocator.h" +#include "paddle/pten/api/lib/utils/storage.h" namespace paddle { namespace experimental { diff --git a/paddle/pten/hapi/lib/utils/tests/test_tensor_utils.cc b/paddle/pten/api/lib/utils/tests/test_tensor_utils.cc similarity index 98% rename from paddle/pten/hapi/lib/utils/tests/test_tensor_utils.cc rename to paddle/pten/api/lib/utils/tests/test_tensor_utils.cc index 56184eec70f26606333ae2e6682b786c1e7dcb5a..fd52b96542c712bcd8449dbaa36d6bcda0149399 100644 --- a/paddle/pten/hapi/lib/utils/tests/test_tensor_utils.cc +++ b/paddle/pten/api/lib/utils/tests/test_tensor_utils.cc @@ -14,7 +14,7 @@ limitations under the License. */ #include "gtest/gtest.h" -#include "paddle/pten/hapi/lib/utils/tensor_utils.h" +#include "paddle/pten/api/lib/utils/tensor_utils.h" namespace paddle { namespace experimental { diff --git a/paddle/pten/hapi/CMakeLists.txt b/paddle/pten/hapi/CMakeLists.txt deleted file mode 100644 index 4b427b3b4a38349f672aa8c643bd06ad7f39d360..0000000000000000000000000000000000000000 --- a/paddle/pten/hapi/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(lib) - -cc_library(pten_hapi SRCS all.cc DEPS linalg_api math_api creation_api) diff --git a/paddle/pten/hapi/include/creation.h b/paddle/pten/hapi/include/creation.h deleted file mode 100644 index 6f978be995273e22c4501584b71e5e1ee6dbda20..0000000000000000000000000000000000000000 --- a/paddle/pten/hapi/include/creation.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include "paddle/pten/common/data_type.h" -#include "paddle/pten/common/scalar.h" -#include "paddle/pten/hapi/include/tensor.h" - -namespace paddle { -namespace experimental { - -Tensor full_like(const Tensor& x, - const Scalar& value, - DataType dtype = DataType::UNDEFINED); - -Tensor ones_like(const Tensor& x, DataType dtype = DataType::UNDEFINED); - -Tensor zeros_like(const Tensor& x, DataType dtype = DataType::UNDEFINED); - -} // namespace experimental -} // namespace paddle diff --git a/paddle/pten/hapi/include/linalg.h b/paddle/pten/hapi/include/linalg.h deleted file mode 100644 index 6e78b50af11c36b2341df211acd63202680f7f6c..0000000000000000000000000000000000000000 --- a/paddle/pten/hapi/include/linalg.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include "paddle/pten/hapi/include/tensor.h" - -namespace paddle { -namespace experimental { - -Tensor dot(const Tensor& x, const Tensor& y); - -Tensor matmul(const Tensor& x, - const Tensor& y, - bool transpose_x, - bool transpose_y); - -} // namespace experimental -} // namespace paddle diff --git a/paddle/pten/hapi/include/manipulation.h b/paddle/pten/hapi/include/manipulation.h deleted file mode 100644 index 4622032f5ad545b66c6199a5e454b7c3c004fbbc..0000000000000000000000000000000000000000 --- a/paddle/pten/hapi/include/manipulation.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -#pragma once - -#include "paddle/pten/hapi/include/tensor.h" - -namespace paddle { -namespace experimental { - -Tensor flatten(const Tensor& x, int start_axis, int stop_axis); - -} // namespace experimental -} // namespace paddle diff --git a/paddle/pten/hapi/include/math.h b/paddle/pten/hapi/include/math.h deleted file mode 100644 index db4010c1c14e3aae4b6da5ba1fe7c1a7cee2de82..0000000000000000000000000000000000000000 --- a/paddle/pten/hapi/include/math.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -#pragma once - -#include "paddle/pten/hapi/include/tensor.h" - -namespace paddle { -namespace experimental { - -// TODO(chenweihang): add scale API -// TODO(chenweihang): move mean API into stat.h/cc -Tensor mean(const Tensor& x); - -} // namespace experimental -} // namespace paddle diff --git a/paddle/pten/api/include/core.h b/paddle/pten/include/core.h similarity index 100% rename from paddle/pten/api/include/core.h rename to paddle/pten/include/core.h diff --git a/paddle/pten/include/creation.h b/paddle/pten/include/creation.h new file mode 100644 index 0000000000000000000000000000000000000000..0fb3f905e03fbfb0b9743ff631a02452f0fdd577 --- /dev/null +++ b/paddle/pten/include/creation.h @@ -0,0 +1,39 @@ +// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include "paddle/pten/api/lib/utils/allocator.h" +#include "paddle/pten/include/infershape.h" +#include "paddle/pten/kernels/cpu/creation.h" +#include "paddle/pten/kernels/cuda/creation.h" + +namespace pten { + +// TODO(YuanRisheng) This function name should be same as User API name. +// TODO(zyfncg) Automatic code generation +template +DenseTensor FillAnyLike(const ContextT& dev_ctx, + const DenseTensor& x, + const Scalar& val) { + auto out_meta = UnchangedInferShape(x.meta()); + const auto allocator = + std::make_shared( + dev_ctx.GetPlace()); + pten::DenseTensor dense_out(allocator, out_meta); + FillAnyLike(dev_ctx, x, val, &dense_out); + return dense_out; +} + +} // namespace pten diff --git a/paddle/pten/api/include/infershape.h b/paddle/pten/include/infershape.h similarity index 100% rename from paddle/pten/api/include/infershape.h rename to paddle/pten/include/infershape.h diff --git a/paddle/pten/include/linalg.h b/paddle/pten/include/linalg.h new file mode 100644 index 0000000000000000000000000000000000000000..70eebac5b684154e5dd9d8242aed562391562c38 --- /dev/null +++ b/paddle/pten/include/linalg.h @@ -0,0 +1,38 @@ +// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +// See Note: [ How do we organize the kernel directory ] +#include "paddle/pten/api/lib/utils/allocator.h" +#include "paddle/pten/include/infershape.h" +#include "paddle/pten/kernels/cpu/linalg.h" +#include "paddle/pten/kernels/cuda/linalg.h" + +namespace pten { + +template +DenseTensor Dot(const ContextT& dev_ctx, + const DenseTensor& x, + const DenseTensor& y) { + auto out_meta = DotInferShape(x.meta(), y.meta()); + const auto allocator = + std::make_shared( + dev_ctx.GetPlace()); + pten::DenseTensor dense_out(allocator, out_meta); + Dot(dev_ctx, x, y, &dense_out); + return dense_out; +} + +} // namespace pten diff --git a/paddle/pten/include/manipulation.h b/paddle/pten/include/manipulation.h new file mode 100644 index 0000000000000000000000000000000000000000..236f7c7af956199066954aed5a05161e21614a67 --- /dev/null +++ b/paddle/pten/include/manipulation.h @@ -0,0 +1,39 @@ +// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +// See Note: [ How do we organize the kernel directory ] +#include "paddle/pten/api/lib/utils/allocator.h" +#include "paddle/pten/include/infershape.h" +#include "paddle/pten/kernels/cpu/manipulation.h" +#include "paddle/pten/kernels/cuda/manipulation.h" + +namespace pten { + +template +DenseTensor Flatten(const ContextT& dev_ctx, + const DenseTensor& x, + int start_axis, + int stop_axis) { + auto out_meta = FlattenInferShape(x.meta(), start_axis, stop_axis); + const auto allocator = + std::make_shared( + dev_ctx.GetPlace()); + pten::DenseTensor dense_out(allocator, out_meta); + Flatten(dev_ctx, x, start_axis, stop_axis, &dense_out); + return dense_out; +} + +} // namespace pten diff --git a/paddle/pten/include/math.h b/paddle/pten/include/math.h new file mode 100644 index 0000000000000000000000000000000000000000..0a61a94aa8d69687d86f8f6f0b4f1edd107ebce6 --- /dev/null +++ b/paddle/pten/include/math.h @@ -0,0 +1,76 @@ +/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +#pragma once + +// See Note: [ How do we organize the kernel directory ] +#include "paddle/pten/api/lib/utils/allocator.h" +#include "paddle/pten/include/infershape.h" +#include "paddle/pten/kernels/cpu/math.h" +#include "paddle/pten/kernels/cuda/math.h" + +namespace pten { + +template +DenseTensor Sign(const ContextT& dev_ctx, const DenseTensor& x) { + auto out_meta = UnchangedInferShape(x.meta()); + const auto allocator = + std::make_shared( + dev_ctx.GetPlace()); + pten::DenseTensor dense_out(allocator, out_meta); + Sign(dev_ctx, x, &dense_out); + return dense_out; +} + +template +DenseTensor Mean(const ContextT& dev_ctx, const DenseTensor& x) { + auto out_meta = ReductionInferShape(x.meta()); + const auto allocator = + std::make_shared( + dev_ctx.GetPlace()); + pten::DenseTensor dense_out(allocator, out_meta); + Mean(dev_ctx, x, &dense_out); + return dense_out; +} + +template +DenseTensor Scale(const ContextT& dev_ctx, + const DenseTensor& x, + float scale, + float bias, + bool bias_after_scale) { + auto out_meta = UnchangedInferShape(x.meta()); + const auto allocator = + std::make_shared( + dev_ctx.GetPlace()); + pten::DenseTensor dense_out(allocator, out_meta); + Scale(dev_ctx, x, scale, bias, bias_after_scale, &dense_out); + return dense_out; +} + +template +DenseTensor Scale(const ContextT& dev_ctx, + const DenseTensor& x, + const DenseTensor& scale, + float bias, + bool bias_after_scale) { + auto out_meta = UnchangedInferShape(x.meta()); + const auto allocator = + std::make_shared( + dev_ctx.GetPlace()); + pten::DenseTensor dense_out(allocator, out_meta); + ScaleHost(dev_ctx, x, scale, bias, bias_after_scale, &dense_out); + return dense_out; +} +} // namespace pten diff --git a/paddle/pten/kernels/cuda/math.cu b/paddle/pten/kernels/cuda/math.cu index 0ead1f8048bfd6b0252caf495ed7afad73f108bc..cc1a7bef4f18e2d226905182ade5930721eafa2b 100644 --- a/paddle/pten/kernels/cuda/math.cu +++ b/paddle/pten/kernels/cuda/math.cu @@ -28,9 +28,9 @@ namespace cub = hipcub; #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/float16.h" +#include "paddle/pten/api/lib/utils/tensor_utils.h" #include "paddle/pten/core/convert_utils.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/hapi/lib/utils/tensor_utils.h" namespace pten { diff --git a/paddle/pten/tests/test_copy_api.cc b/paddle/pten/tests/test_copy_api.cc index fcebe9a310dea87bc3aed8473458655b376effe1..4bf16e7517b7336209a887d4a6843c8bdf77fd9a 100644 --- a/paddle/pten/tests/test_copy_api.cc +++ b/paddle/pten/tests/test_copy_api.cc @@ -18,8 +18,8 @@ limitations under the License. */ #include "paddle/pten/core/kernel_registry.h" #include "paddle/pten/kernels/cpu/utils.h" +#include "paddle/pten/api/lib/utils/allocator.h" #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" PT_DECLARE_MODULE(UtilsCPU); diff --git a/paddle/pten/tests/test_dot_api.cc b/paddle/pten/tests/test_dot_api.cc index 5401b66544473940938e8fdf55ab86ff580b2463..f79854e557e5a7786eeea48143848a73ceced415 100644 --- a/paddle/pten/tests/test_dot_api.cc +++ b/paddle/pten/tests/test_dot_api.cc @@ -15,13 +15,13 @@ limitations under the License. */ #include #include -#include "paddle/pten/hapi/include/linalg.h" +#include "paddle/pten/api/include/linalg.h" +#include "paddle/pten/api/lib/utils/allocator.h" #include "paddle/pten/core/dense_tensor.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/api/include/linalg.h" +#include "paddle/pten/include/linalg.h" PT_DECLARE_MODULE(LinalgCPU); diff --git a/paddle/pten/tests/test_fill_api.cc b/paddle/pten/tests/test_fill_api.cc index 5a788226086dcc6953357d32fec966493e2d6baa..a83ed76a6f8dfa1da0f0ccedbff993d01d6b2158 100644 --- a/paddle/pten/tests/test_fill_api.cc +++ b/paddle/pten/tests/test_fill_api.cc @@ -15,13 +15,13 @@ limitations under the License. */ #include #include -#include "paddle/pten/hapi/include/creation.h" +#include "paddle/pten/api/include/creation.h" +#include "paddle/pten/api/lib/utils/allocator.h" #include "paddle/pten/core/dense_tensor.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/api/include/creation.h" +#include "paddle/pten/include/creation.h" PT_DECLARE_MODULE(CreationCPU); diff --git a/paddle/pten/tests/test_flatten_api.cc b/paddle/pten/tests/test_flatten_api.cc index dfb777678a94d05fbbf4ad401aa89cfdfad2decd..ca8ca38f65a3ee4cf68ebfaaf13e7eeacd1c31ea 100644 --- a/paddle/pten/tests/test_flatten_api.cc +++ b/paddle/pten/tests/test_flatten_api.cc @@ -15,13 +15,13 @@ limitations under the License. */ #include #include -#include "paddle/pten/hapi/include/manipulation.h" +#include "paddle/pten/api/include/manipulation.h" +#include "paddle/pten/api/lib/utils/allocator.h" #include "paddle/pten/core/dense_tensor.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/api/include/manipulation.h" +#include "paddle/pten/include/manipulation.h" PT_DECLARE_MODULE(ManipulationCPU); diff --git a/paddle/pten/tests/test_matmul_api.cc b/paddle/pten/tests/test_matmul_api.cc index b0579834519aa3ef32e912c3714e3beef9f0fe1a..83a70c905b60ec09c710f6f3047220cfb9675c98 100644 --- a/paddle/pten/tests/test_matmul_api.cc +++ b/paddle/pten/tests/test_matmul_api.cc @@ -15,11 +15,11 @@ limitations under the License. */ #include #include -#include "paddle/pten/hapi/include/linalg.h" +#include "paddle/pten/api/include/linalg.h" +#include "paddle/pten/api/lib/utils/allocator.h" #include "paddle/pten/core/dense_tensor.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" #include "paddle/pten/kernels/cuda/utils.h" PT_DECLARE_MODULE(LinalgCPU); diff --git a/paddle/pten/tests/test_mean_api.cc b/paddle/pten/tests/test_mean_api.cc index b3da90659d005a0d9fbcd38b0cbfa947276ad03c..4dd4222daabe473a499e510675225b25d20d4a46 100644 --- a/paddle/pten/tests/test_mean_api.cc +++ b/paddle/pten/tests/test_mean_api.cc @@ -15,13 +15,13 @@ limitations under the License. */ #include #include -#include "paddle/pten/hapi/include/math.h" +#include "paddle/pten/api/include/math.h" +#include "paddle/pten/api/lib/utils/allocator.h" #include "paddle/pten/core/dense_tensor.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/api/include/math.h" +#include "paddle/pten/include/math.h" PT_DECLARE_MODULE(MathCPU); diff --git a/paddle/pten/tests/test_scale_api.cc b/paddle/pten/tests/test_scale_api.cc index 9f80d6d2cc126bb4687626f267d537601bca7ff2..2ecf6d199b55855bdb95f803d333084bcb2dc2b1 100644 --- a/paddle/pten/tests/test_scale_api.cc +++ b/paddle/pten/tests/test_scale_api.cc @@ -15,13 +15,13 @@ limitations under the License. */ #include #include -#include "paddle/pten/hapi/include/math.h" +#include "paddle/pten/api/include/math.h" +#include "paddle/pten/api/lib/utils/allocator.h" #include "paddle/pten/core/dense_tensor.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/hapi/lib/utils/allocator.h" -#include "paddle/pten/api/include/math.h" +#include "paddle/pten/include/math.h" PT_DECLARE_MODULE(MathCPU);