Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 40 for DenseFPElementsAttr (0.75 sec)

  1. tensorflow/compiler/mlir/lite/transforms/optimize_batch_matmul.cc

        rewriter.replaceOp(bmm_op, sum_op);
        return success();
      };
    
     private:
      bool SplatValueEquals(SplatElementsAttr float_or_int, double rhs) const {
        if (mlir::isa<DenseFPElementsAttr>(float_or_int)) {
          return mlir::cast<DenseFPElementsAttr>(float_or_int)
              .getSplatValue<APFloat>()
              .isExactlyValue(rhs);
        } else if (mlir::cast<DenseIntElementsAttr>(float_or_int)) {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 9.6K bytes
    - Viewed (0)
  2. tensorflow/compiler/mlir/quantization/common/quantization_lib/quantization_utils.h

    // Extracts min and max values from the DenseFPElementsAttr, and stores them
    // into `mins` and `maxs`. When mins and maxs are extracted per-channel,
    // `dim_size` is number of channels and `slice_size` is the size of slice per
    // each channel. When `symmetric` is true, the range is expanded to [-M, M].
    void ExtractMinMaxFromAttr(DenseFPElementsAttr values, int dim_size,
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Wed Apr 24 20:30:06 UTC 2024
    - 41.7K bytes
    - Viewed (0)
  3. tensorflow/compiler/mlir/quantization/tensorflow/passes/prepare_quantize_drq.cc

        QuantizedType quant_type;
        DenseFPElementsAttr attr;
        if (!matchPattern(op->getResult(0), m_Constant(&attr))) return false;
    
        if (attr.size() < quant_specs_.minimum_elements_for_weights) {
          op->emitRemark("Quantization is skipped for ")
              << quantized_op->getName().getStringRef().str() << " because it has "
              << mlir::dyn_cast<DenseFPElementsAttr>(attr).size()
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 11.5K bytes
    - Viewed (0)
  4. tensorflow/compiler/mlir/tensorflow/transforms/rewrite_util.h

    // to `raw_value`.
    template <typename T>
    bool IsConstantValueOf(Value value, T raw_value) {
      auto element_type = mlir::cast<ShapedType>(value.getType()).getElementType();
      if (mlir::isa<FloatType>(element_type)) {
        DenseFPElementsAttr float_attr;
        if (matchPattern(value, m_Constant(&float_attr)) && float_attr.isSplat() &&
            float_attr.getSplatValue<APFloat>().isExactlyValue(raw_value))
          return true;
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Wed May 22 19:47:48 UTC 2024
    - 4K bytes
    - Viewed (0)
  5. tensorflow/compiler/mlir/lite/stablehlo/transforms/composite_avg_pool.cc

        }
      }
      return res;
    }
    
    // Gets a matrix which corrects the overcounting of divisors when casting a
    // average pool with ceil mode true as one with ceil mode false on a padded
    // tensor.
    DenseFPElementsAttr GetCorrectionMatrix(Builder& builder, CompositeOp op) {
      const TorchAvgPoolData pool = GetTorchAvgPoolData(op);
    
      llvm::SmallVector<int64_t, 4> nhwc_out_shape(4);
      nhwc_out_shape[0] = 1;  // Broadcast batch.
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Tue May 28 23:16:05 UTC 2024
    - 9.2K bytes
    - Viewed (0)
  6. tensorflow/compiler/mlir/quantization/common/attrs_and_constraints.h

        return builder.create<TF::ConstOp>(loc, attr);
      }
    
      const auto type = RankedTensorType::get(shape, builder.getF32Type());
      const auto value_attr = DenseFPElementsAttr::get(type, values);
      return builder.create<TF::ConstOp>(loc, value_attr);
    }
    
    // Creates a 1D array with integer/float type.
    template <typename T>
    Value Create1DConstValue(OpBuilder& builder, const Location loc,
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 9.9K bytes
    - Viewed (0)
  7. tensorflow/compiler/mlir/quantization/tensorflow/passes/convert_custom_aggregation_op_to_quant_stats.cc

          op.getOutput().replaceAllUsesWith(op.getInput());
          rewriter.eraseOp(op);
          return success();
        }
    
        // The layer stats contain only the first min/max pairs.
        ElementsAttr layer_stats = DenseFPElementsAttr::get(
            RankedTensorType::get({2}, rewriter.getF32Type()),
            {static_cast<float>(min.getValueAsDouble()),
             static_cast<float>(max.getValueAsDouble())});
        ElementsAttr axis_stats;
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  8. tensorflow/compiler/mlir/lite/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 (!matchPattern(min, m_Constant(&min_value))) {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  9. 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)
  10. 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)
Back to top