From: Pawel Wasowski Date: Mon, 29 Mar 2021 14:24:08 +0000 (+0200) Subject: [ML] Remove unneccessary comments and already resolved TODOs X-Git-Tag: submit/tizen/20210609.101925~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9244388f962253dc19885d88f94ae966938d6bf7;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [ML] Remove unneccessary comments and already resolved TODOs [Verification] Code compiles Change-Id: I4ccd17dcee4cc1344c739d20492c93f94f08545e Signed-off-by: Pawel Wasowski --- diff --git a/src/ml/js/ml_common.js b/src/ml/js/ml_common.js index 2d3bd31a..b90ca069 100755 --- a/src/ml/js/ml_common.js +++ b/src/ml/js/ml_common.js @@ -23,11 +23,8 @@ var converter_ = xwalk.utils.converter; var AbortError = new WebAPIException('AbortError', 'An unknown error occurred'); -// Constants var MAX_TENSORS_INFO_COUNT = 16; -// TensorRawData - var TensorRawData = function(data, size, shape) { Object.defineProperties(this, { data: { @@ -103,8 +100,6 @@ function _CheckIfArrayHasOnlyNumbersAndThrow(array, arrayName) { }); } -// TensorsData - var _ValidTensorsDataIds = new Set(); function _CheckIfTensorsDataNotDisposed(id) { @@ -201,7 +196,6 @@ TensorsData.prototype.getTensorRawData = function() { ); } - // TODO: modify StringToArray to accept also float types, not only int var data = privUtils_.StringToArray(result.buffer, Uint8Array); var ArrayType = _GetBufferTypeFromTensorType(result.type); var shape = result.shape; @@ -279,7 +273,6 @@ TensorsData.prototype.setTensorRawData = function() { _CheckIfArrayHasOnlyNumbersAndThrow(argsLocSize.location, 'location'); _CheckIfArrayHasOnlyNumbersAndThrow(argsLocSize.size, 'size'); - // TODO: modify ArrayToString to accept also float types, not only int var encodedData = privUtils_.ArrayToString(new Uint8Array(buffer.buffer)); var callArgs = { index: argsIndex.index, @@ -321,8 +314,6 @@ TensorsData.prototype.dispose = function() { _InvalidateTensorsData(this); }; -// TensorsInfo - function tensorsInfoCountGetter(id) { var result = native_.callSync('MLTensorsInfoCountGetter', { tensorsInfoId: id }); diff --git a/src/ml/js/ml_pipeline.js b/src/ml/js/ml_pipeline.js index 7af35f1e..d1059bae 100755 --- a/src/ml/js/ml_pipeline.js +++ b/src/ml/js/ml_pipeline.js @@ -18,7 +18,6 @@ var kPipelineStateChangeListenerNamePrefix = 'MLPipelineStateChangeListener'; var kSinkListenerNamePrefix = 'MLPipelineSinkListener'; var kCustomFilterListenerNamePrefix = 'MLPipelineCustomFilterListener'; -//PipelineManager::createPipeline() begin var ValidPipelineDisposeExceptions = [ 'InvalidStateError', 'NotFoundError', @@ -89,9 +88,7 @@ var CreatePipeline = function() { return pipeline; }; -//PipelineManager::createPipeline() end -//Pipeline::state begin var ValidPipelineStateExceptions = ['NotSupportedError', 'AbortError']; var Pipeline = function(id) { Object.defineProperties(this, { @@ -117,9 +114,7 @@ var Pipeline = function(id) { } }); }; -//Pipeline::state end -//Pipeline::start() begin var ValidPipelineStartStopExceptions = [ 'NotFoundError', 'NotSupportedError', @@ -139,9 +134,7 @@ Pipeline.prototype.start = function() { ); } }; -//Pipeline::start() end -//Pipeline::stop() begin Pipeline.prototype.stop = function() { var nativeArgs = { id: this._id @@ -156,9 +149,7 @@ Pipeline.prototype.stop = function() { ); } }; -//Pipeline::stop() end -//Pipeline::dispose() begin Pipeline.prototype.dispose = function() { var result = native_.callSync('MLPipelineDispose', { id: this._id }); @@ -170,9 +161,7 @@ Pipeline.prototype.dispose = function() { ); } }; -//Pipeline::dispose() end -//Pipeline::getNodeInfo() begin var NodeInfo = function(name, pipeline_id) { Object.defineProperties(this, { name: { enumerable: true, writable: false, value: name }, @@ -218,9 +207,7 @@ Pipeline.prototype.getNodeInfo = function() { return new NodeInfo(args.name, this._id); }; -//Pipeline::getNodeInfo() end -//Pipeline::getSource() begin var ValidInputTensorsInfoExceptions = ['NotFoundError', 'AbortError']; function Source(name, pipeline_id) { Object.defineProperties(this, { @@ -290,9 +277,7 @@ Pipeline.prototype.getSource = function() { return new Source(args.name, this._id); }; -//Pipeline::getSource() end -//Pipeline::getSwitch() begin function Switch(name, type, pipeline_id) { Object.defineProperties(this, { name: { @@ -346,9 +331,7 @@ Pipeline.prototype.getSwitch = function() { return new Switch(nativeArgs.name, result.type, this._id); }; -//Pipeline::getSwitch() end -//Pipeline::getValve() begin var ValidValveIsOpenAndSetOpenExceptions = [ 'NotFoundError', 'NotSupportedError', @@ -423,9 +406,7 @@ Pipeline.prototype.getValve = function() { return new Valve(nativeArgs.name, this._id); }; -//Pipeline::getValve() end -//Pipeline::registerSinkListener() begin var ValidRegisterSinkListenerExceptions = [ 'InvalidValuesError', 'NotFoundError', @@ -468,9 +449,7 @@ Pipeline.prototype.registerSinkListener = function() { ); } }; -//Pipeline::registerSinkListener() end -//Pipeline::unregisterSinkListener() begin var ValidUnregisterSinkListenerExceptions = [ 'InvalidValuesError', 'NotFoundError', @@ -509,7 +488,6 @@ Pipeline.prototype.unregisterSinkListener = function() { var listenerName = kSinkListenerNamePrefix + args.name; native_.removeListener(listenerName); }; -//Pipeline::unregisterSinkListener() end var PropertyType = { BOOLEAN: 'BOOLEAN', @@ -521,7 +499,6 @@ var PropertyType = { UINT64: 'UINT64', STRING: 'STRING' }; -//NodeInfo::getProperty() begin var ValidNodeInfoGetPropertyExceptions = [ 'InvalidValuesError', 'NotFoundError', @@ -560,9 +537,7 @@ NodeInfo.prototype.getProperty = function() { return result.property; }; -//NodeInfo::getProperty() end -//NodeInfo::setProperty() begin var ValidNodeInfoSetPropertyExceptions = [ 'InvalidValuesError', 'NotFoundError', @@ -604,9 +579,7 @@ NodeInfo.prototype.setProperty = function() { ); } }; -//NodeInfo::setProperty() end -//Source::inputData() begin var ValidSourceInputDataExceptions = [ 'InvalidStateError', 'NotFoundError', @@ -640,9 +613,7 @@ Source.prototype.inputData = function() { return result.result; }; -//Source::inputData() end -//Switch::getPadList() begin var ValidSwitchGetPadListExceptions = [ 'InvalidStateError', 'NotFoundError', @@ -667,9 +638,7 @@ Switch.prototype.getPadList = function() { return result.result; }; -//Switch::getPadList() end -//Switch::select() begin var ValidSwitchSelectExceptions = [ 'InvalidValuesError', 'NotFoundError', @@ -706,9 +675,7 @@ Switch.prototype.select = function() { ); } }; -//Switch::select() end -//Valve::setOpen() begin Valve.prototype.setOpen = function() { var args = validator_.validateArgs(arguments, [ { @@ -739,12 +706,10 @@ Valve.prototype.setOpen = function() { ); } }; -//Valve::setOpen() end var MachineLearningPipeline = function() {}; MachineLearningPipeline.prototype.createPipeline = CreatePipeline; -//Pipeline::registerCustomFilter() begin var ValidRegisterCustomFilterExceptions = [ 'InvalidValuesError', 'NotSupportedError', @@ -915,9 +880,7 @@ MachineLearningPipeline.prototype.registerCustomFilter = function() { ); } }; -//Pipeline::registerCustomFilter() end -//Pipeline::unregisterCustomFilter() begin var ValidUnregisterCustomFilterExceptions = [ 'InvalidStateError', 'InvalidValuesError', @@ -953,6 +916,3 @@ MachineLearningPipeline.prototype.unregisterCustomFilter = function() { var customFilterListenerName = kCustomFilterListenerNamePrefix + args.name; native_.removeListener(customFilterListenerName); }; -//Pipeline::unregisterCustomFilter() end - -// ML Pipeline API diff --git a/src/ml/js/ml_single.js b/src/ml/js/ml_single.js index b78c0100..b9598d79 100755 --- a/src/ml/js/ml_single.js +++ b/src/ml/js/ml_single.js @@ -16,7 +16,6 @@ var MachineLearningSingle = function() {}; -// MachineLearningSingle::openModel() var ValidOpenModelExceptions = [ 'InvalidValuesError', 'NotFoundError', @@ -100,7 +99,6 @@ MachineLearningSingle.prototype.openModel = function() { return new SingleShot(result.id); }; -// MachineLearningSingle::openModelAsync() var ValidOpenModelAsyncCallbackErrors = [ 'InvalidValuesError', 'NotFoundError', @@ -204,7 +202,6 @@ MachineLearningSingle.prototype.openModelAsync = function() { } }; -// SingleShot interface (input & output) function checkSingleShotNotClosed(singleshot) { if (singleshot._id === undefined) { throw new WebAPIException( diff --git a/src/ml/ml_instance.cc b/src/ml/ml_instance.cc index 07b8a81f..c6be5415 100644 --- a/src/ml/ml_instance.cc +++ b/src/ml/ml_instance.cc @@ -30,35 +30,47 @@ namespace extension { namespace ml { namespace { -const std::string kNnfw = "nnfw"; +const int kCustomFilterSuccess = 0; +const int kNoId = -1; +const std::string kAsync = "async"; +const std::string kBOOLEAN = "BOOLEAN"; +const std::string kBuffer = "buffer"; +const std::string kCallbackId = "callbackId"; +const std::string kDataId = "dataId"; +const std::string kDefinition = "definition"; +const std::string kDimensions = "dimensions"; +const std::string kFwType = "fwType"; +const std::string kGetInputMode = "getInputMode"; const std::string kHw = "hw"; -const std::string kTensorsInfoId = "tensorsInfoId"; -const std::string kTensorsDataId = "tensorsDataId"; +const std::string kHwType = "hwType"; +const std::string kId = "id"; const std::string kIndex = "index"; -const std::string kType = "type"; +const std::string kInputTensorsInfoId = "inputTensorsInfoId"; +const std::string kInTensorsInfo = "inTensorsInfo"; +const std::string kIsDynamicMode = "isDynamicMode"; +const std::string kListenerName = "listenerName"; +const std::string kLocation = "location"; +const std::string kModelPath = "modelPath"; const std::string kName = "name"; -const std::string kDimensions = "dimensions"; -const std::string kId = "id"; -const std::string kDefinition = "definition"; -const std::string kPipelineStateChangeListenerName = "listenerName"; +const std::string kNnfw = "nnfw"; +const std::string kNodeName = "nodeName"; +const std::string kOpen = "open"; const std::string kOtherId = "otherId"; +const std::string kOutputTensorsInfoId = "outputTensorsInfoId"; +const std::string kOutTensorsInfo = "outTensorsInfo"; const std::string kPadName = "padName"; -const std::string kOpen = "open"; -const std::string kNodeName = "nodeName"; +const std::string kPipelineStateChangeListenerName = "listenerName"; const std::string kProperty = "property"; -const std::string kBOOLEAN = "BOOLEAN"; -const std::string kSTRING = "STRING"; -const std::string kBuffer = "buffer"; -const std::string kSize = "size"; -const std::string kLocation = "location"; +const std::string kRequestId = "requestId"; const std::string kShape = "shape"; -const std::string kListenerName = "listenerName"; -const std::string kInputTensorsInfoId = "inputTensorsInfoId"; -const std::string kOutputTensorsInfoId = "outputTensorsInfoId"; +const std::string kSize = "size"; const std::string kStatus = "status"; -const std::string kDataId = "dataId"; -const std::string kRequestId = "requestId"; -const int kCustomFilterSuccess = 0; +const std::string kSTRING = "STRING"; +const std::string kTensorsDataId = "tensorsDataId"; +const std::string kTensorsInfoId = "tensorsInfoId"; +const std::string kTimeout = "timeout"; +const std::string kType = "type"; +const std::string kValue = "value"; } // namespace using namespace common; @@ -97,7 +109,6 @@ MlInstance::MlInstance() #define REGISTER_METHOD(M) RegisterSyncHandler(#M, std::bind(&MlInstance::M, this, _1, _2)) - // Common ML API begin REGISTER_METHOD(MLCheckNNFWAvailability); REGISTER_METHOD(MLTensorsInfoCountGetter); REGISTER_METHOD(MLTensorsInfoAddTensorInfo); @@ -121,7 +132,6 @@ MlInstance::MlInstance() REGISTER_METHOD(MLTensorsDataGetTensorType); REGISTER_METHOD(MLTensorsDataSetTensorRawData); - // Single API begin REGISTER_METHOD(MLSingleManagerOpenModel); REGISTER_METHOD(MLSingleShotGetTensorsInfo); REGISTER_METHOD(MLSingleShotSetInputInfo); @@ -131,9 +141,6 @@ MlInstance::MlInstance() REGISTER_METHOD(MLSingleShotSetTimeout); REGISTER_METHOD(MLSingleShotClose); - // Single API end - - // Pipeline API begin REGISTER_METHOD(MLPipelineManagerCreatePipeline); REGISTER_METHOD(MLPipelineGetState); REGISTER_METHOD(MLPipelineDispose); @@ -154,7 +161,6 @@ MlInstance::MlInstance() REGISTER_METHOD(MLPipelineManagerRegisterCustomFilter); REGISTER_METHOD(MLPipelineManagerCustomFilterOutput); REGISTER_METHOD(MLPipelineManagerUnregisterCustomFilter); -// Pipeline API end #undef REGISTER_METHOD } @@ -172,7 +178,6 @@ TensorsDataManager& MlInstance::GetTensorsDataManager() { return tensors_data_manager_; } -// Common ML API begin void MlInstance::MLCheckNNFWAvailability(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); CHECK_EXIST(args, kNnfw, out) @@ -734,25 +739,6 @@ void MlInstance::MLTensorsDataSetTensorRawData(const picojson::value& args, pico ReportSuccess(out); } -// Common ML API end - -// Single API begin - -// TODO move to the up section with field names -namespace { -const std::string kTimeout = "timeout"; -const std::string kModelPath = "modelPath"; -const std::string kInTensorsInfo = "inTensorsInfo"; -const std::string kOutTensorsInfo = "outTensorsInfo"; -const std::string kFwType = "fwType"; -const std::string kHwType = "hwType"; -const std::string kIsDynamicMode = "isDynamicMode"; -const std::string kValue = "value"; -const std::string kCallbackId = "callbackId"; -const std::string kAsync = "async"; - -const int kNoId = -1; -} // namespace void MlInstance::MLSingleManagerOpenModel(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -849,11 +835,6 @@ void MlInstance::MLSingleManagerOpenModel(const picojson::value& args, picojson: } } -// SingleShot input/output -// TODO move to the up section with field names -namespace { -const std::string kGetInputMode = "getInputMode"; -} // namespace void MlInstance::MLSingleShotGetTensorsInfo(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); CHECK_ARGS(args, kId, double, out); @@ -997,11 +978,6 @@ void MlInstance::MLSingleShotClose(const picojson::value& args, picojson::object ReportSuccess(out); } -// Single API end - -// Pipeline API begin - -// PipelineManager::createPipeline() begin namespace { bool CreatePipelineArgumentsAreInvalid(const picojson::value& args) { @@ -1043,9 +1019,7 @@ void MlInstance::MLPipelineManagerCreatePipeline(const picojson::value& args, ReportSuccess(out); } -// PipelineManager::createPipeline() end -// Pipeline::state begin void MlInstance::MLPipelineGetState(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1066,9 +1040,7 @@ void MlInstance::MLPipelineGetState(const picojson::value& args, picojson::objec ReportSuccess(state_value, out); } -// Pipeline::state end -// Pipeline::start() begin void MlInstance::MLPipelineStart(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1085,9 +1057,7 @@ void MlInstance::MLPipelineStart(const picojson::value& args, picojson::object& ReportSuccess(out); } -// Pipeline::start() end -// Pipeline::stop() begin void MlInstance::MLPipelineStop(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1104,9 +1074,7 @@ void MlInstance::MLPipelineStop(const picojson::value& args, picojson::object& o ReportSuccess(out); } -// Pipeline::stop() end -// Pipeline::dispose() begin void MlInstance::MLPipelineDispose(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1126,9 +1094,7 @@ void MlInstance::MLPipelineDispose(const picojson::value& args, picojson::object ReportSuccess(out); } -// Pipeline::dispose() end -// Pipeline::getNodeInfo() begin void MlInstance::MLPipelineGetNodeInfo(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1147,9 +1113,7 @@ void MlInstance::MLPipelineGetNodeInfo(const picojson::value& args, picojson::ob ReportSuccess(out); } -// Pipeline::getNodeInfo() end -// Pipeline::getSource() begin void MlInstance::MLPipelineGetSource(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1168,9 +1132,7 @@ void MlInstance::MLPipelineGetSource(const picojson::value& args, picojson::obje ReportSuccess(out); } -// Pipeline::getSource() end -// Pipeline::getSwitch() begin void MlInstance::MLPipelineGetSwitch(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1199,9 +1161,7 @@ void MlInstance::MLPipelineGetSwitch(const picojson::value& args, picojson::obje out["type"] = picojson::value{type}; ReportSuccess(out); } -// Pipeline::getSwitch() end -// Pipeline::getValve() begin void MlInstance::MLPipelineGetValve(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1219,9 +1179,7 @@ void MlInstance::MLPipelineGetValve(const picojson::value& args, picojson::objec ReportSuccess(out); } -// Pipeline::getValve() end -// Pipeline::registerSinkCallback() begin void MlInstance::MLPipelineRegisterSinkListener(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1242,9 +1200,7 @@ void MlInstance::MLPipelineRegisterSinkListener(const picojson::value& args, ReportSuccess(out); } -// Pipeline::registerSinkCallback() end -// Pipeline::unregisterSinkCallback() begin void MlInstance::MLPipelineUnregisterSinkListener(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1263,9 +1219,7 @@ void MlInstance::MLPipelineUnregisterSinkListener(const picojson::value& args, ReportSuccess(out); } -// Pipeline::unregisterSinkCallback() end -// Pipeline::registerCustomFilter() begin void MlInstance::MLPipelineManagerRegisterCustomFilter(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1307,7 +1261,6 @@ void MlInstance::MLPipelineManagerRegisterCustomFilter(const picojson::value& ar ReportSuccess(out); } -// Pipeline::registerCustomFilter() end void MlInstance::MLPipelineManagerCustomFilterOutput(const picojson::value& args, picojson::object& out) { @@ -1330,7 +1283,6 @@ void MlInstance::MLPipelineManagerCustomFilterOutput(const picojson::value& args ReportSuccess(out); } -// Pipeline::unregisterCustomFilter() begin void MlInstance::MLPipelineManagerUnregisterCustomFilter(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1347,9 +1299,7 @@ void MlInstance::MLPipelineManagerUnregisterCustomFilter(const picojson::value& ReportSuccess(out); } -// Pipeline::unregisterCustomFilter() end -// NodeInfo::getProperty() begin void MlInstance::MLPipelineNodeInfoGetProperty(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1372,9 +1322,7 @@ void MlInstance::MLPipelineNodeInfoGetProperty(const picojson::value& args, pico ReportSuccess(out); } -// NodeInfo::getProperty() end -// NodeInfo::setProperty() begin void MlInstance::MLPipelineNodeInfoSetProperty(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1406,9 +1354,7 @@ void MlInstance::MLPipelineNodeInfoSetProperty(const picojson::value& args, pico ReportSuccess(out); } -// NodeInfo::setProperty() end -// Source::inputTensorsInfo begin void MlInstance::MLPipelineGetInputTensorsInfo(const picojson::value& args, picojson::object& out) { ScopeLogger("args: [%s]", args.serialize().c_str()); @@ -1427,9 +1373,7 @@ void MlInstance::MLPipelineGetInputTensorsInfo(const picojson::value& args, pico ReportSuccess(out); } -// Source::inputTensorsInfo end -// Source::inputData() begin void MlInstance::MLPipelineSourceInputData(const picojson::value& args, picojson::object& out) { ScopeLogger("args: [%s]", args.serialize().c_str()); @@ -1457,9 +1401,7 @@ void MlInstance::MLPipelineSourceInputData(const picojson::value& args, picojson ReportSuccess(out); } -// Source::inputData() end -// Switch::getPadList() begin void MlInstance::MLPipelineSwitchGetPadList(const picojson::value& args, picojson::object& out) { ScopeLogger("args: [%s]", args.serialize().c_str()); @@ -1478,9 +1420,7 @@ void MlInstance::MLPipelineSwitchGetPadList(const picojson::value& args, picojso ReportSuccess(picojson::value{std::move(pad_list)}, out); } -// Switch::getPadList() end -// Switch::select() end void MlInstance::MLPipelineSwitchSelect(const picojson::value& args, picojson::object& out) { ScopeLogger("args: [%s]", args.serialize().c_str()); @@ -1500,9 +1440,7 @@ void MlInstance::MLPipelineSwitchSelect(const picojson::value& args, picojson::o ReportSuccess(out); } -// Switch::select() end -// Valve::setOpen() begin void MlInstance::MLPipelineValveSetOpen(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1522,9 +1460,7 @@ void MlInstance::MLPipelineValveSetOpen(const picojson::value& args, picojson::o ReportSuccess(out); } -// Valve::setOpen() end -// Valve::isOpen() begin void MlInstance::MLPipelineValveIsOpen(const picojson::value& args, picojson::object& out) { ScopeLogger("args: %s", args.serialize().c_str()); @@ -1543,9 +1479,6 @@ void MlInstance::MLPipelineValveIsOpen(const picojson::value& args, picojson::ob ReportSuccess(picojson::value{open}, out); } -// Valve::isOpen() end - -// Pipeline API end #undef CHECK_EXIST #undef CHECK_TYPE diff --git a/src/ml/ml_instance.h b/src/ml/ml_instance.h index 0f1f92e2..11af609f 100644 --- a/src/ml/ml_instance.h +++ b/src/ml/ml_instance.h @@ -39,7 +39,6 @@ class MlInstance : public common::ParsedInstance { TensorsDataManager& GetTensorsDataManager(); private: - // Common ML API begin void MLCheckNNFWAvailability(const picojson::value& args, picojson::object& out); void MLTensorsInfoCountGetter(const picojson::value& args, picojson::object& out); void MLTensorsInfoCreate(const picojson::value& args, picojson::object& out); @@ -68,9 +67,7 @@ class MlInstance : public common::ParsedInstance { TensorsInfoManager tensors_info_manager_; TensorsDataManager tensors_data_manager_; common::Worker worker_; - // Common ML API end - // Single API begin SingleManager single_manager_; void MLSingleManagerOpenModel(const picojson::value& args, picojson::object& out); void MLSingleShotGetTensorsInfo(const picojson::value& args, picojson::object& out); @@ -80,9 +77,7 @@ class MlInstance : public common::ParsedInstance { void MLSingleShotSetValue(const picojson::value& args, picojson::object& out); void MLSingleShotSetTimeout(const picojson::value& args, picojson::object& out); void MLSingleShotClose(const picojson::value& args, picojson::object& out); - // Single API end - // Pipeline API begin /* * ########## IMPORTANT ########## * Ensure, that pipeline_manager_ field appears AFTER tensors_info_manager_ @@ -107,91 +102,49 @@ class MlInstance : public common::ParsedInstance { */ PipelineManager pipeline_manager_; - // PipelineManager::createPipeline() begin void MLPipelineManagerCreatePipeline(const picojson::value& args, picojson::object& out); - // PipelineManager::createPipeline() end - // Pipeline::state begin void MLPipelineGetState(const picojson::value& args, picojson::object& out); - // Pipeline::state end - // Pipeline::start() begin void MLPipelineStart(const picojson::value& args, picojson::object& out); - // Pipeline::start() end - // Pipeline::stop() begin void MLPipelineStop(const picojson::value& args, picojson::object& out); - // Pipeline::stop() end - // Pipeline::dispose() begin void MLPipelineDispose(const picojson::value& args, picojson::object& out); - // Pipeline::dispose() end - // Pipeline::getNodeInfo() begin void MLPipelineGetNodeInfo(const picojson::value& args, picojson::object& out); - // Pipeline::getNodeInfo() end - // Pipeline::getSource() begin void MLPipelineGetSource(const picojson::value& args, picojson::object& out); - // Pipeline::getSource() end - // Pipeline::getSwitch() begin void MLPipelineGetSwitch(const picojson::value& args, picojson::object& out); - // Pipeline::getSwitch() end - // Pipeline::getValve() begin void MLPipelineGetValve(const picojson::value& args, picojson::object& out); - // Pipeline::getValve() end - // Pipeline::registerSinkCallback() begin void MLPipelineRegisterSinkListener(const picojson::value& args, picojson::object& out); - // Pipeline::registerSinkCallback() end - // Pipeline::unregisterSinkCallback() begin void MLPipelineUnregisterSinkListener(const picojson::value& args, picojson::object& out); - // Pipeline::unregisterSinkCallback() end - // Pipeline::registerCustomFilter() begin void MLPipelineManagerRegisterCustomFilter(const picojson::value& args, picojson::object& out); + void MLPipelineManagerCustomFilterOutput(const picojson::value& args, picojson::object& out); - // Pipeline::registerCustomFilter() end - // Pipeline::unregisterCustomFilter() begin void MLPipelineManagerUnregisterCustomFilter(const picojson::value& args, picojson::object& out); - // Pipeline::unregisterCustomFilter() end - // NodeInfo::getProperty() begin void MLPipelineNodeInfoGetProperty(const picojson::value& args, picojson::object& out); - // NodeInfo::getProperty() end - // NodeInfo::setProperty() begin void MLPipelineNodeInfoSetProperty(const picojson::value& args, picojson::object& out); - // NodeInfo::setProperty() end - // Source::inputTensorsInfo begin void MLPipelineGetInputTensorsInfo(const picojson::value& args, picojson::object& out); - // Source::inputTensorsInfo end - // Source::inputData() begin void MLPipelineSourceInputData(const picojson::value& args, picojson::object& out); - // Source::inputData() end - // Switch::getPadList() begin void MLPipelineSwitchGetPadList(const picojson::value& args, picojson::object& out); - // Switch::getPadList() end - // Switch::select() begin void MLPipelineSwitchSelect(const picojson::value& args, picojson::object& out); - // Switch::select() end - // Valve::setOpen() begin void MLPipelineValveSetOpen(const picojson::value& args, picojson::object& out); - // Valve::setOpen() end - // Valve::isOpen() begin void MLPipelineValveIsOpen(const picojson::value& args, picojson::object& out); - // Valve::isOpen() end - // Pipeline API end }; } // namespace ml diff --git a/src/ml/ml_pipeline.cc b/src/ml/ml_pipeline.cc index 81b0c8d8..3d2ade86 100644 --- a/src/ml/ml_pipeline.cc +++ b/src/ml/ml_pipeline.cc @@ -77,7 +77,6 @@ Pipeline::Pipeline(int id, const std::string& state_change_listener_name, ScopeLogger("id: [%d], state_change_listener_name: [%s]", id, state_change_listener_name.c_str()); } -// Pipeline::createPipeline() begin PlatformResult Pipeline::CreatePipeline(int id, const std::string& definition, const std::string& state_change_listener_name, common::Instance* instance_ptr, @@ -119,7 +118,6 @@ PlatformResult Pipeline::CreatePipeline(int id, const std::string& definition, *out = std::move(pipeline_ptr); return PlatformResult{}; } -// Pipeline::createPipeline() end Pipeline::~Pipeline() { ScopeLogger("Destroying pipeline: [%d]", id_); @@ -166,7 +164,6 @@ void Pipeline::PipelineStateChangeListener(ml_pipeline_state_e state, void* user common::Instance::PostMessage(pipeline->instance_ptr_, response); } -// Pipeline::state begin PlatformResult Pipeline::GetState(std::string* out) { ScopeLogger("id_: [%d]", id_); @@ -181,9 +178,7 @@ PlatformResult Pipeline::GetState(std::string* out) { *out = StateToString(state); return PlatformResult{}; } -// Pipeline::state end -// Pipeline::start() begin PlatformResult Pipeline::Start() { ScopeLogger("id_: [%d]", id_); @@ -194,9 +189,7 @@ PlatformResult Pipeline::Start() { } return PlatformResult{}; } -// Pipeline::start() end -// Pipeline::stop() begin PlatformResult Pipeline::Stop() { ScopeLogger("id_: [%d]", id_); @@ -207,9 +200,7 @@ PlatformResult Pipeline::Stop() { } return PlatformResult{}; } -// Pipeline::stop() end -// Pipeline::dispose() begin PlatformResult Pipeline::Dispose() { ScopeLogger("id_: [%d]", id_); @@ -239,7 +230,8 @@ PlatformResult Pipeline::Dispose() { } /* - * TODO in future commits: + * ****** VERY IMPORTANT! ****** + * READ BEFORE ADDING NEW NODES! * * Release all nodes belonging to this pipeline and * cached in this object in containers like @@ -269,9 +261,7 @@ PlatformResult Pipeline::Dispose() { return PlatformResult{}; } -// Pipeline::dispose() end -// Pipeline::getNodeInfo() begin PlatformResult Pipeline::GetNodeInfo(const std::string& name) { ScopeLogger("id_: [%d], name: [%s]", id_, name.c_str()); @@ -292,9 +282,7 @@ PlatformResult Pipeline::GetNodeInfo(const std::string& name) { return PlatformResult{}; } -// Pipeline::getNodeInfo() end -// Pipeline::getSource() begin PlatformResult Pipeline::GetSource(const std::string& name) { ScopeLogger("id: [%d], name: [%s]", id_, name.c_str()); @@ -311,9 +299,7 @@ PlatformResult Pipeline::GetSource(const std::string& name) { } return ret; } -// Pipeline::getSource() end -// Pipeline::getSwitch() begin PlatformResult Pipeline::GetSwitch(const std::string& name, std::string* type) { ScopeLogger("id: [%d], name: [%s]", id_, name.c_str()); @@ -333,9 +319,7 @@ PlatformResult Pipeline::GetSwitch(const std::string& name, std::string* type) { } return ret; } -// Pipeline::getSwitch() end -// Pipeline::getValve() begin PlatformResult Pipeline::GetValve(const std::string& name) { ScopeLogger("id: [%d], name: [%s]", id_, name.c_str()); @@ -353,9 +337,7 @@ PlatformResult Pipeline::GetValve(const std::string& name) { } return ret; } -// Pipeline::getValve() end -// Pipeline::registerSinkCallback() begin PlatformResult Pipeline::RegisterSinkListener(const std::string& sink_name, const std::string& listener_name) { ScopeLogger("sink_name: [%s], listener_name: [%s], id_: [%d]", sink_name.c_str(), @@ -377,9 +359,7 @@ PlatformResult Pipeline::RegisterSinkListener(const std::string& sink_name, return PlatformResult{}; } -// Pipeline::registerSinkCallback() end -// Pipeline::unregisterSinkCallback() begin PlatformResult Pipeline::UnregisterSinkListener(const std::string& sink_name) { ScopeLogger("sink_name: [%s], id_: [%d]", sink_name.c_str(), id_); @@ -395,9 +375,7 @@ PlatformResult Pipeline::UnregisterSinkListener(const std::string& sink_name) { } return ret; } -// Pipeline::unregisterSinkCallback() end -// NodeInfo::getProperty() begin PlatformResult Pipeline::getProperty(const std::string& node_name, const std::string& name, const std::string& type, picojson::object* property) { ScopeLogger("id_: [%d], name: [%s], type: [%s]", id_, name.c_str(), type.c_str()); @@ -410,9 +388,7 @@ PlatformResult Pipeline::getProperty(const std::string& node_name, const std::st return nodeinfo_it->second->getProperty(name, type, property); } -// NodeInfo::getProperty() end -// NodeInfo::setProperty() begin PlatformResult Pipeline::setProperty(const std::string& node_name, const std::string& name, const std::string& type, const picojson::value& property) { ScopeLogger("id_: [%d], name: [%s], type: [%s]", id_, name.c_str(), type.c_str()); @@ -425,9 +401,7 @@ PlatformResult Pipeline::setProperty(const std::string& node_name, const std::st return nodeinfo_it->second->setProperty(name, type, property); } -// NodeInfo::setProperty() end -// Source::inputTensorsInfo begin PlatformResult Pipeline::getInputTensorsInfo(const std::string& name, ml_tensors_info_h* result) { ScopeLogger(); @@ -439,9 +413,7 @@ PlatformResult Pipeline::getInputTensorsInfo(const std::string& name, ml_tensors return source_it->second->getInputTensorsInfo(result); } -// Source::inputTensorsInfo end -// Source::inputData() begin PlatformResult Pipeline::SourceInputData(const std::string& name, TensorsData* tensors_data) { ScopeLogger(); @@ -453,9 +425,7 @@ PlatformResult Pipeline::SourceInputData(const std::string& name, TensorsData* t return source_it->second->SourceInputData(tensors_data); } -// Source::inputData() end -// Switch::getPadList() begin PlatformResult Pipeline::GetSwitch(const std::string& name, Switch** out) { ScopeLogger("id: [%d], name: [%s]", id_, name.c_str()); @@ -469,9 +439,6 @@ PlatformResult Pipeline::GetSwitch(const std::string& name, Switch** out) { return PlatformResult{ErrorCode::ABORT_ERR, "Switch does not exist"}; } -// Switch::getPadList() end - -// Valve::setOpen() begin PlatformResult Pipeline::GetNodeInfo(const std::string& name, NodeInfo** out) { ScopeLogger("id_: [%d], name: [%s]", id_, name.c_str()); @@ -492,7 +459,6 @@ PlatformResult Pipeline::GetValve(const std::string& name, Valve** out) { } return ret; } -// Valve::setOpen() end } // namespace extension } // namespace ml diff --git a/src/ml/ml_pipeline.h b/src/ml/ml_pipeline.h index cc370ce4..1b1f633c 100644 --- a/src/ml/ml_pipeline.h +++ b/src/ml/ml_pipeline.h @@ -42,7 +42,6 @@ namespace ml { class Pipeline { public: - // PipelineManager::createPipeline() begin /* * We use a static function to create Pipeline objects, instead of * a typical constructor, to be able to return an error without @@ -53,81 +52,48 @@ class Pipeline { common::Instance* instance_ptr, TensorsInfoManager* tensors_info_manager_ptr, std::unique_ptr* out); - // PipelineManager::createPipeline() end Pipeline() = delete; Pipeline(const Pipeline&) = delete; Pipeline& operator=(const Pipeline&) = delete; ~Pipeline(); - // Pipeline::state begin PlatformResult GetState(std::string* out); - // Pipeline::state end - // Pipeline::start() begin PlatformResult Start(); - // Pipeline::start() end - // Pipeline::stop() begin PlatformResult Stop(); - // Pipeline::stop() end - // Pipeline::dispose() begin PlatformResult Dispose(); - // Pipeline::dispose() end - // Pipeline::getNodeInfo() begin PlatformResult GetNodeInfo(const std::string& name); - // Pipeline::getNodeInfo() end - // Pipeline::getSource() begin PlatformResult GetSource(const std::string& name); - // Pipeline::getSource() end - // Pipeline::getSwitch() begin PlatformResult GetSwitch(const std::string& name, std::string* type); - // Pipeline::getSwitch() end - // Pipeline::getValve() begin PlatformResult GetValve(const std::string& name); - // Pipeline::getValve() end - // Pipeline::registerSinkCallback() begin PlatformResult RegisterSinkListener(const std::string& sink_name, const std::string& listener_name); - // Pipeline::registerSinkCallback() end - // Pipeline::unregisterSinkCallback() begin PlatformResult UnregisterSinkListener(const std::string& sink_name); - // Pipeline::unregisterSinkCallback() end - // NodeInfo::getProperty() begin PlatformResult getProperty(const std::string& node_name, const std::string& name, const std::string& type, picojson::object* property); - // NodeInfo::getProperty() end - // NodeInfo::setProperty() begin PlatformResult setProperty(const std::string& node_name, const std::string& name, const std::string& type, const picojson::value& property); - // NodeInfo::setProperty() end - // Source::inputTensorsInfo begin PlatformResult getInputTensorsInfo(const std::string& name, ml_tensors_info_h* result); - // Source::inputTensorsInfo end - // Source::inputData() begin PlatformResult SourceInputData(const std::string& name, TensorsData* tensors_data); - // Source::inputData() end - // Switch::getPadList() begin PlatformResult GetSwitch(const std::string& name, Switch** out); - // Switch::getPadList() end - - // Valve::setOpen() begin PlatformResult GetNodeInfo(const std::string& name, NodeInfo** out); PlatformResult GetValve(const std::string& name, Valve** out); - // Valve::setOpen() end + private: Pipeline(int id, const std::string& state_change_listener_name, TensorsInfoManager* tensors_info_manager_ptr, common::Instance* instance_ptr); diff --git a/src/ml/ml_pipeline_manager.cc b/src/ml/ml_pipeline_manager.cc index 91bbdcd6..8daf6cf5 100644 --- a/src/ml/ml_pipeline_manager.cc +++ b/src/ml/ml_pipeline_manager.cc @@ -42,7 +42,6 @@ PipelineManager::~PipelineManager() { ScopeLogger(); } -// PipelineManager::createPipeline() begin PlatformResult PipelineManager::CreatePipeline(int id, const std::string& definition, const std::string& state_change_listener_name) { ScopeLogger("id: [%d], definition: [%s], state_change_listener_name: [%s]", id, @@ -64,9 +63,7 @@ PlatformResult PipelineManager::CreatePipeline(int id, const std::string& defini return PlatformResult{}; } -// PipelineManager::createPipeline() end -// Pipeline::state begin PlatformResult PipelineManager::GetPipelineState(int id, std::string* out) { ScopeLogger("id: [%d]", id); @@ -80,9 +77,7 @@ PlatformResult PipelineManager::GetPipelineState(int id, std::string* out) { auto ret = pipeline_it->second->GetState(out); return ret; } -// Pipeline::state end -// Pipeline::start() begin PlatformResult PipelineManager::Start(int id) { ScopeLogger("id: [%d]", id); @@ -95,9 +90,7 @@ PlatformResult PipelineManager::Start(int id) { auto ret = pipeline_it->second->Start(); return ret; } -// Pipeline::start() end -// Pipeline::stop() begin PlatformResult PipelineManager::Stop(int id) { ScopeLogger("id: [%d]", id); @@ -110,9 +103,7 @@ PlatformResult PipelineManager::Stop(int id) { auto ret = pipeline_it->second->Stop(); return ret; } -// Pipeline::stop() end -// Pipeline::dispose() begin PlatformResult PipelineManager::DisposePipeline(int id) { ScopeLogger("id: [%d]", id); @@ -134,9 +125,7 @@ PlatformResult PipelineManager::DisposePipeline(int id) { return ret; } -// Pipeline::dispose() end -// Pipeline::getNodeInfo() begin PlatformResult PipelineManager::GetNodeInfo(int id, std::string& name) { ScopeLogger("id: [%d], name [%s]", id, name.c_str()); @@ -149,9 +138,7 @@ PlatformResult PipelineManager::GetNodeInfo(int id, std::string& name) { auto ret = pipeline_it->second->GetNodeInfo(name); return ret; } -// Pipeline::getNodeInfo() end -// Pipeline::getSource() begin PlatformResult PipelineManager::GetSource(int pipeline_id, const std::string& name) { ScopeLogger("name: [%s], pipeline_id: [%d]", name.c_str(), pipeline_id); @@ -163,9 +150,7 @@ PlatformResult PipelineManager::GetSource(int pipeline_id, const std::string& na return pipeline_it->second->GetSource(name); } -// Pipeline::getSource() end -// Pipeline::getSwitch() begin PlatformResult PipelineManager::GetSwitch(const std::string& name, int pipeline_id, std::string* type) { ScopeLogger("name: [%s], pipeline_id: [%d]", name.c_str(), pipeline_id); @@ -178,9 +163,7 @@ PlatformResult PipelineManager::GetSwitch(const std::string& name, int pipeline_ return pipeline_it->second->GetSwitch(name, type); } -// Pipeline::getSwitch() end -// Pipeline::getValve() begin PlatformResult PipelineManager::GetValve(const std::string& name, int pipeline_id) { ScopeLogger("name: [%s], pipeline_id: [%d]", name.c_str(), pipeline_id); @@ -192,9 +175,7 @@ PlatformResult PipelineManager::GetValve(const std::string& name, int pipeline_i return pipeline_it->second->GetValve(name); } -// Pipeline::getValve() end -// Pipeline::registerSinkCallback() begin PlatformResult PipelineManager::RegisterSinkListener(const std::string& sink_name, int pipeline_id, const std::string& listener_name) { ScopeLogger("sink_name: [%s], pipeline_id: [%d], listener_name: [%s]", sink_name.c_str(), @@ -208,9 +189,7 @@ PlatformResult PipelineManager::RegisterSinkListener(const std::string& sink_nam return pipeline_it->second->RegisterSinkListener(sink_name, listener_name); } -// Pipeline::registerSinkCallback() end -// Pipeline::unregisterSinkCallback() begin PlatformResult PipelineManager::UnregisterSinkListener(const std::string& sink_name, int pipeline_id) { ScopeLogger("sink_name: [%s], pipeline_id: [%d]", sink_name.c_str(), pipeline_id); @@ -223,9 +202,7 @@ PlatformResult PipelineManager::UnregisterSinkListener(const std::string& sink_n return pipeline_it->second->UnregisterSinkListener(sink_name); } -// Pipeline::unregisterSinkCallback() end -// Pipeline::registerCustomFilter() begin PlatformResult PipelineManager::RegisterCustomFilter(const std::string& custom_filter_name, const std::string& listener_name, TensorsInfo* input_tensors_info_ptr, @@ -254,7 +231,6 @@ PlatformResult PipelineManager::RegisterCustomFilter(const std::string& custom_f return PlatformResult{}; } -// Pipeline::registerCustomFilter() end PlatformResult PipelineManager::CustomFilterOutput(const std::string& custom_filter_name, int request_id, int status) { @@ -271,7 +247,6 @@ PlatformResult PipelineManager::CustomFilterOutput(const std::string& custom_fil return PlatformResult{}; } -// Pipeline::unregisterCustomFilter() begin PlatformResult PipelineManager::UnregisterCustomFilter(const std::string& custom_filter_name) { ScopeLogger("custom_filter_name: [%s]", custom_filter_name.c_str()); @@ -288,9 +263,7 @@ PlatformResult PipelineManager::UnregisterCustomFilter(const std::string& custom } return ret; } -// Pipeline::unregisterCustomFilter() end -// NodeInfo::getProperty() begin PlatformResult PipelineManager::getProperty(int id, const std::string& node_name, const std::string& name, const std::string& type, picojson::object* property) { @@ -305,9 +278,7 @@ PlatformResult PipelineManager::getProperty(int id, const std::string& node_name return pipeline_it->second->getProperty(node_name, name, type, property); } -// NodeInfo::getProperty() end -// NodeInfo::setProperty() begin PlatformResult PipelineManager::setProperty(int id, const std::string& node_name, const std::string& name, const std::string& type, const picojson::value& property) { @@ -322,9 +293,7 @@ PlatformResult PipelineManager::setProperty(int id, const std::string& node_name return pipeline_it->second->setProperty(node_name, name, type, property); } -// NodeInfo::setProperty() end -// Source::inputTensorsInfo begin PlatformResult PipelineManager::getInputTensorsInfo(int id, const std::string& name, int* res_id) { ScopeLogger(); @@ -343,9 +312,7 @@ PlatformResult PipelineManager::getInputTensorsInfo(int id, const std::string& n *res_id = tensor_info->Id(); return PlatformResult{}; } -// Source::inputTensorsInfo end -// Source::inputData() begin PlatformResult PipelineManager::SourceInputData(int id, const std::string& name, TensorsData* tensors_data) { ScopeLogger(); @@ -358,9 +325,7 @@ PlatformResult PipelineManager::SourceInputData(int id, const std::string& name, return pipeline_it->second->SourceInputData(name, tensors_data); } -// Source::inputData() end -// Switch::getPadList() begin PlatformResult PipelineManager::SwitchGetPadList(int pipeline_id, const std::string& switch_name, picojson::array* out) { ScopeLogger("pipeline_id: [%d], switch_name: [%s]", pipeline_id, switch_name.c_str()); @@ -379,9 +344,7 @@ PlatformResult PipelineManager::SwitchGetPadList(int pipeline_id, const std::str return switch_ptr->GetPadList(out); } -// Switch::getPadList() end -// Switch::select() begin PlatformResult PipelineManager::SwitchSelect(int pipeline_id, const std::string& switch_name, const std::string& pad_name) { ScopeLogger("pipeline_id: [%d], switch_name: [%s], pad_name: [%s]", pipeline_id, @@ -401,9 +364,7 @@ PlatformResult PipelineManager::SwitchSelect(int pipeline_id, const std::string& return switch_ptr->Select(pad_name); } -// Switch::select() end -// Valve::setOpen() begin PlatformResult PipelineManager::ValveSetOpen(int pipeline_id, const std::string& valve_name, bool open) { ScopeLogger("pipeline_id: [%d], valve_name: [%s], open: [%s]", pipeline_id, valve_name.c_str(), @@ -423,9 +384,7 @@ PlatformResult PipelineManager::ValveSetOpen(int pipeline_id, const std::string& return valve_ptr->SetOpen(open); } -// Valve::setOpen() end -// Valve::isOpen() begin PlatformResult PipelineManager::ValveIsOpen(int pipeline_id, const std::string& valve_name, bool* open) { ScopeLogger("pipeline_id: [%d], valve_name: [%s]", pipeline_id, valve_name.c_str()); @@ -444,7 +403,6 @@ PlatformResult PipelineManager::ValveIsOpen(int pipeline_id, const std::string& return valve_ptr->IsOpen(open); } -// Valve::isOpen() end } // namespace ml } // namespace extension diff --git a/src/ml/ml_pipeline_manager.h b/src/ml/ml_pipeline_manager.h index 9e617b78..e4c4d526 100644 --- a/src/ml/ml_pipeline_manager.h +++ b/src/ml/ml_pipeline_manager.h @@ -41,53 +41,30 @@ class PipelineManager { PipelineManager(const PipelineManager&) = delete; PipelineManager& operator=(const PipelineManager&) = delete; - // PipelineManager::createPipeline() begin PlatformResult CreatePipeline(int id, const std::string& definition, const std::string& state_change_listener_name); - // PipelineManager::createPipeline() end - // Pipeline::state begin PlatformResult GetPipelineState(int id, std::string* out); - // Pipeline::state end - // Pipeline::start() begin PlatformResult Start(int id); - // Pipeline::start() end - // Pipeline::stop() begin PlatformResult Stop(int id); - // Pipeline::stop() end - // Pipeline::dispose() begin PlatformResult DisposePipeline(int id); - // Pipeline::dispose() end - // Pipeline::getNodeInfo() begin PlatformResult GetNodeInfo(int id, std::string& name); - // Pipeline::getNodeInfo() end - // Pipeline::getSource() begin PlatformResult GetSource(int pipeline_id, const std::string& name); - // Pipeline::getSource() end - // Pipeline::getSwitch() begin PlatformResult GetSwitch(const std::string& name, int pipeline_id, std::string* type); - // Pipeline::getSwitch() end - // Pipeline::getValve() begin PlatformResult GetValve(const std::string& name, int pipeline_id); - // Pipeline::getValve() end - // Pipeline::registerSinkCallback() begin PlatformResult RegisterSinkListener(const std::string& sink_name, int pipeline_id, const std::string& listener_name); - // Pipeline::registerSinkCallback() end - // Pipeline::unregisterSinkCallback() begin PlatformResult UnregisterSinkListener(const std::string& sink_name, int pipeline_id); - // Pipeline::unregisterSinkCallback() end - // Pipeline::registerCustomFilter() begin PlatformResult RegisterCustomFilter(const std::string& custom_filter_name, const std::string& listener_name, TensorsInfo* input_tensors_info_ptr, @@ -95,47 +72,29 @@ class PipelineManager { PlatformResult CustomFilterOutput(const std::string& custom_filter_name, int request_id, int status); - // Pipeline::registerCustomFilter() end - // Pipeline::unregisterCustomFilter() begin PlatformResult UnregisterCustomFilter(const std::string& custom_filter_name); - // Pipeline::unregisterCustomFilter() end - // NodeInfo::getProperty() begin PlatformResult getProperty(int id, const std::string& node_name, const std::string& name, const std::string& type, picojson::object* property); - // NodeInfo::getProperty() end - // NodeInfo::setProperty() begin PlatformResult setProperty(int id, const std::string& node_name, const std::string& name, const std::string& type, const picojson::value& property); - // NodeInfo::setProperty() end - // Source::inputTensorsInfo begin PlatformResult getInputTensorsInfo(int id, const std::string& name, int* res_id); - // Source::inputTensorsInfo end - // Source::inputData() begin PlatformResult SourceInputData(int id, const std::string& name, TensorsData* tensors_data); - // Source::inputData() end - // Switch::getPadList() begin PlatformResult SwitchGetPadList(int pipeline_id, const std::string& switch_name, picojson::array* out); - // Switch::getPadList() end - // Switch::select() begin PlatformResult SwitchSelect(int pipeline_id, const std::string& switch_name, const std::string& pad_name); - // Switch::select() end - // Valve::setOpen() begin PlatformResult ValveSetOpen(int pipeline_id, const std::string& valve_name, bool open); - // Valve::setOpen() end - // Valve::isOpen() begin PlatformResult ValveIsOpen(int pipeline_id, const std::string& valve_name, bool* open); - // Valve::isOpen() end + private: common::Instance* instance_ptr_; TensorsInfoManager* tensors_info_manager_; diff --git a/src/ml/ml_single_manager.cc b/src/ml/ml_single_manager.cc index ef388258..644b9cdf 100644 --- a/src/ml/ml_single_manager.cc +++ b/src/ml/ml_single_manager.cc @@ -31,7 +31,6 @@ SingleManager::~SingleManager() { ScopeLogger(); } -// MachineLearningSingle::openModel() PlatformResult SingleManager::OpenModel(const std::string& modelPath, TensorsInfo* inTensorsInfo, TensorsInfo* outTensorsInfo, ml_nnfw_type_e nnfw_e, ml_nnfw_hw_e hw_e, bool isDynamicMode, int* res_id) { @@ -55,7 +54,6 @@ PlatformResult SingleManager::OpenModel(const std::string& modelPath, TensorsInf return PlatformResult{}; } -// SingleShot input SingleShot* SingleManager::GetSingleShot(int id) { ScopeLogger("id: %d", id); diff --git a/src/ml/ml_single_manager.h b/src/ml/ml_single_manager.h index 05fd040a..607ea8a8 100644 --- a/src/ml/ml_single_manager.h +++ b/src/ml/ml_single_manager.h @@ -39,12 +39,10 @@ class SingleManager { SingleManager(const SingleManager&) = delete; SingleManager& operator=(const SingleManager&) = delete; - // MachineLearningSingle::openModel() PlatformResult OpenModel(const std::string& modelPath, TensorsInfo* inTensorsInfo, TensorsInfo* outTensorsInfo, ml_nnfw_type_e nnfw_e, ml_nnfw_hw_e hw_e, bool isDynamicMode, int* res_id); - // MachineLearningSingle::openModelAsync() - // OpenModelSuccessCallback + PlatformResult GetNativeTensorsInfo(int id, bool get_input_mode, int* res_id); PlatformResult SetNativeInputInfo(int id, TensorsInfo* inTensorsInfo); PlatformResult Invoke(int id, TensorsData* in_tensors_data, TensorsData** out_tensors_data);