From abb07f355f4b41d0250c2e18f1cd5a1387e46b5b Mon Sep 17 00:00:00 2001 From: zyfncg Date: Wed, 22 Dec 2021 10:48:01 +0800 Subject: [PATCH] Rename full infer_meta (#38332) * rename full infer_meta * fix merge problem --- paddle/pten/include/creation.h | 2 +- paddle/pten/infermeta/nary.cc | 12 ++++++------ paddle/pten/infermeta/nary.h | 12 ++++++------ paddle/pten/infermeta/unary.cc | 6 +++--- paddle/pten/infermeta/unary.h | 6 +++--- python/paddle/utils/code_gen/api.yaml | 13 ++----------- 6 files changed, 21 insertions(+), 30 deletions(-) diff --git a/paddle/pten/include/creation.h b/paddle/pten/include/creation.h index d685d262eb..c5decb5fc5 100644 --- a/paddle/pten/include/creation.h +++ b/paddle/pten/include/creation.h @@ -30,7 +30,7 @@ DenseTensor FullLike( DataType dtype = DataType::UNDEFINED, Backend backend = Backend::UNDEFINED, // Is backend needed here? DataLayout layout = DataLayout::UNDEFINED) { - auto out_meta = FullLikeInferMeta(x.meta(), dtype, layout); + auto out_meta = CreateLikeInferMeta(x.meta(), dtype, layout); pten::DenseTensor dense_out( pten::make_intrusive( dev_ctx.GetPlace()), diff --git a/paddle/pten/infermeta/nary.cc b/paddle/pten/infermeta/nary.cc index 8b12a88f10..5287c5cca1 100644 --- a/paddle/pten/infermeta/nary.cc +++ b/paddle/pten/infermeta/nary.cc @@ -17,16 +17,16 @@ limitations under the License. */ namespace pten { -DenseTensorMeta FullInferMeta(const std::vector& shape, - DataType dtype, - DataLayout layout) { +DenseTensorMeta CreateInferMeta(const std::vector& shape, + DataType dtype, + DataLayout layout) { const auto& out_dims = paddle::framework::make_ddim(shape); return {dtype, out_dims, layout}; } -DenseTensorMeta FullInferMeta(const ScalarArray& shape, - DataType dtype, - DataLayout layout) { +DenseTensorMeta CreateInferMeta(const ScalarArray& shape, + DataType dtype, + DataLayout layout) { const auto& out_dims = paddle::framework::make_ddim(shape.GetData()); return {dtype, out_dims, layout}; } diff --git a/paddle/pten/infermeta/nary.h b/paddle/pten/infermeta/nary.h index 010accd2e7..721a39bb3a 100644 --- a/paddle/pten/infermeta/nary.h +++ b/paddle/pten/infermeta/nary.h @@ -27,12 +27,12 @@ namespace pten { // Because functions in this file // not only can infer shape, but alse need infer lod or other useful data. -DenseTensorMeta FullInferMeta(const std::vector& shape, - DataType dtype, - DataLayout layout); +DenseTensorMeta CreateInferMeta(const std::vector& shape, + DataType dtype, + DataLayout layout); -DenseTensorMeta FullInferMeta(const ScalarArray& shape, - DataType dtype, - DataLayout layout); +DenseTensorMeta CreateInferMeta(const ScalarArray& shape, + DataType dtype, + DataLayout layout); } // namespace pten diff --git a/paddle/pten/infermeta/unary.cc b/paddle/pten/infermeta/unary.cc index 49d4a24e3a..843a78f341 100644 --- a/paddle/pten/infermeta/unary.cc +++ b/paddle/pten/infermeta/unary.cc @@ -81,9 +81,9 @@ DenseTensorMeta CastInferMeta(const DenseTensorMeta& x_meta, return out_meta; } -DenseTensorMeta FullLikeInferMeta(const DenseTensorMeta& x_meta, - DataType dtype, - DataLayout layout) { +DenseTensorMeta CreateLikeInferMeta(const DenseTensorMeta& x_meta, + DataType dtype, + DataLayout layout) { return {dtype == DataType::UNDEFINED ? x_meta.dtype : dtype, x_meta.dims, layout == DataLayout::UNDEFINED ? x_meta.layout : layout}; diff --git a/paddle/pten/infermeta/unary.h b/paddle/pten/infermeta/unary.h index 3f28b2b485..ae42cbd5dd 100644 --- a/paddle/pten/infermeta/unary.h +++ b/paddle/pten/infermeta/unary.h @@ -44,9 +44,9 @@ DenseTensorMeta FlattenInferMeta(const DenseTensorMeta& x_meta, DenseTensorMeta CastInferMeta(const DenseTensorMeta& x_meta, const DataType out_dtype); -DenseTensorMeta FullLikeInferMeta(const DenseTensorMeta& x_meta, - DataType dtype, - DataLayout layout); +DenseTensorMeta CreateLikeInferMeta(const DenseTensorMeta& x_meta, + DataType dtype, + DataLayout layout); DenseTensorMeta InferMetaFromVecValue(const DenseTensorMeta& x_meta, const std::vector& shape); diff --git a/python/paddle/utils/code_gen/api.yaml b/python/paddle/utils/code_gen/api.yaml index 0c410d9b66..5022abdb36 100644 --- a/python/paddle/utils/code_gen/api.yaml +++ b/python/paddle/utils/code_gen/api.yaml @@ -48,7 +48,7 @@ args : (const ScalarArray& shape, const Scalar& value, DataType dtype=DataType::FLOAT32, Backend place=Backend::CPU, DataLayout layout=DataLayout::NCHW) output: Tensor infer_meta : - func : FullInferMeta + func : CreateInferMeta param : [shape, dtype, layout] kernel : func : full @@ -61,7 +61,7 @@ args : (const Tensor& x, const Scalar& value, DataType dtype = DataType::UNDEFINED, Backend place = Backend::UNDEFINED, DataLayout layout = DataLayout::UNDEFINED) output: Tensor infer_meta : - func : FullLikeInferMeta + func : CreateLikeInferMeta param : [x, dtype, layout] kernel : func : full_like @@ -146,15 +146,6 @@ output : Tensor invoke : full_like(x, 0, dtype, place, layout) -# - api : full_like -# args : (const Tensor& x, const Scalar& value, DataType dtype, Backend place)->Tensor -# output: {Tensor : dtype} -# kernel : fill_any_like -# T : [dtype, x] -# backend : [place, x] -# layout : [] -# InferMeta : UnchangedInferMeta(x) - - api : conj args : (const Tensor& x) output : Tensor -- GitLab