Home
last modified time | relevance | path

Searched refs:TFL (Results 1 – 25 of 182) sorted by relevance

12345678

/external/tensorflow/tensorflow/compiler/mlir/lite/experimental/tac/transforms/
Ddevice_transform_patterns.h26 namespace TFL {
33 struct LowerPackIntoConcatReshape : public OpRewritePattern<TFL::PackOp> {
34 using OpRewritePattern<TFL::PackOp>::OpRewritePattern;
36 LogicalResult matchAndRewrite(TFL::PackOp pack_op,
40 struct SquaredDifference : public OpRewritePattern<TFL::SquaredDifferenceOp> {
41 using OpRewritePattern<TFL::SquaredDifferenceOp>::OpRewritePattern;
43 LogicalResult matchAndRewrite(TFL::SquaredDifferenceOp squared_diff_op,
48 struct UnrollSplit : public OpRewritePattern<TFL::SplitOp> {
49 using OpRewritePattern<TFL::SplitOp>::OpRewritePattern;
51 LogicalResult matchAndRewrite(TFL::SplitOp split_op,
[all …]
Ddevice_transform.cc37 namespace TFL { namespace
63 llvm::isa<TFL::QConstOp, TFL::ConstOp>(op) || in ConvertQuantizedOpToFloat()
64 llvm::isa<TFL::QConstOp, TFL::ConstOp, TF::ConstOp, ConstOp>(op)) in ConvertQuantizedOpToFloat()
92 auto dequantize_op = builder->create<TFL::DequantizeOp>( in ConvertQuantizedOpToFloat()
129 TFL::QuantizeOp quant_op = builder->create<TFL::QuantizeOp>( in ConvertQuantizedOpToFloat()
144 struct FoldQuantizedI32ToFloat : public OpRewritePattern<TFL::DequantizeOp> {
145 using OpRewritePattern<TFL::DequantizeOp>::OpRewritePattern;
147 LogicalResult matchAndRewrite(TFL::DequantizeOp dequant_op, in matchAndRewrite()
153 auto input_dequant = llvm::dyn_cast_or_null<TFL::QConstOp>(input); in matchAndRewrite()
189 rewriter.replaceOpWithNewOp<TFL::ConstOp>(dequant_op, dequant_op.getType(), in matchAndRewrite()
[all …]
Dfold_constants_to_subgraph.cc39 namespace TFL { namespace
90 assert((llvm::isa<TFL::ConstOp, TFL::QConstOp>(const_op)) && in CopyConstantIntoFunc()
102 if (!llvm::isa<TFL::ConstOp, TFL::QConstOp>(op)) return false; in IsConstOrQConstInt()
104 if (auto const_op = dyn_cast_or_null<TFL::ConstOp>(op)) { in IsConstOrQConstInt()
112 auto qconst_op = dyn_cast<TFL::QConstOp>(op); in IsConstOrQConstInt()
127 if (!llvm::isa<TFL::ConstOp, TFL::QConstOp>(op)) return; in runOnOperation()
Ddevice_transform_patterns.cc46 namespace TFL { namespace
72 TFL::ReshapeOp InsertReshapeOp(Location loc, Value input, Type element_type, in InsertReshapeOp()
87 auto new_shape = builder->create<TFL::ConstOp>(loc, new_shape_attr); in InsertReshapeOp()
90 return builder->create<TFL::ReshapeOp>(loc, reshape_out_type, input, in InsertReshapeOp()
120 auto zero_bias = rewriter.create<TFL::ConstOp>(op->getLoc(), bias_attr); in EnsureBias()
188 rewriter->create<TFL::ConstOp>(split_op->getLoc(), slice_begin_attr); in SliceOutputs()
190 rewriter->create<TFL::ConstOp>(split_op->getLoc(), slice_size_attr); in SliceOutputs()
192 auto slice_op = rewriter->create<TFL::SliceOp>( in SliceOutputs()
207 TFL::PackOp pack_op, PatternRewriter& rewriter) const { in matchAndRewrite()
249 auto concat_op = rewriter.create<TFL::ConcatenationOp>( in matchAndRewrite()
[all …]
/external/tensorflow/tensorflow/compiler/mlir/lite/
Dtf_tfl_passes.cc55 mlir::TFL::CreatePrepareQuantizePass(quant_specs)); in AddQuantizationPasses()
59 mlir::TFL::CreateDefaultQuantParamsPass( in AddQuantizationPasses()
65 mlir::TFL::CreateQuantizePass(quant_specs)); in AddQuantizationPasses()
69 mlir::TFL::CreatePostQuantizePass(emit_quant_adaptor_ops)); in AddQuantizationPasses()
71 mlir::TFL::CreateOptimizeOpOrderPass()); in AddQuantizationPasses()
75 mlir::TFL::CreateOptimizePass(/*enable_canonicalization=*/true)); in AddQuantizationPasses()
82 mlir::TFL::CreatePrepareDynamicRangeQuantizePass(quant_specs)); in AddDynamicRangeQuantizationPasses()
84 mlir::TFL::CreateQuantizePass(quant_specs)); in AddDynamicRangeQuantizationPasses()
88 mlir::TFL::CreatePostQuantizePass(emit_quant_adaptor_ops, in AddDynamicRangeQuantizationPasses()
91 mlir::TFL::CreateOptimizeOpOrderPass()); in AddDynamicRangeQuantizationPasses()
[all …]
Dflatbuffer_operator.cc113 mlir::TFL::MirrorPaddingType padding, in ConvertTFL_MirrorPaddingAttrForOptionWriter()
116 case mlir::TFL::MirrorPaddingType::REFLECT: in ConvertTFL_MirrorPaddingAttrForOptionWriter()
118 case mlir::TFL::MirrorPaddingType::SYMMETRIC: in ConvertTFL_MirrorPaddingAttrForOptionWriter()
215 mlir::TFL::LSTMKernelType kernel_type, in ConvertTFL_LSTMKernelTypeAttrForOptionWriter()
218 case mlir::TFL::LSTMKernelType::FULL: in ConvertTFL_LSTMKernelTypeAttrForOptionWriter()
220 case mlir::TFL::LSTMKernelType::BASIC: in ConvertTFL_LSTMKernelTypeAttrForOptionWriter()
284 mlir::TFL::LSTMKernelType kernel_type; in BuildTFL_LSTMKernelTypeAttr()
287 kernel_type = mlir::TFL::LSTMKernelType::FULL; in BuildTFL_LSTMKernelTypeAttr()
290 kernel_type = mlir::TFL::LSTMKernelType::BASIC; in BuildTFL_LSTMKernelTypeAttr()
293 return mlir::TFL::LSTMKernelTypeAttr::get(builder.getContext(), kernel_type); in BuildTFL_LSTMKernelTypeAttr()
[all …]
Dtf_tfl_passes.h36 const mlir::TFL::PassConfig& pass_config,
43 const mlir::TFL::PassConfig& pass_config,
51 const mlir::TFL::PassConfig& pass_config,
55 void AddTFToTFLConversionPasses(const mlir::TFL::PassConfig& pass_config,
Dtf_to_tfl_flatbuffer.cc73 mlir::TFL::AttachErrorCode( in IsValidGraph()
190 const toco::TocoFlags& toco_flags, const mlir::TFL::PassConfig& pass_config, in ConvertTFExecutorToTFLOrFlatbuffer()
220 std::make_unique<mlir::TFL::ErrorCollectorInstrumentation>( in ConvertTFExecutorToTFLOrFlatbuffer()
231 mlir::TFL::ErrorCollectorInstrumentation collector(module.getContext()); in ConvertTFExecutorToTFLOrFlatbuffer()
235 mlir::TFL::ErrorCollector* collector = in ConvertTFExecutorToTFLOrFlatbuffer()
236 mlir::TFL::ErrorCollector::GetErrorCollector(); in ConvertTFExecutorToTFLOrFlatbuffer()
254 mlir::TFL::ErrorCollector* collector = in ConvertTFExecutorToTFLOrFlatbuffer()
255 mlir::TFL::ErrorCollector::GetErrorCollector(); in ConvertTFExecutorToTFLOrFlatbuffer()
/external/tensorflow/tensorflow/compiler/mlir/lite/transforms/
Doptimize.cc62 namespace TFL { namespace
553 struct FuseFullyConnectedAndAdd : public OpRewritePattern<TFL::AddOp> {
554 using OpRewritePattern<TFL::AddOp>::OpRewritePattern;
556 LogicalResult matchAndRewrite(TFL::AddOp add_op, in matchAndRewrite()
565 dyn_cast_or_null<TFL::FullyConnectedOp>(add_op.lhs().getDefiningOp()); in matchAndRewrite()
632 auto fc = rewriter.create<TFL::FullyConnectedOp>( in matchAndRewrite()
657 : public OpRewritePattern<TFL::FullyConnectedOp> {
658 using OpRewritePattern<TFL::FullyConnectedOp>::OpRewritePattern;
660 LogicalResult matchAndRewrite(TFL::FullyConnectedOp fc_op, in matchAndRewrite()
666 auto add_op = dyn_cast_or_null<TFL::AddOp>(fc_op.input().getDefiningOp()); in matchAndRewrite()
[all …]
Ddecompose_hybrid_quantization.cc39 namespace TFL { namespace
94 rewriter.create<TFL::DequantizeOp>(loc, newTy, operand)); in matchAndRewrite()
121 replaceResults.push_back(rewriter.create<TFL::QuantizeOp>( in matchAndRewrite()
139 patterns.add<DequantizeConverter<TFL::Conv2DOp>, in runOnOperation()
140 DequantizeConverter<TFL::Conv3DOp>, in runOnOperation()
141 DequantizeConverter<TFL::DepthwiseConv2DOp>, in runOnOperation()
142 DequantizeConverter<TFL::FullyConnectedOp>, in runOnOperation()
143 DequantizeConverter<TFL::TransposeConvOp>>(ctx); in runOnOperation()
Dlegalize_hashtables.cc37 namespace TFL { namespace
66 rewriter.replaceOpWithNewOp<TFL::HashtableOp>( in matchAndRewrite()
81 auto hashtable_op = llvm::dyn_cast<TFL::HashtableOp>(handle_op); in matchAndRewrite()
83 rewriter.replaceOpWithNewOp<TFL::HashtableFindOp>( in matchAndRewrite()
99 auto hashtable_op = llvm::dyn_cast<TFL::HashtableOp>(handle_op); in matchAndRewrite()
101 rewriter.replaceOpWithNewOp<TFL::HashtableImportOp>( in matchAndRewrite()
117 auto hashtable_op = llvm::dyn_cast<TFL::HashtableOp>(handle_op); in matchAndRewrite()
119 rewriter.replaceOpWithNewOp<TFL::HashtableSizeOp>( in matchAndRewrite()
Ddefault_quant_params.cc43 namespace TFL { namespace
75 auto biases = TFL::GetOpQuantSpec(use.getOwner())->biases_params; in UsedAsBias()
120 op->getParentOfType<TFL::CustomTfOp>()) { in runOnOperation()
143 auto spec = TFL::GetOpQuantSpec(op); in runOnOperation()
166 llvm::isa<TFL::QuantizeOp>(*value.getUsers().begin())) in AddToWorkListIfUnquantized()
188 auto quantize = builder.create<TFL::QuantizeOp>(value.getLoc(), new_type, in QuantizeValue()
190 auto dequantize = builder.create<TFL::DequantizeOp>( in QuantizeValue()
206 if (auto dequant = llvm::dyn_cast<TFL::DequantizeOp>(non_bias_define)) { in GetQuantParamsForBias()
Dpasses.td24 This pass needs to run post TF->TFL legalization and before variable
28 let dependentDialects = ["TFL::TensorFlowLiteDialect"];
34 let dependentDialects = ["TFL::TensorFlowLiteDialect"];
52 let dependentDialects = ["TFL::TensorFlowLiteDialect"];
73 let dependentDialects = ["TFL::TensorFlowLiteDialect"];
87 let dependentDialects = ["TFL::TensorFlowLiteDialect"];
93 let dependentDialects = ["TFL::TensorFlowLiteDialect"];
99 let dependentDialects = ["TFL::TensorFlowLiteDialect"];
105 let dependentDialects = ["TFL::TensorFlowLiteDialect"];
111 let dependentDialects = ["TFL::TensorFlowLiteDialect"];
[all …]
Dpin_ops_with_side_effects.cc34 namespace TFL { namespace
51 if (llvm::isa<TF::IfOp, TFL::IfOp, TFL::CallOnceOp, TFL::WhileOp>(op)) in OpHasSideEffects()
108 if (fn.walk([&](TFL::ControlNodeOp) { in runOnOperation()
Danalyze_variables.cc23 namespace TFL { namespace
45 return llvm::isa<TFL::WhileOp, TFL::IfOp, TFL::CallOnceOp>(op); in IsSupportedTFLiteControlFlow()
/external/tensorflow/tensorflow/compiler/mlir/lite/experimental/tac/py_wrapper/
Dtac_wrapper.cc31 std::unique_ptr<mlir::TFL::tac::TacImporter> CreateTfLiteImporter( in CreateTfLiteImporter()
33 mlir::TFL::tac::TfLiteImporter::Options options; in CreateTfLiteImporter()
36 return std::make_unique<mlir::TFL::tac::TfLiteImporter>(options); in CreateTfLiteImporter()
39 std::unique_ptr<mlir::TFL::tac::TacExporter> CreateTfLiteExporter( in CreateTfLiteExporter()
42 mlir::TFL::tac::TfLiteExporter::Options options; in CreateTfLiteExporter()
47 return std::make_unique<mlir::TFL::tac::TfLiteExporter>(options); in CreateTfLiteExporter()
57 mlir::TFL::tac::TacModule::Options options; in run_tac()
61 mlir::TFL::tac::TacModule tac_module(options); in run_tac()
/external/tensorflow/tensorflow/compiler/mlir/lite/experimental/tac/
Dtac_module.cc29 namespace TFL { namespace
45 pass_manager->addPass(mlir::TFL::tac::CreateTargetAnnotationPass(this)); in AddTACPass()
46 pass_manager->addPass(mlir::TFL::tac::CreateRaiseTargetSubgraphsPass()); in AddTACPass()
47 pass_manager->addPass(mlir::TFL::tac::CreateFoldConstantsToSubgraphPass( in AddTACPass()
50 mlir::TFL::tac::CreateAlternativeSubgraphPass(device_specs)); in AddTACPass()
57 pass_manager->addPass(mlir::TFL::CreatePrepareTFPass( in AddTACPass()
63 mlir::TFL::CreateLegalizeTFPass(/*run_tfl_runtime_verification=*/true)); in AddTACPass()
65 mlir::TFL::CreateOptimizePass(/*enable_canonicalization=*/true)); in AddTACPass()
68 pass_manager->addPass(mlir::TFL::tac::CreateComputeCostPass()); in AddTACPass()
69 pass_manager->addPass(mlir::TFL::tac::CreatePickSubgraphsPass()); in AddTACPass()
Dtac_translate.cc103 std::unique_ptr<mlir::TFL::tac::TacImporter> CreateTfLiteImporter() { in CreateTfLiteImporter()
104 mlir::TFL::tac::TfLiteImporter::Options options; in CreateTfLiteImporter()
107 return std::make_unique<mlir::TFL::tac::TfLiteImporter>(options); in CreateTfLiteImporter()
110 std::unique_ptr<mlir::TFL::tac::TacExporter> CreateTfLiteExporter( in CreateTfLiteExporter()
112 mlir::TFL::tac::TfLiteExporter::Options options; in CreateTfLiteExporter()
117 return std::make_unique<mlir::TFL::tac::TfLiteExporter>(options); in CreateTfLiteExporter()
123 mlir::TFL::tac::TacModule::Options options; in TargetAwareConversionMain()
131 mlir::TFL::tac::TacModule tac_module(options); in TargetAwareConversionMain()
Dtflite_import_export.cc32 namespace TFL { namespace
40 mlir::TFL::tac::GetCanonicalHardwareName(device_spec)); in AttachCostPerDevice()
45 if (!mlir::TFL::tac::IsNonConstOp(op) && in AttachCostPerDevice()
53 auto* target_hardware = mlir::TFL::tac::GetTargetHardware(device); in AttachCostPerDevice()
109 return mlir::TFL::tac::ExportFlatbufferOrMlir(options_.output_file_name, in Export()
Dtflite_import_export.h26 namespace TFL {
30 class TfLiteImporter : public mlir::TFL::tac::TacImporter {
51 class TfLiteExporter : public mlir::TFL::tac::TacExporter {
/external/tensorflow/tensorflow/compiler/mlir/tosa/transforms/
Ddequantize_tfl_softmax.cc42 : RewritePattern(TFL::SoftmaxOp::getOperationName(), 1, context) {} in TosaDequantizeTFLSoftmaxPattern()
49 TFL::SoftmaxOp tfl_softmax_op = cast<TFL::SoftmaxOp>(op); in matchAndRewrite()
58 Value dequantized_input = rewriter.create<TFL::DequantizeOp>( in matchAndRewrite()
60 Value dequantized_softmax_output = rewriter.create<TFL::SoftmaxOp>( in matchAndRewrite()
63 rewriter.replaceOpWithNewOp<TFL::QuantizeOp>(tfl_softmax_op, qtype, in matchAndRewrite()
Dlegalize_tfl.cc84 : RewritePattern(TFL::tfl_op##Op::getOperationName(), 1, context) {} \
179 auto tfl_relu_op = cast<TFL::ReluOp>(op); in matchAndRewrite()
229 auto tfl_relu1_op = cast<TFL::Relu1Op>(op); in matchAndRewrite()
284 auto tfl_relu6_op = cast<TFL::Relu6Op>(op); in matchAndRewrite()
577 return matchAndRewriteAddSub<TFL::AddOp, tosa::AddOp>(op, op->getOperands(), in matchAndRewrite()
583 return matchAndRewriteAddSub<TFL::SubOp, tosa::SubOp>(op, op->getOperands(), in matchAndRewrite()
589 auto tfl_mul_op = cast<TFL::MulOp>(op); in matchAndRewrite()
614 auto tfl_square_op = cast<TFL::SquareOp>(op); in matchAndRewrite()
628 auto tfl_squared_op = cast<TFL::SquaredDifferenceOp>(op); in matchAndRewrite()
642 auto tfl_round_op = cast<TFL::RoundOp>(op); in matchAndRewrite()
[all …]
/external/tensorflow/tensorflow/compiler/mlir/lite/utils/
Dperception_ops_utils_test.cc34 namespace TFL { namespace
136 mlir::TFL::ConvertMaxUnpoolingFunc convert(fused_max_unpooling_func_, in TEST_F()
151 mlir::TFL::ConvertMaxUnpoolingFunc convert(max_unpooling_func, func_attr_); in TEST_F()
158 mlir::TFL::ConvertMaxUnpoolingFunc convert(fused_max_unpooling_func_, in TEST_F()
169 mlir::TFL::ConvertMaxUnpoolingFunc convert(fused_max_unpooling_func_, in TEST_F()
180 mlir::TFL::ConvertMaxUnpoolingFunc convert(fused_max_unpooling_func_, in TEST_F()
191 mlir::TFL::ConvertMaxUnpoolingFunc convert(fused_max_unpooling_func_, in TEST_F()
Dlstm_utils_test.cc44 namespace TFL { namespace
121 mlir::TFL::ConvertLSTMCellSimpleToFusedLSTM convert(fused_lstm_func_); in TEST_F()
159 mlir::TFL::LSTMOp::getOperationName()); in TEST_F()
195 mlir::TFL::ConvertLSTMCellSimpleToFusedLSTM convert(fused_lstm_func_cifg_); in TEST_F()
213 mlir::TFL::LSTMOp::getOperationName()); in TEST_F()
221 mlir::TFL::ConvertLayerNormalizedLSTMCellSimpleToFusedLSTM convert( in TEST_F()
240 mlir::TFL::LSTMOp::getOperationName()); in TEST_F()
/external/tensorflow/tensorflow/compiler/mlir/lite/experimental/tac/common/
Dutils.cc21 namespace TFL { namespace
26 if (llvm::isa<TFL::QuantizeOp, TFL::DequantizeOp>(op)) return false; in NotTFLQuantDequantizeOp()

12345678