Skip to content

Commit be1efec

Browse files
authored
Clean paddle/fluid/operators/common_infer_shape_functions.h (#65408)
* Fix * Fix * ci
1 parent d6c15e4 commit be1efec

File tree

16 files changed

+59
-420
lines changed

16 files changed

+59
-420
lines changed

cmake/operators.cmake

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function(register_cu_kernel TARGET)
6161
"${multiValueArgs}" ${ARGN})
6262

6363
set(cu_srcs)
64-
set(op_common_deps operator op_registry layer common_infer_shape_functions)
64+
set(op_common_deps operator op_registry layer)
6565
foreach(cu_src ${register_cu_kernel_SRCS})
6666
if(${cu_src} MATCHES ".*\\.cu$")
6767
list(APPEND cu_srcs ${cu_src})
@@ -112,8 +112,7 @@ function(register_onednn_kernel TARGET)
112112
"${multiValueArgs}" ${ARGN})
113113

114114
set(onednn_cc_srcs)
115-
set(op_common_deps operator op_registry phi layer
116-
common_infer_shape_functions)
115+
set(op_common_deps operator op_registry phi layer)
117116
foreach(onednn_src ${register_onednn_kernel_SRCS})
118117
if(${onednn_src} MATCHES ".*_onednn_op.cc$")
119118
list(APPEND onednn_cc_srcs onednn/${onednn_src})
@@ -163,8 +162,7 @@ function(op_library TARGET)
163162
set(MIOPEN_FILE)
164163
set(onednn_cc_srcs)
165164
set(ONEDNN_FILE)
166-
set(op_common_deps operator op_registry phi layer
167-
common_infer_shape_functions)
165+
set(op_common_deps operator op_registry phi layer)
168166

169167
# Option `UNITY` is used to specify that operator `TARGET` will compiles with Unity Build.
170168
set(options UNITY)

paddle/fluid/operators/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,13 @@ if (WITH_DGC)
110110
set(COMMON_OP_DEPS ${COMMON_OP_DEPS} dgc)
111111
endif()
112112

113-
cc_library(common_infer_shape_functions SRCS common_infer_shape_functions.cc DEPS operator)
114113
cc_library(ops_extra_info SRCS ops_extra_info.cc DEPS attribute phi common)
115114

116115
set(COMMON_OP_DEPS ${COMMON_OP_DEPS} phi common)
117116
set(COMMON_OP_DEPS ${COMMON_OP_DEPS} selected_rows_utils
118117
lod_tensor lod_rank_table executor static_prim_api)
119118
set(COMMON_OP_DEPS ${COMMON_OP_DEPS} dynload_warpctc static_prim_api static_utils static_global_utils prim_utils)
120119
set(COMMON_OP_DEPS ${COMMON_OP_DEPS} box_wrapper ps_gpu_wrapper)
121-
set(COMMON_OP_DEPS ${COMMON_OP_DEPS} common_infer_shape_functions)
122120
set(COMMON_OP_DEPS ${COMMON_OP_DEPS} processgroup_comm_utils)
123121
if(WITH_NCCL OR WITH_RCCL)
124122
set(COMMON_OP_DEPS ${COMMON_OP_DEPS} process_group_nccl)

paddle/fluid/operators/activation_op.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ limitations under the License. */
2222

2323
#include "paddle/fluid/framework/infershape_utils.h"
2424
#include "paddle/fluid/framework/op_version_registry.h"
25-
#include "paddle/fluid/operators/common_infer_shape_functions.h"
2625
#include "paddle/fluid/prim/api/composite_backward/composite_backward_api.h"
2726
#include "paddle/fluid/prim/utils/static/composite_grad_desc_maker.h"
2827
#include "paddle/fluid/prim/utils/static/desc_tensor.h"

paddle/fluid/operators/common_infer_shape_functions.cc

Lines changed: 0 additions & 196 deletions
This file was deleted.

paddle/fluid/operators/common_infer_shape_functions.h

Lines changed: 0 additions & 46 deletions
This file was deleted.

