From: 이상규/On-Device Lab(SR)/Principal Engineer/삼성전자 Date: Fri, 5 Jul 2019 01:15:45 +0000 (+0900) Subject: [nnpackage] update spec for multiple layout (#5553) X-Git-Tag: submit/tizen/20190809.050447~590 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2c4c6b69a83291320181714ea68a74de35d18a7;p=platform%2Fcore%2Fml%2Fnnfw.git [nnpackage] update spec for multiple layout (#5553) Multiple layout is added in specification. Signed-off-by: Sanggyu Lee --- diff --git a/contrib/nnpackage/spec/20_model_and_operators.md b/contrib/nnpackage/spec/20_model_and_operators.md index 7deee8d..38d3600 100644 --- a/contrib/nnpackage/spec/20_model_and_operators.md +++ b/contrib/nnpackage/spec/20_model_and_operators.md @@ -33,6 +33,37 @@ TFLite's solution is acceptable, we don't need to create same thing again. `nnpackage` model has some extensions that are different or missing from TFLite. +### Multiple Layout + +`nnpackage` can support multiple layouts. + +1. The layout is presented using `DataFormat` enumeration. + +`DataFormat` must be one of the enumeration defined in `nnpackage_schema.fbs`. + +For example, `CHANNELS_FIRST` or `CHANNELS_LAST` can be used. + +``` + // For 2D data, NHWC(batch, height, width, channels) + // For 3D data, NDHWC(batch, depth, height, width, channels) + CHANNELS_LAST = 0, + // For 2D data, NCHW(batch, channels, height, width) + // For 3D data, NCDHW(batch, channels, depth, height, width) + CHANNELS_FIRST = 1, +``` + +2. `DataFormat` must be same within a submodel. + +Rationale: + +- frequent switching between different layout degrades the performance + +Under this assumption, We expect to + +- simplify the runtime implementation +- accelerate the performance +- reduce the memory usage + ### Unspecified Dimension `nnpackage` represents unspecified dimension with `-1`.