Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 39 for FloatAttr (0.47 sec)

  1. tensorflow/compiler/mlir/lite/utils/attribute_utils.cc

    #include "mlir/Support/LLVM.h"  // from @llvm-project
    
    namespace mlir {
    namespace TFL {
    
    FloatAttr ExtractSingleElementAsFloat(ElementsAttr attr) {
      if (attr.getShapedType().getNumElements() != 1 ||
          !mlir::isa<FloatType>(attr.getShapedType().getElementType())) {
        return {};
      }
      return attr.getSplatValue<FloatAttr>();
    }
    
    FloatAttr GetSingleElementAsFloatOrSelf(Attribute attr) {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  2. tensorflow/compiler/mlir/lite/quantization/ir/QuantizeUtils.cc

      if (mlir::isa<FloatAttr>(origRealValue)) {
        FloatAttr floatAttr = mlir::cast<FloatAttr>(origRealValue);
        outConvertedType = quantizedElementType.getStorageType();
        return IntegerAttr::get(quantizedElementType.getStorageType(),
                                converter.quantizeFloatToInt(floatAttr.getValue()));
      }
    
      return nullptr;
    }
    
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  3. tensorflow/compiler/mlir/lite/utils/constant_utils.cc

        auto floatAttr = mlir::FloatAttr::get(floatType, static_cast<float>(value));
        std::vector<Attribute> floatValues({floatAttr});
        return DenseElementsAttr::get(shaped_type, floatValues);
      } else if (element_type.isBF16()) {
        auto floatType = mlir::FloatType::getBF16(element_type.getContext());
        auto floatAttr = mlir::FloatAttr::get(floatType, static_cast<float>(value));
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  4. tensorflow/compiler/mlir/quantization/tensorflow/passes/convert_custom_aggregation_op_to_quant_stats.cc

      LogicalResult matchAndRewrite(TF::CustomAggregatorOp op,
                                    PatternRewriter &rewriter) const override {
        FloatAttr min = mlir::dyn_cast_or_null<FloatAttr>(op->getAttr("min"));
        FloatAttr max = mlir::dyn_cast_or_null<FloatAttr>(op->getAttr("max"));
    
        // When there are no min and max attributes, remove op.
        if (min == nullptr || max == nullptr) {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  5. tensorflow/compiler/mlir/lite/quantization/device_target.cc

      double real_multiplier = scale_product / o_spec.getScale();
      output_multipliers->push_back(QuantizeMultiplier(real_multiplier));
    
      // output ranges
      auto min = rop->getAttrOfType<FloatAttr>("min");
      auto max = rop->getAttrOfType<FloatAttr>("max");
      output_ranges->push_back(CalculateQuantizedRange(
          o_spec.getScale(), o_spec.getZeroPoint(),
          (min ? std::optional<double>(min.getValueAsDouble()) : std::nullopt),
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Fri Mar 08 10:41:08 UTC 2024
    - 7.3K bytes
    - Viewed (0)
  6. tensorflow/compiler/mlir/lite/quantization/ir/QuantizeUtils.h

    /// Returns nullptr if the conversion is not supported. On success, stores the
    /// converted type in outConvertedType.
    ///
    /// Examples:
    /// 1. realValue is a primitive value attribute:
    /// (realValue: FloatAttr, quantizedElementType: UniformQuantizedType[i8:f32])
    ///   -> (IntegerAttr, outConvertedType: i8)
    /// 2. realValue is an elements attribute:
    /// (realValue: DenseElementsAttr[tensor<2x2xf32>],
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Fri Jul 29 18:55:28 UTC 2022
    - 3.1K bytes
    - Viewed (0)
  7. tensorflow/compiler/mlir/lite/utils/attribute_utils.h

    // element isn't a float attribute.
    FloatAttr ExtractSingleElementAsFloat(ElementsAttr attr);
    
    // Returns the single float element if the input is an ElementsAttr, or return
    // itself as a float element. Returns empty attribute if the number of elements
    // in the attribute is not 1, the element or itself isn't a float attribute.
    FloatAttr GetSingleElementAsFloatOrSelf(Attribute attr);
    
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Mar 03 16:37:16 UTC 2022
    - 2K bytes
    - Viewed (0)
  8. tensorflow/compiler/mlir/tensorflow/transforms/rewrite_util.h

    template <typename T>
    DenseElementsAttr GetScalarOfType(Type ty, T raw_value) {
      RankedTensorType scalar_ty = RankedTensorType::get({}, ty);
      if (auto float_ty = mlir::dyn_cast<FloatType>(ty)) {
        FloatAttr attr = FloatAttr::get(float_ty, raw_value);
        return DenseElementsAttr::get(scalar_ty, attr);
      } else if (auto int_ty = mlir::dyn_cast<IntegerType>(ty)) {
        IntegerAttr attr = IntegerAttr::get(int_ty, raw_value);
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Wed May 22 19:47:48 UTC 2024
    - 4K bytes
    - Viewed (0)
  9. tensorflow/compiler/mlir/lite/quantization/ir/ConvertSimQuant.cc

        SmallVector<double, 4> min, max;
        min.reserve(fqOp.getMin().size());
        max.reserve(fqOp.getMax().size());
        for (auto m : fqOp.getMin())
          min.push_back(cast<FloatAttr>(m).getValueAsDouble());
        for (auto m : fqOp.getMax())
          max.push_back(cast<FloatAttr>(m).getValueAsDouble());
    
        return fakeQuantAttrsToType(fqOp.getLoc(), fqOp.getNumBits(),
                                    fqOp.getAxis(), min, max, fqOp.getNarrowRange(),
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Wed May 08 02:10:16 UTC 2024
    - 6K bytes
    - Viewed (0)
  10. tensorflow/compiler/mlir/lite/experimental/tac/common/cost.h

      op->setAttr(kCost, builder->getF32FloatAttr(cost));
    }
    
    // Get the cost annotated with kCost.
    inline bool GetCostOnOp(Operation* op, float* cost) {
      auto cost_type = op->getAttrOfType<FloatAttr>(kCost);
      if (cost_type == nullptr) {
        return false;
      }
    
      *cost = cost_type.getValueAsDouble();
      return true;
    }
    
    }  // namespace tac
    }  // namespace TFL
    }  // namespace mlir
    
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Wed Jul 21 01:22:53 UTC 2021
    - 1.6K bytes
    - Viewed (0)
Back to top