paddle/fluid/prim/api/manual_prim/utils/utils.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@
1616
#include <string>
1717
#include <vector>
1818
#include "paddle/common/ddim.h"
19+
#include "paddle/fluid/framework/details/op_registry.h"
1920
#include "paddle/fluid/framework/op_proto_maker.h"
20-
#include "paddle/fluid/operators/common_infer_shape_functions.h"
21+
#include "paddle/fluid/framework/operator.h"
2122
#include "paddle/fluid/prim/api/generated_prim/prim_generated_api.h"
23+
#include "paddle/phi/api/include/tensor.h"
2224
#include "paddle/phi/common/data_type.h"
2325
#include "paddle/phi/common/int_array.h"
2426
#include "paddle/phi/common/place.h"
2527
#include "paddle/phi/kernels/funcs/blas/blas.h"
28+
#include "paddle/phi/kernels/funcs/common_infer_shape_functions.h"
2629

2730
namespace paddle {
31+
class Tensor;
2832
namespace prim {
33+
2934
// We put some api like utils here
3035
template <typename T>
3136
Tensor empty(const paddle::experimental::IntArray& shape,
@@ -91,7 +96,7 @@ static phi::DDim get_reduce_dims(const phi::DDim& x_dims,
9196
* ==> reduce_dims_from_z_to_x = [1, 3]
9297
* ==> reduce_dims_from_z_to_y = [0, 2, 4]
9398
*/
94-
auto out_dims = paddle::operators::details::BroadcastTwoDims(x_dims, y_dims);
99+
auto out_dims = phi::funcs::BroadcastTwoDims(x_dims, y_dims);
95100
return get_reduce_dims_from_out(out_dims, x_dims);
96101
}
97102

paddle/fluid/primitive/utils/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ if(WITH_PYTHON OR NOT ON_INFER)
22
cc_library(
33
primitive_eager_utils_experimental
44
SRCS eager_utils.cc
5-
DEPS phi common common_infer_shape_functions)
5+
DEPS phi common)
66
endif()
77
cc_library(
88
primitive_static_utils_experimental
99
SRCS static_utils.cc
10-
DEPS phi common common_infer_shape_functions op_dialect)
10+
DEPS phi common op_dialect)

paddle/fluid/primitive/utils/utils.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
#include <vector>
1717

1818
#include "paddle/common/ddim.h"
19-
#include "paddle/fluid/operators/common_infer_shape_functions.h"
19+
#include "paddle/fluid/framework/details/op_registry.h"
20+
#include "paddle/fluid/framework/operator.h"
2021
#include "paddle/fluid/primitive/type/lazy_tensor.h"
2122
#include "paddle/phi/api/include/tensor.h"
23+
#include "paddle/phi/kernels/funcs/common_infer_shape_functions.h"
2224

2325
namespace paddle {
26+
class Tensor;
2427
namespace primitive {
25-
2628
template <typename T>
2729
void set_output(const Tensor& x_tmp, Tensor* x);
2830

@@ -161,7 +163,7 @@ static phi::DDim get_reduce_dims_from_out(const phi::DDim& dout_dims,
161163

162164
static phi::DDim get_reduce_dims(const phi::DDim& x_dims,
163165
const phi::DDim& y_dims) {
164-
auto out_dims = paddle::operators::details::BroadcastTwoDims(x_dims, y_dims);
166+
auto out_dims = phi::funcs::BroadcastTwoDims(x_dims, y_dims);
165167
return get_reduce_dims_from_out(out_dims, x_dims);
166168
}
167169

paddle/fluid/pybind/compiled_program.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
#endif
7474
#include "paddle/fluid/memory/allocation/mmap_allocator.h"
7575
#include "paddle/fluid/operators/activation_op.h"
76-
#include "paddle/fluid/operators/common_infer_shape_functions.h"
7776
#include "paddle/fluid/platform/cpu_helper.h"
7877
#include "paddle/fluid/platform/device/device_wrapper.h"
7978
#include "paddle/fluid/platform/device_context.h"

paddle/fluid/pybind/place.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ limitations under the License. */
7272
#endif
7373
#include "paddle/fluid/memory/allocation/mmap_allocator.h"
7474
#include "paddle/fluid/operators/activation_op.h"
75-
#include "paddle/fluid/operators/common_infer_shape_functions.h"
7675
#include "paddle/fluid/platform/cpu_helper.h"
7776
#include "paddle/fluid/platform/device/device_wrapper.h"
7877
#include "paddle/fluid/platform/device_context.h"

0 commit comments

Comments
 (0)