summaryrefslogtreecommitdiff
path: root/mv_machine_learning/inference/include/OffsetVec.h
diff options
context:
space:
mode:
authorKwanghoon Son <k.son@samsung.com>2022-09-02 05:25:40 -0400
committerKwanghoon Son <k.son@samsung.com>2022-09-04 21:33:51 -0400
commitee852016683c6fed53fdddcc54ebea2c9212e4ff (patch)
tree738fccbbe60c79ee87623f1844017d97203c33de /mv_machine_learning/inference/include/OffsetVec.h
parentfe02f05b54290d93405eda7403675a335d162d05 (diff)
downloadmediavision-ee852016683c6fed53fdddcc54ebea2c9212e4ff.tar.gz
mediavision-ee852016683c6fed53fdddcc54ebea2c9212e4ff.tar.bz2
mediavision-ee852016683c6fed53fdddcc54ebea2c9212e4ff.zip
Apply clang-format
[Issue type] Clean code [Version] 0.23.23 This patch only change code convention. Change-Id: I5f1d3dd56ecd5d962c8a9a52087ed8315db156a6 Signed-off-by: Kwanghoon Son <k.son@samsung.com>
Diffstat (limited to 'mv_machine_learning/inference/include/OffsetVec.h')
-rw-r--r--mv_machine_learning/inference/include/OffsetVec.h90
1 files changed, 49 insertions, 41 deletions
diff --git a/mv_machine_learning/inference/include/OffsetVec.h b/mv_machine_learning/inference/include/OffsetVec.h
index c5fe30bd..e3504baa 100644
--- a/mv_machine_learning/inference/include/OffsetVec.h
+++ b/mv_machine_learning/inference/include/OffsetVec.h
@@ -29,55 +29,63 @@ namespace mediavision
{
namespace inference
{
- class OffsetVec
- {
- private:
- std::string name;
- DimInfo dimInfo;
- int shapeType;
- public:
- OffsetVec() : name(), dimInfo(), shapeType() { }
- ~OffsetVec() = default;
- std::string GetName() { return name; }
- DimInfo GetDimInfo() { return dimInfo; }
- int GetShapeType() { return shapeType; }
-
- int ParseOffset(JsonObject *root, const std::map<std::string, inference_tensor_shape_type_e>& supportedShapeType)
- {
- JsonArray * rootArray = json_object_get_array_member(root, "offset");
- unsigned int elements = json_array_get_length(rootArray);
-
- // TODO: handling error
- for (unsigned int elem = 0; elem < elements; ++elem) {
+class OffsetVec
+{
+private:
+ std::string name;
+ DimInfo dimInfo;
+ int shapeType;
- JsonNode *pNode = json_array_get_element(rootArray, elem);
- JsonObject *pObject = json_node_get_object(pNode);
+public:
+ OffsetVec() : name(), dimInfo(), shapeType()
+ {}
+ ~OffsetVec() = default;
+ std::string GetName()
+ {
+ return name;
+ }
+ DimInfo GetDimInfo()
+ {
+ return dimInfo;
+ }
+ int GetShapeType()
+ {
+ return shapeType;
+ }
- name =
- static_cast<const char*>(json_object_get_string_member(pObject,"name"));
- LOGI("layer: %s", name.c_str());
+ int ParseOffset(JsonObject *root, const std::map<std::string, inference_tensor_shape_type_e> &supportedShapeType)
+ {
+ JsonArray *rootArray = json_object_get_array_member(root, "offset");
+ unsigned int elements = json_array_get_length(rootArray);
- JsonArray * array = json_object_get_array_member(pObject, "index");
- unsigned int elements2 = json_array_get_length(array);
- LOGI("range dim: size[%u]", elements2);
- for (unsigned int elem2 = 0; elem2 < elements2; ++elem2) {
- if (static_cast<int>(json_array_get_int_element(array, elem2)) == 1)
- dimInfo.SetValidIndex(elem2);
- }
+ // TODO: handling error
+ for (unsigned int elem = 0; elem < elements; ++elem) {
+ JsonNode *pNode = json_array_get_element(rootArray, elem);
+ JsonObject *pObject = json_node_get_object(pNode);
- try {
- shapeType = GetSupportedType(pObject, "shape_type", supportedShapeType);
- } catch (const std::exception& e) {
- LOGE("Invalid %s", e.what());
- return MEDIA_VISION_ERROR_INVALID_OPERATION;
- }
+ name = static_cast<const char *>(json_object_get_string_member(pObject, "name"));
+ LOGI("layer: %s", name.c_str());
+ JsonArray *array = json_object_get_array_member(pObject, "index");
+ unsigned int elements2 = json_array_get_length(array);
+ LOGI("range dim: size[%u]", elements2);
+ for (unsigned int elem2 = 0; elem2 < elements2; ++elem2) {
+ if (static_cast<int>(json_array_get_int_element(array, elem2)) == 1)
+ dimInfo.SetValidIndex(elem2);
}
- LOGI("LEAVE");
- return MEDIA_VISION_ERROR_NONE;
+ try {
+ shapeType = GetSupportedType(pObject, "shape_type", supportedShapeType);
+ } catch (const std::exception &e) {
+ LOGE("Invalid %s", e.what());
+ return MEDIA_VISION_ERROR_INVALID_OPERATION;
+ }
}
- };
+
+ LOGI("LEAVE");
+ return MEDIA_VISION_ERROR_NONE;
+ }
+};
} /* Inference */
} /* MediaVision */