[ml service] Refactor: Decompose ml_single_open_custom function for better maintainability#651
[ml service] Refactor: Decompose ml_single_open_custom function for better maintainability#651songgot wants to merge 1 commit intonnstreamer:mainfrom
Conversation
There was a problem hiding this comment.
This patch refactors a 200+ line function into five smaller functions,
improving readability and maintainability. 👍
Additional recommendations:
a. Avoid the '__' prefix—it’s reserved for system/compiler use.
b. Split _configure_nnfw_tensors by NNFW types to adhere to SRP.
…etter maintainability This commit refactors the monolithic ml_single_open_custom function (200+ lines) into smaller, focused helper functions to improve code readability and maintainability. The main function is now structured as a clear sequence of steps, each handled by a dedicated helper function. Signed-off-by: hyunil park <hyunil46.park@samsung.com>
94e9e4e to
9ed6579
Compare
|
From cursor. (both look legit)
_configure_nnfw_tensors()가 info->nnfw만 참조합니다. 그런데 직전에 호출한 _validate_and_determine_nnfw()는 검증 결과를 info->nnfw에 다시 써주지 않아서, 사용자가 ML_NNFW_TYPE_ANY(또는 잘못된 값)을 넘기면 여기 switch가 default로 빠집니다. TensorFlow/NNFW 등에서는 in/out 텐서 메타데이터 설정이 필수인데 이 단계가 생략돼 런타임 오류가 발생합니다. 검증된 nnfw를 info->nnfw에 저장하거나 이 함수가 nnfw 인자를 직접 받아 사용하도록 조정이 필요해 보입니다.
framework_name/framework 옵션을 통해 info->fw_name에 값을 넣을 수 있지만, _configure_filter_properties()에서는 항상 fw_name 인자(자동 감지 결과)만 사용합니다. 그래서 사용자가 명시적으로 프레임워크 문자열을 지정해도 더 이상 반영되지 않아 기존 기능이 회귀된 상태입니다. info->fw_name이 존재하면 이를 우선 사용하도록 복원해 주세요. |
Thank you for your review. |
This commit refactors the monolithic ml_single_open_custom function (200+ lines) into smaller, focused helper functions to improve code readability and maintainability. The main function is now structured as a clear sequence of steps, each handled by a dedicated helper function.