Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 43 for DenseFPElementsAttr (0.2 sec)

  1. tensorflow/compiler/mlir/lite/quantization/tensorflow/tf_to_quant.cc

        // a special case that there are tf.Identity ops between the min/max
        // constants and the tf.FakeQuantWithMinMaxVarsOp.
        Value min = tf_op.getMin(), max = tf_op.getMax();
        DenseFPElementsAttr min_value, max_value;
        if (auto id1 = dyn_cast_or_null<TF::IdentityOp>(min.getDefiningOp())) {
          id1.replaceAllUsesWith(id1.getInput());
          min = tf_op.getMin();
          rewriter.eraseOp(id1);
        }
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 8.1K bytes
    - Viewed (0)
  2. tensorflow/compiler/mlir/quantization/common/quantization_lib/quantization_driver.cc

      for (int i = 0; i < op->getNumResults(); ++i) {
        if (GetResultQuantState(op, i).IsEmpty()) return false;
      }
      return true;
    }
    
    bool QuantizationDriver::SetConstantResultParams(Operation* op) {
      DenseFPElementsAttr attr;
      const Value result = op->getResult(0);
      if (!matchPattern(result, m_Constant(&attr))) {
        return false;
      }
      // TODO: b/323478683 - Make storage_type_width and narrow_range configurable.
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 38.1K bytes
    - Viewed (0)
  3. tensorflow/compiler/mlir/quantization/tensorflow/utils/fake_quant_utils.h

        max_value = tf_op.getMaxAttr();
        return true;  // Successfully matched and fetched.
      }
    };
    
    template <class TFFakeQuantOp>
    struct FetchConstantMinMaxInputs {
      using AttrType = DenseFPElementsAttr;
      bool operator()(TFFakeQuantOp tf_op, AttrType &min_value,
                      AttrType &max_value) const {
        Value min = tf_op.getMin(), max = tf_op.getMax();
        if (auto min_id = min.getDefiningOp<TF::IdentityOp>()) {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 6.3K bytes
    - Viewed (0)
  4. tensorflow/compiler/mlir/quantization/stablehlo/passes/convert_func_to_bfloat16.cc

                                                                  values->end());
          state.attributes.set(
              const_op.getValueAttrName(),
              DenseFPElementsAttr::get(
                  mlir::dyn_cast<ShapedType>(const_op.getValue().getType())
                      .clone(rewriter.getBF16Type()),
                  bfloat16_values));
        }
    
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 9.3K bytes
    - Viewed (0)
  5. tensorflow/compiler/mlir/quantization/stablehlo/passes/lift_quantizable_spots_as_functions.cc

    }
    
    // Checks whether the value of a constant equals the given float, regardless
    // of the tensor dimension.
    bool FloatValueEquals(const Attribute& attr, const double value) {
      const auto fp_attr = mlir::dyn_cast_or_null<DenseFPElementsAttr>(attr);
      if (!fp_attr) return false;
    
      if (fp_attr.isSplat()) {
        return fp_attr.getSplatValue<APFloat>().isExactlyValue(value);
      }
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Fri May 10 04:07:09 UTC 2024
    - 9.3K bytes
    - Viewed (0)
  6. tensorflow/compiler/mlir/quantization/tensorflow/passes/preprocess_op.cc

        if (operands.size() != 1) return failure();
        int weight_operand_idx = *operands.begin();
    
        Operation* weight_op = op.getOperand(weight_operand_idx).getDefiningOp();
        DenseFPElementsAttr attr;
        if (!matchPattern(weight_op->getResult(0), m_Constant(&attr))) {
          return failure();
        }
    
        // Get new shape.
        llvm::ArrayRef<int64_t> cur_shape = attr.getType().getShape();
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 11.4K bytes
    - Viewed (0)
  7. tensorflow/compiler/mlir/quantization/stablehlo/passes/insert_weight_param.cc

        return HasValidWeightOnlyPtqMethod(method.weight_only_ptq(), rank);
      }
    
      void rewrite(Operation* op, PatternRewriter& rewriter) const override {
        Operation* quantizable_op = *op->getUsers().begin();
        DenseFPElementsAttr attr;
        matchPattern(op->getResult(0), m_Constant(&attr));
    
        Method method = GetQuantizationMethodOrDefault(quantizable_op);
        const WeightOnlyPtq& weight_only_ptq = method.weight_only_ptq();
    
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu May 09 05:56:10 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  8. tensorflow/compiler/mlir/lite/stablehlo/transforms/compose_uniform_quantized_type_pass.cc

          // This is i8 values disguised as f32 (due to the upcast trick). Simply
          // cast them to i8.
          ElementsAttr filter_value = filter_constant_op.getValue();
          filter_i8_value_attr =
              mlir::cast<DenseFPElementsAttr>(filter_value)
                  .mapValues(rewriter.getI8Type(), [](const APFloat& val) -> APInt {
                    APSInt convertedInt(/*BitWidth=*/8, /*isUnsigned=*/false);
                    bool ignored;
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 64.6K bytes
    - Viewed (0)
  9. tensorflow/compiler/mlir/lite/transforms/quantize.cc

            legacy_float_scale_(legacy_float_scale) {}
      LogicalResult matchAndRewrite(QuantizeOp op,
                                    PatternRewriter& rewriter) const override {
        DenseFPElementsAttr attr;
        if (matchPattern(op.getInput(), m_Constant(&attr))) {
          auto qtype = op.getQtypeAttr();
          Attribute quantized_attr;
          if (legacy_float_scale_) {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Wed Apr 24 20:30:06 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  10. tensorflow/compiler/mlir/lite/quantization/tensorflow/fallback_to_flex_ops.cc

      return val;
    }
    
    // Returns true if the attr is a float attribute and be equal to value.
    static bool FloatValueEquals(const Attribute &attr, double value) {
      auto fp_attr = mlir::dyn_cast_or_null<DenseFPElementsAttr>(attr);
      if (fp_attr == nullptr) return false;
    
      if (fp_attr.isSplat()) {
        return fp_attr.getSplatValue<APFloat>().isExactlyValue(value);
      }
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 12.2K bytes
    - Viewed (0)
Back to top