diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-01-25 18:42:44 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-01-25 18:46:27 -0800 |
commit | 2b7d03c91d092cda88e6db345705fff3cd5b7b77 (patch) | |
tree | 134af913fef5fe6d89994eee5a2d8081d692a8ec /tensorflow/contrib/lite/toco/model_flags.proto | |
parent | 642454bd3296959f0025e1fb1730cdd95c36713f (diff) |
Allow passing dummy/custom minmax information on a per-array basis,
unlike the existing --default_ranges_{min,max} flags which only allowed
to set a single global value for all arrays.
This takes the form of a new embedded message in ModelFlags, which is
its own message so that it can be serialized separately. The command-line
interface is --arrays_extra_info_file=some_proto.pbtxt, i.e. we don't
try to make a command-line-flags-only interface, we mandate putting the info
in a file. The rationale is that users may want to specify custom minmax
for hundreds of arrays, so it would be cumbersome to have that all in a
command line.
This should be considered an experimental feature, in the sense that
in properly quantized models, minmax information is already embedded
in the graph (e.g. in FakeQuant nodes). This is an extension of the
existing --default_ranges_{min,max} feature which had turned out to be
too restrictive for many users.
PiperOrigin-RevId: 183326000
Diffstat (limited to 'tensorflow/contrib/lite/toco/model_flags.proto')
-rw-r--r-- | tensorflow/contrib/lite/toco/model_flags.proto | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tensorflow/contrib/lite/toco/model_flags.proto b/tensorflow/contrib/lite/toco/model_flags.proto index 9070ddc883..e4b39b34e8 100644 --- a/tensorflow/contrib/lite/toco/model_flags.proto +++ b/tensorflow/contrib/lite/toco/model_flags.proto @@ -87,6 +87,22 @@ message RnnState { optional int32 size = 3; } +// An ArraysExtraInfo message stores a collection of additional Information +// about arrays in a model, complementing the information in the model itself. +// It is intentionally a separate message so that it may be serialized and +// passed separately from the model. See --arrays_extra_info_file. +// +// A typical use case is to manually specify MinMax for specific arrays in a +// model that does not already contain such MinMax information. +message ArraysExtraInfo { + message Entry { + optional string name = 1; + optional float min = 2; + optional float max = 3; + } + repeated Entry entries = 1; +} + // ModelFlags encodes properties of a model that, depending on the file // format, may or may not be recorded in the model file. The purpose of // representing these properties in ModelFlags is to allow passing them @@ -108,7 +124,7 @@ message RnnState { // optional int32 input_dims = 11 [ default = 4]; // repeated int32 input_shape = 13; // -// Next ID to USE: 18. +// Next ID to USE: 19. message ModelFlags { // Information about the input arrays, i.e. the arrays from which input // activations will be read. @@ -151,4 +167,8 @@ message ModelFlags { // catch common copy-and-paste issues where invisible unicode // characters are unwittingly added to these strings. optional bool allow_nonascii_arrays = 17; + + // If set, this ArraysExtraInfo allows to pass extra information about arrays + // not specified in the input model file, such as extra MinMax information. + optional ArraysExtraInfo arrays_extra_info = 18; } |