tensorflow/lite/toco/graph_transformations/remove_trivial_quantized_min_max.cc
// Attempts to remove min/max functions if the quantization params indicate that
// the representable values fall inside the clip range.
Attempts to remove min/max functions if the quantization params indicate that
the representable values fall inside the clip range.
Attempts to remove min / max functions if the quantization params indicate that the representable values fall inside the clip range .
::tensorflow::Status RemoveTrivialQuantizedMinMax::Run(Model* model,
                                                       std::size_t op_index,
                                                       bool* modified) {
  *modified = false;
  const auto it = model->operators.begin() + op_index;
  auto* op = it->get();
  if ((op->type != OperatorType::kMinimum &&
       op->type != OperatorType::kMaximum) ||
      op->inputs.size() != 2) {
    return ::tensorflow::Status::OK();
  }
  if (IsTrivialMinMax(this, *model, op->type, op->inputs[0], op->inputs[1])) {
    AddMessageF(
        "Removing trivial min/max %s because the quantization parameters imply "
        "at least as tight a clamp anyway.",
        LogName(*op));
    *modified = RemoveTrivialPassthroughOp(this, model, op_index);
    return ::tensorflow::Status::OK();
  }
  return ::tensorflow::Status::OK();
}
:: tensorflow :: Status RemoveTrivialQuantizedMinMax :: Run ( Model * model , std :: size_t op_index , bool * modified ) { * modified = false ; const auto it = model -> operators . begin ( ) + op_index ; auto * op = it -> get ( ) ; if ( ( op -> type != OperatorType :: kMinimum && op -> type != OperatorType :: kMaximum ) || op -> inputs . size ( ) != 2 ) { return :: tensorflow :: Status :: OK ( ) ; } if ( IsTrivialMinMax ( this , * model , op -> type , op -> inputs [ 0 ] , op -> inputs [ 1 ] ) ) { AddMessageF ( " " " " , LogName ( * op ) ) ; * modified = RemoveTrivialPassthroughOp ( this , model , op_index ) ; return :: tensorflow :: Status :: OK ( ) ; } return :: tensorflow :: Status :: OK ( ) ; }
Attempts to remove min/max functions if the quantization params indicate that
the representable values fall inside the clip range.
Attempts to remove min / max functions if the quantization params indicate that the representable values fall inside the clip range .