aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/toco/graph_transformations/ensure_uint8_weights_safe_for_fast_int8_kernels.cc
diff options
context:
space:
mode:
authorGravatar Yu-Cheng Ling <ycling@google.com>2018-10-09 11:38:15 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-09 11:48:46 -0700
commit12e164d1e7c0b197f06d5d3c2ed26318b89b5e4c (patch)
treed2f0b6ba463baff8e3607575f41d3655762f3d14 /tensorflow/contrib/lite/toco/graph_transformations/ensure_uint8_weights_safe_for_fast_int8_kernels.cc
parent931353c5f79c2d419afb3a5ecac59184c5558351 (diff)
Return ::tensorflow::Status in Toco Graph Transformations.
PiperOrigin-RevId: 216392908
Diffstat (limited to 'tensorflow/contrib/lite/toco/graph_transformations/ensure_uint8_weights_safe_for_fast_int8_kernels.cc')
-rw-r--r--tensorflow/contrib/lite/toco/graph_transformations/ensure_uint8_weights_safe_for_fast_int8_kernels.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/tensorflow/contrib/lite/toco/graph_transformations/ensure_uint8_weights_safe_for_fast_int8_kernels.cc b/tensorflow/contrib/lite/toco/graph_transformations/ensure_uint8_weights_safe_for_fast_int8_kernels.cc
index c13fc0de75..60dcd52684 100644
--- a/tensorflow/contrib/lite/toco/graph_transformations/ensure_uint8_weights_safe_for_fast_int8_kernels.cc
+++ b/tensorflow/contrib/lite/toco/graph_transformations/ensure_uint8_weights_safe_for_fast_int8_kernels.cc
@@ -108,8 +108,9 @@ namespace toco {
// we can foresee these 'fast int8 kernels' to remain important to have into
// the 2020s.
//
-bool EnsureUint8WeightsSafeForFastInt8Kernels::Run(Model* model,
- std::size_t op_index) {
+::tensorflow::Status EnsureUint8WeightsSafeForFastInt8Kernels::Run(
+ Model* model, std::size_t op_index, bool* modified) {
+ *modified = false;
const auto& op = *model->operators[op_index];
int weights_index = 0;
switch (op.type) {
@@ -148,16 +149,16 @@ bool EnsureUint8WeightsSafeForFastInt8Kernels::Run(Model* model,
// That's why at the moment we only handle operators that use a GEMM
// (Conv, fully-connected --- note that LSTM merely wraps a
// fully-connected operator).
- return false;
+ return ::tensorflow::Status::OK();
}
const string& name = op.inputs[weights_index];
auto& array = model->GetArray(name);
if (!array.buffer) {
- return false;
+ return ::tensorflow::Status::OK();
}
if (array.data_type != ArrayDataType::kUint8) {
- return false;
+ return ::tensorflow::Status::OK();
}
auto& buffer_data = array.GetMutableBuffer<ArrayDataType::kUint8>().data;
@@ -212,7 +213,8 @@ bool EnsureUint8WeightsSafeForFastInt8Kernels::Run(Model* model,
AddMessageF("Tweaked weights values for %s", LogName(op));
}
- return changed;
+ *modified = changed;
+ return ::tensorflow::Status::OK();
}
} // namespace toco