diff --git a/src/plugin/impl/opr_footprint.cpp b/src/plugin/impl/opr_footprint.cpp index ae01f39d520b627530b4109ec29a323c3da495cf..eaabb8cf83da38cc1de43c1f7fabf55419d278b6 100644 --- a/src/plugin/impl/opr_footprint.cpp +++ b/src/plugin/impl/opr_footprint.cpp @@ -512,6 +512,61 @@ REGISTE_PARAM_JSON_FUNC(DeformableConvBackwardFilter) REGISTE_PARAM_JSON_FUNC(DeformableConvBackwardData) REGISTE_PARAM_JSON_FUNC(BatchConvBiasForward) +template <> +std::shared_ptr opr_param_json_func( + cg::OperatorNodeBase * opr) { + auto param = opr->cast_final_safe().param(); + + auto pattern = json::Array::make(); + for (size_t i = 0; i < param.pattern_len; i++) + pattern->add(json::NumberInt::make(param.pattern[i])); + + return json::Object::make({ + {"ndim", json::NumberInt::make(param.ndim)}, + {"pattern", pattern}, + }); + } + +template <> +std::shared_ptr opr_param_json_func( + cg::OperatorNodeBase * opr) { + auto param = opr->cast_final_safe().param(); + + auto desc = json::Array::make(); + for (size_t i = 0; i < param.nr_desc; i++) { + auto axisdesc = param.desc[i]; + desc->add( + json::Object::make({ + {"method", json::NumberInt::make( + static_cast(axisdesc.method))}, + {"axisnum", json::NumberInt::make(axisdesc.axis.get_raw())}, + })); + } + + return json::Object::make({ + {"nr_desc", json::NumberInt::make(param.nr_desc)}, + {"desc", desc}, + }); + } + +template <> +std::shared_ptr opr_param_json_func( + cg::OperatorNodeBase * opr) { + auto desc = json::Array::make(); + auto indices = opr->cast_final_safe().index_desc(); + for (auto &index : indices){ + desc->add( + json::Object::make({ + {"axis", json::NumberInt::make(index.axis.get_raw())}, + {"begin", json::NumberInt::make(index.begin.node() != nullptr)}, + {"end", json::NumberInt::make(index.end.node() != nullptr)}, + {"step", json::NumberInt::make(index.step.node() != nullptr)}, + {"idx", json::NumberInt::make(index.idx.node() != nullptr)}, + })); + } + + return desc; + } #endif // MGB_ENABLE_JSON } // namespace @@ -573,6 +628,9 @@ void OprFootprint::init_all_footprints() { add_single_param_json(); add_single_param_json(); add_single_param_json(); + add_single_param_json(); + add_single_param_json(); + add_single_param_json(); add_single_param_json(); add_single_param_json(); add_single_param_json();