Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 40 for constant_ops (0.15 sec)

  1. tensorflow/compiler/mlir/lite/stablehlo/transforms/unfold_splat_constant_pass.cc

        // Cannot use the pattern rewriter because the driver applies folders by
        // default.
        module.walk([&](mhlo::ConstantOp const_op) {
          UnfoldSplatConstant(&op_builder, const_op);
        });
      }
    
     private:
      void UnfoldSplatConstant(mlir::OpBuilder* op_builder,
                               mhlo::ConstantOp const_op) const {
        auto splat_elements_attr =
            mlir::dyn_cast<SplatElementsAttr>(const_op.getValue());
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 3.8K bytes
    - Viewed (0)
  2. tensorflow/compiler/mlir/lite/utils/constant_utils.cc

      auto attr = CreateTypedAttr(dense_type, value);
    
      return rewriter->create<arith::ConstantOp>(loc, dense_type,
                                                 cast<TypedAttr>(*attr));
    }
    
    absl::StatusOr<arith::ConstantOp> CreateConstOpWithSingleValue(
        PatternRewriter* rewriter, Location loc, ShapedType shaped_type,
        int value) {
      ShapedType scalar_type =
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  3. tensorflow/compiler/mlir/lite/experimental/tac/transforms/fold_constants_to_subgraph.cc

          .replaceAllUsesWith(cloned_const_op->getResult(0));
    }
    
    bool IsConstOrQConstInt(Operation* op) {
      if (!llvm::isa<TFL::ConstOp, TFL::QConstOp, arith::ConstantOp>(op))
        return false;
    
      if (auto arith_const_op = dyn_cast_or_null<arith::ConstantOp>(op)) {
        // arith ConstOp path.
        auto type =
            mlir::cast<ShapedType>(arith_const_op.getType()).getElementType();
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  4. tensorflow/compiler/mlir/lite/utils/constant_utils.h

    namespace mlir {
    namespace TFL {
    
    // Returns a Constant op with a single value.
    absl::StatusOr<arith::ConstantOp> CreateConstOpWithSingleValue(
        PatternRewriter* rewriter, Location loc, ShapedType shaped_type, int value);
    
    // Returns a Constant op with a splat vector value.
    absl::StatusOr<arith::ConstantOp> CreateConstOpWithVectorValue(
        PatternRewriter* rewriter, Location loc, ShapedType shaped_type, int value);
    
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Tue Feb 27 06:24:28 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  5. tensorflow/compiler/mlir/tf2xla/transforms/utils.h

      auto reducer =
          builder->create<Op>(loc, block->getArgument(0), block->getArgument(1));
      builder->create<ReturnOp>(loc, reducer.getResult());
    }
    
    ConstantOp GetScalarConstOfType(Type ty, Location loc, int64_t raw_value,
                                    OpBuilder* builder);
    
    ConstantOp GetScalarNegZeroOfType(Type ty, Location loc, OpBuilder* builder);
    
    // Converts an ArrayAttr to a 1D 64-bit dense elements attribute.
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Wed Sep 06 19:12:29 UTC 2023
    - 2.3K bytes
    - Viewed (0)
  6. tensorflow/compiler/mlir/lite/stablehlo/odml_converter/folders.cc

      static std::optional<FoldAdaptor> Create(Operation* operation) {
        auto foldable_opr = [](Value val) -> bool {
          return !llvm::isa<BlockArgument>(val) &&
                 llvm::isa<stablehlo::ConstantOp>(val.getDefiningOp());
        };
        if (!llvm::all_of(operation->getOperands(), foldable_opr)) {
          return std::nullopt;
        }
        return FoldAdaptor(operation);
      }
    
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Wed May 08 06:11:55 UTC 2024
    - 4.5K bytes
    - Viewed (0)
  7. tensorflow/compiler/mlir/quantization/stablehlo/passes/merge_fusion_with_dequantize.cc

            req_op.getLoc(), func_op.getResultTypes()[0], req_op.getOperand());
        if (func_name.contains("_relu6_")) {
          auto min = rewriter.create<mlir::stablehlo::ConstantOp>(
              req_op.getLoc(), rewriter.getF32FloatAttr(0));
          auto max = rewriter.create<mlir::stablehlo::ConstantOp>(
              req_op.getLoc(), rewriter.getF32FloatAttr(6));
          new_result = rewriter.create<mlir::stablehlo::ClampOp>(
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  8. tensorflow/compiler/mlir/lite/stablehlo/odml_converter/transforms/outline_composites.cc

      auto one_cst =
          rewriter.create<stablehlo::ConstantOp>(rewriter.getUnknownLoc(), one_val);
    
      auto half_val = DenseElementsAttr::get(type, kHalf);
      auto half_cst =
          rewriter.create<stablehlo::ConstantOp>(one_cst.getLoc(), half_val);
    
      auto one_over_root2_val = DenseElementsAttr::get(type, kOneOverRoot2);
      auto one_over_root2_cst = rewriter.create<stablehlo::ConstantOp>(
          half_cst.getLoc(), one_over_root2_val);
    
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Fri May 17 17:58:54 UTC 2024
    - 9.6K bytes
    - Viewed (0)
  9. tensorflow/compiler/mlir/tf2xla/transforms/xla_legalize_targets_test.cc

      auto const_int = builder_.create<chlo::ConstantOp>(
          builder_.getUnknownLoc(), builder_.getI32TensorAttr({42}));
    
      ConversionTarget target =
          GetDefaultLegalConversionTargets(context_, /*legalize_chlo=*/true);
    
      EXPECT_TRUE(target.isIllegal(const_int));
    }
    
    TEST_F(XlaLegalizeTargetsTest, DontAllowCHLODialect) {
      auto const_int = builder_.create<chlo::ConstantOp>(
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Fri Mar 03 05:56:39 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  10. tensorflow/compiler/mlir/quantization/stablehlo/passes/fold_constant_transpose.cc

      LogicalResult match(mlir::stablehlo::TransposeOp op) const override {
        Value operand = op.getOperand();
        auto const_op =
            dyn_cast_or_null<mlir::stablehlo::ConstantOp>(operand.getDefiningOp());
        if (!const_op) return failure();
    
        // Only support float tensors.
        auto tensor_type = mlir::dyn_cast_or_null<TensorType>(const_op.getType());
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 7.7K bytes
    - Viewed (0)
Back to top