Skip to content

Commit

Permalink
[Fix] Relax module adapter template constraints (open-mmlab#1366)
Browse files Browse the repository at this point in the history
* relax module adapter constraint

* remove forwarding `operator()`
  • Loading branch information
lzhangzz authored and irexyc committed Jan 11, 2023
1 parent 0f73095 commit 5199956
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
10 changes: 1 addition & 9 deletions csrc/mmdeploy/codebase/mmdet/yolo_head.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ Result<Detections> YOLOHead::GetBBoxes(const Value& prep_res,
return objs;
}

Result<Value> YOLOV3Head::operator()(const Value& prep_res, const Value& infer_res) {
return YOLOHead::operator()(prep_res, infer_res);
}

std::array<float, 4> YOLOV3Head::yolo_decode(float box_x, float box_y, float box_w, float box_h,
float stride,
const std::vector<std::vector<float>>& anchor, int j,
Expand All @@ -212,11 +208,7 @@ std::array<float, 4> YOLOV3Head::yolo_decode(float box_x, float box_y, float box
return std::array<float, 4>{box_x, box_y, box_w, box_h};
}

Result<Value> YOLOv5Head::operator()(const Value& prep_res, const Value& infer_res) {
return YOLOHead::operator()(prep_res, infer_res);
}

std::array<float, 4> YOLOv5Head::yolo_decode(float box_x, float box_y, float box_w, float box_h,
std::array<float, 4> YOLOV5Head::yolo_decode(float box_x, float box_y, float box_w, float box_h,
float stride,
const std::vector<std::vector<float>>& anchor, int j,
int i, int a) const {
Expand Down
2 changes: 0 additions & 2 deletions csrc/mmdeploy/codebase/mmdet/yolo_head.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class YOLOHead : public MMDetection {
class YOLOV3Head : public YOLOHead {
public:
using YOLOHead::YOLOHead;
Result<Value> operator()(const Value& prep_res, const Value& infer_res);
std::array<float, 4> yolo_decode(float box_x, float box_y, float box_w, float box_h, float stride,
const std::vector<std::vector<float>>& anchor, int j, int i,
int a) const override;
Expand All @@ -42,7 +41,6 @@ class YOLOV3Head : public YOLOHead {
class YOLOv5Head : public YOLOHead {
public:
using YOLOHead::YOLOHead;
Result<Value> operator()(const Value& prep_res, const Value& infer_res);
std::array<float, 4> yolo_decode(float box_x, float box_y, float box_w, float box_h, float stride,
const std::vector<std::vector<float>>& anchor, int j, int i,
int a) const override;
Expand Down
8 changes: 4 additions & 4 deletions csrc/mmdeploy/experimental/module_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ Result<Value> Invoke(Ret (*f)(Args...), const Value& args) {
}

// member function pointer
template <typename Ret, typename C, typename... Args>
Result<Value> Invoke(Ret (C::*f)(Args...) const, C* inst, const Value& args) {
template <typename Ret, typename C0, typename C1, typename... Args>
Result<Value> Invoke(Ret (C0::*f)(Args...) const, C1* inst, const Value& args) {
return InvokeImpl<Ret, Args...>::apply(f, args, inst);
}
template <typename Ret, typename C, typename... Args>
Result<Value> Invoke(Ret (C::*f)(Args...), C* inst, const Value& args) {
template <typename Ret, typename C0, typename C1, typename... Args>
Result<Value> Invoke(Ret (C0::*f)(Args...), C1* inst, const Value& args) {
return InvokeImpl<Ret, Args...>::apply(f, args, inst);
}

Expand Down

0 comments on commit 5199956

Please sign in to comment.