未验证 提交 d6aa0d43 编写于 作者: N Netpunk 提交者: GitHub

[PHI decoupling] migrate poly_util.h to phi (#48499)

* rm poly_util.h

* format code

* fix some problems

* format code
上级 cee7a3db
......@@ -17,9 +17,9 @@ limitations under the License. */
#include <utility>
#include <vector>
#include "paddle/fluid/operators/detection/poly_util.h"
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/device_context.h"
#include "paddle/phi/kernels/funcs/detection/poly_util.h"
namespace phi {
namespace funcs {
......@@ -96,10 +96,10 @@ T PolyIoU(const T* box1,
const T* box2,
const size_t box_size,
const bool normalized) {
T bbox1_area = paddle::operators::PolyArea<T>(box1, box_size, normalized);
T bbox2_area = paddle::operators::PolyArea<T>(box2, box_size, normalized);
T bbox1_area = phi::funcs::PolyArea<T>(box1, box_size, normalized);
T bbox2_area = phi::funcs::PolyArea<T>(box2, box_size, normalized);
T inter_area =
paddle::operators::PolyOverlapArea<T>(box1, box2, box_size, normalized);
phi::funcs::PolyOverlapArea<T>(box1, box2, box_size, normalized);
if (bbox1_area == 0 || bbox2_area == 0 || inter_area == 0) {
// If coordinate values are invalid
// if area size <= 0, return 0.
......
......@@ -14,12 +14,10 @@ limitations under the License. */
#ifndef POLY_UTIL_CC_
#define POLY_UTIL_CC_
#include "paddle/fluid/operators/detection/poly_util.h"
#include "paddle/phi/kernels/funcs/detection/poly_util.h"
#include "paddle/fluid/framework/op_registry.h"
namespace paddle {
namespace operators {
namespace phi {
namespace funcs {
using phi::funcs::gpc_free_polygon;
using phi::funcs::gpc_polygon_clip;
......@@ -134,7 +132,7 @@ T PolyOverlapArea(const T* box1,
return inter_area;
}
} // namespace operators
} // namespace paddle
} // namespace funcs
} // namespace phi
#endif
......@@ -15,11 +15,10 @@ limitations under the License. */
#include <vector>
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/phi/kernels/funcs/gpc.h"
namespace paddle {
namespace operators {
namespace phi {
namespace funcs {
template <class T>
class Point_ {
......@@ -70,7 +69,7 @@ T PolyOverlapArea(const T* box1,
const T* box2,
const size_t box_size,
const bool normalized);
} // namespace operators
} // namespace paddle
} // namespace funcs
} // namespace phi
#include "paddle/fluid/operators/detection/poly_util.cc"
#include "paddle/phi/kernels/funcs/detection/poly_util.cc"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册