Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 34 for FloatAttr (0.11 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/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)
  7. 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)
  8. tensorflow/compiler/mlir/lite/stablehlo/transforms/legalize_stablehlo_composite_to_tfl_custom.cc

      if (mlir::isa<::mlir::IntegerAttr>(attr)) {
        fbb->Int(key, mlir::dyn_cast<mlir::IntegerAttr>(attr).getInt());
        return success();
      }
    
      if (mlir::isa<::mlir::FloatAttr>(attr)) {
        fbb->Double(key, mlir::dyn_cast<mlir::FloatAttr>(attr).getValueAsDouble());
        return success();
      }
    
      return op->emitWarning("serialization not supported for : ") << key;
    }
    
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 6.8K bytes
    - Viewed (0)
  9. tensorflow/compiler/mlir/lite/utils/nms_utils.cc

    }
    
    LogicalResult ConvertSSDPostProcessFunc::AddFloatAttr(
        func::FuncOp func, DictionaryAttr attrs, const std::string& attribute,
        flexbuffers::Builder* builder) {
      auto float_attr = mlir::dyn_cast_or_null<FloatAttr>(attrs.get(attribute));
      if (!float_attr) {
        return func.emitError()
               << attribute.c_str() << " attribute is not set or not a float";
      }
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 8.1K bytes
    - Viewed (0)
  10. tensorflow/compiler/mlir/lite/stablehlo/transforms/unfuse_batch_norm_pass.cc

          loc,
          RankedTensorType::get(/*shape=*/{resultType.getRank()},
                                rewriter.getIndexType()),
          operand);
    }
    
    Value materializeEpsilon(Operation *op, FloatAttr epsilon_attr,
                             FloatType fp_type, Value broadcast_to,
                             RankedTensorType broadcast_to_type,
                             PatternRewriter &rewriter) {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 11.2K bytes
    - Viewed (0)
Back to top