Add derived scales to op properties. This is to support the scale calculation of fused op.

PiperOrigin-RevId: 277805124
Change-Id: I1a4f0814c48c36ac2039ad80d387551c1a1c300d
This commit is contained in:
Jian Li 2019-10-31 14:45:38 -07:00 committed by TensorFlower Gardener
parent 093da5c248
commit c92be0fe5e

View File

@ -22,6 +22,17 @@ namespace tflite {
namespace optimize {
namespace operator_property {
// The scales of a certain tensor can be derived from the multiplications of all
// the scales. For example, for bias in conv, derived_scale = {{0, 1}, {}, {}}
// and for lstm gate bias, the derived scale is {{}, {0}, {2^-10}}
struct DerivedScale {
std::vector<int> input_tensors = {};
std::vector<int> intermediate_tensors = {};
// This is a list of extra factors that are not associated with any other
// tensor.
std::vector<float> factors = {};
};
struct TensorProperty {
// per_axis also implies symmetric currently.
bool per_axis = false;