ACR: TWDAPI-274
This commit removes InvalidValuesError from the list of valid
tizen.ml.pipeline.createPipeline() exceptions, because we cannot
reliably detect, when a pipeline description is invalid.
Instead, AbortError with custom message, suggesting that the
description may be invalid, will be used.
[Verification] Tested in Chrome DevTools with the snippets below, works
fine
// Invalid pipeline definition
var pipeline_def = "invalid";
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def,
state => {console.log(state);})
// WebAPIException {name: "AbortError", message: "Could not create pipeline:
// invalid pipeline description or an internal error"}
//////////////////////////////////////////////////////////////////////
// Valid pipeline definition
var inputTI = new tizen.ml.TensorsInfo();
inputTI.addTensorInfo('ti1', 'UINT8', [4, 20, 15, 1]);
var outputTI = new tizen.ml.TensorsInfo();
outputTI.addTensorInfo('ti1', 'UINT8', [1200]);
var flattenAndSet123 = function(input, output) {
console.log("Custom filter called");
// dispose should have no efect
input.dispose();
console.log('input count: ' + input.tensorsInfo.count);
// dispose should have no efect
input.dispose();
console.log('output count: ' + output.tensorsInfo.count);
var rawOutputData = new Uint8Array(1200);
for (var i = 0; i < rawOutputData.length; ++i) {
rawOutputData[i] = 123;
}
output.setTensorRawData(0, rawOutputData);
// this call should have no effect
input.setTensorRawData(0, rawOutputData);
return 0;
}
tizen.ml.pipeline.registerCustomFilter('testfilter2', flattenAndSet123, inputTI,
outputTI, function errorCallback(error) {
console.warn('custom filter error:') ; console.warn(error);
});
var pipeline_def = "videotestsrc num-buffers=3 "
+ "! video/x-raw,width=20,height=15,format=BGRA "
+ "! tensor_converter "
+ "! tensor_filter framework=custom-easy model=testfilter2 "
+ "! appsink name=mysink";
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def,
state => {console.log(state);})
pipeline.registerSinkListener('mysink', function(sinkName, data) {
console.log('SinkListener for "' + sinkName + '" sink called');
console.log(data);
})
// pipeline starts properly
Change-Id: If8d08160cb98b3acc34812f47b2741c2cce83cd8
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
}
var ValidPipelineManagerCreatePipelineExceptions = [
- 'InvalidValuesError',
'TypeMismatchError',
'NotSupportedError',
'SecurityError',
if (ML_ERROR_NONE != ret) {
LoggerE("ml_pipeline_construct() failed: [%d] (%s)", ret, get_error_message(ret));
+ if (ML_ERROR_STREAMS_PIPE == ret) {
+ return PlatformResult{
+ ErrorCode::ABORT_ERR,
+ "Could not create pipeline: invalid pipeline description or an internal error"};
+ }
return util::ToPlatformResult(ret, "Could not create a pipeline");
}
LoggerD("ml_pipeline_construct() succeeded");