}
_input = new TensorsInfo(result.id);
}
- return _input;
+ return _input.clone();
},
set: function() {
checkSingleShotNotClosed(this);
AbortError
);
}
- _input = args.inTensorsInfo;
+ // dispose old input
+ if (_input instanceof tizen.ml.TensorsInfo) {
+ _input.dispose();
+ }
+ _input = new TensorsInfo(result.id);
+ // we need to invalidate _output if input changes
+ if (_output instanceof tizen.ml.TensorsInfo) {
+ _output.dispose();
+ _output = null;
+ }
}
},
output: {
return;
}
+ TensorsInfo* clone = GetTensorsInfoManager().CloneTensorsInfo(in_tensors_info);
+
auto ret = single_manager_.SetNativeInputInfo(id, in_tensors_info);
if (!ret) {
ReportError(ret, &out);
return;
}
+ out[kId] = picojson::value(static_cast<double>(clone->Id()));
ReportSuccess(out);
}
LoggerE("ml_single_set_input_info failed: %d (%s)", ret, get_error_message(ret));
return util::ToPlatformResult(ret, "Failed to set input info");
}
-
+ // invalidate output info and data in case of input change
+ if (nullptr != tensor_info_out_handle_) {
+ int ret = ml_tensors_info_destroy(tensor_info_out_handle_);
+ if (ML_ERROR_NONE != ret) {
+ LoggerE("ml_tensors_info_destroy failed: %d (%s)", ret, get_error_message(ret));
+ return PlatformResult(ErrorCode::ABORT_ERR, "Internal SingleShot error");
+ }
+ tensor_info_out_handle_ = nullptr;
+ }
+ if (nullptr != tensor_data_out_handle_) {
+ int ret = ml_tensors_data_destroy(tensor_data_out_handle_);
+ if (ML_ERROR_NONE != ret) {
+ LoggerE("ml_tensors_data_destroy failed: %d (%s)", ret, get_error_message(ret));
+ return PlatformResult(ErrorCode::ABORT_ERR, "Internal SingleShot error");
+ }
+ tensor_data_out_handle_ = nullptr;
+ }
return PlatformResult{};
}