diff --git a/paddle/pten/include/creation.h b/paddle/pten/include/creation.h index d685d262ebc1c9262e3f176254d87f2af94eb331..c5decb5fc5bd2b534c3f6d903c3f5ad9a9249b09 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 8b12a88f10fc011b7faa373f896ba4acdc1398da..5287c5cca1439c898c2d6955bc0a4c09cc7c9cfd 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 010accd2e79e54a223122526df71d6cef0c98b3d..721a39bb3ac31a972345903b091e890eebc71c53 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 49d4a24e3a2c465cb4cdee2a2c729133b2f9ea4f..843a78f3413cf0572989cff7c4cfd2d2cead362b 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 3f28b2b48530ffe3d44098b204617fe4690939e9..ae42cbd5dd2c6d764bd10660834f24aa002baeab 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 0c410d9b66fe99224bb002870a386c7edda7a700..5022abdb36737cbca003c0759d6d51b422c2247d 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