Home
last modified time | relevance | path

Searched refs:dim_metadata (Results 1 – 25 of 26) sorted by relevance

12

/external/tensorflow/tensorflow/lite/tools/optimize/sparsity/
Dformat_converter_test.cc34 const auto& dim_metadata = converter.GetDimMetadata(); in TEST() local
37 EXPECT_EQ(dm0, dim_metadata[0]); in TEST()
38 EXPECT_EQ(dm1, dim_metadata[2]); in TEST()
63 const auto& dim_metadata = converter.GetDimMetadata(); in TEST() local
67 EXPECT_EQ(dm0_0, dim_metadata[0]); in TEST()
68 EXPECT_EQ(dm0_1, dim_metadata[1]); in TEST()
69 EXPECT_EQ(dm1, dim_metadata[2]); in TEST()
94 const auto& dim_metadata = converter.GetDimMetadata(); in TEST() local
98 EXPECT_EQ(dm0, dim_metadata[0]); in TEST()
99 EXPECT_EQ(dm1_0, dim_metadata[2]); in TEST()
[all …]
Dformat_converter.cc230 format_[i] = sparsity.dim_metadata[i].format; in FormatConverter()
232 dim_metadata_[2 * i] = {sparsity.dim_metadata[i].dense_size}; in FormatConverter()
235 TfLiteIntArrayToVector(sparsity.dim_metadata[i].array_segments); in FormatConverter()
237 TfLiteIntArrayToVector(sparsity.dim_metadata[i].array_indices); in FormatConverter()
249 block_size_[block_dim] = sparsity.dim_metadata[orig_dim].dense_size; in FormatConverter()
250 blocked_shape_[i] = shape[i] / sparsity.dim_metadata[orig_dim].dense_size; in FormatConverter()
/external/tensorflow/tensorflow/lite/tools/
Dverifier.cc134 bool CheckArraySegments(const DimensionMetadata* dim_metadata) { in CheckArraySegments() argument
135 if (dim_metadata->array_segments() == nullptr) { in CheckArraySegments()
138 switch (dim_metadata->array_segments_type()) { in CheckArraySegments()
140 return (dim_metadata->array_segments_as_Int32Vector()->values() != in CheckArraySegments()
143 return (dim_metadata->array_segments_as_Uint16Vector()->values() != in CheckArraySegments()
146 return (dim_metadata->array_segments_as_Uint8Vector()->values() != in CheckArraySegments()
153 int GetSizeOfSegments(const DimensionMetadata* dim_metadata) { in GetSizeOfSegments() argument
154 switch (dim_metadata->array_segments_type()) { in GetSizeOfSegments()
156 return dim_metadata->array_segments_as_Int32Vector()->values()->size(); in GetSizeOfSegments()
158 return dim_metadata->array_segments_as_Uint16Vector()->values()->size(); in GetSizeOfSegments()
[all …]
Dverifier_test.cc632 tensor->sparsity->dim_metadata[1]->array_indices.AsUint8Vector()->values[1] = in TEST()
709 tensor->sparsity->dim_metadata[0]->format = DimensionType_DENSE; in TEST()
710 tensor->sparsity->dim_metadata[0]->dense_size = 2; in TEST()
712 tensor->sparsity->dim_metadata[1]->format = DimensionType_SPARSE_CSR; in TEST()
713 tensor->sparsity->dim_metadata[1]->array_segments.AsUint8Vector()->values = { in TEST()
715 tensor->sparsity->dim_metadata[1]->array_indices.AsUint8Vector()->values = { in TEST()
718 tensor->sparsity->dim_metadata[2]->format = DimensionType_DENSE; in TEST()
719 tensor->sparsity->dim_metadata[2]->dense_size = 2; in TEST()
720 tensor->sparsity->dim_metadata[3]->format = DimensionType_DENSE; in TEST()
721 tensor->sparsity->dim_metadata[3]->dense_size = 2; in TEST()
/external/tensorflow/tensorflow/lite/tools/optimize/sparsity/python/
Dformat_converter_extension_test.py52 dim_metadata = converter.GetDimMetadata()
53 self.assertEqual([2], dim_metadata[0])
54 self.assertEmpty(dim_metadata[1]) # rows are dense.
56 self.assertEqual([0, 2, 3], dim_metadata[2]) # array segments.
57 self.assertEqual([0, 1, 1], dim_metadata[3]) # array indices.
59 self.assertEqual([2], dim_metadata[4])
60 self.assertEmpty(dim_metadata[5]) # sub block rows are dense.
62 self.assertEqual([2], dim_metadata[6])
63 self.assertEmpty(dim_metadata[7]) # sub block columns are dense.
/external/tensorflow/tensorflow/lite/
Dmodel_test.cc441 ASSERT_EQ(t1->sparsity->dim_metadata[0].format, kTfLiteDimDense); in TEST()
442 ASSERT_EQ(t1->sparsity->dim_metadata[0].dense_size, 2); in TEST()
443 ASSERT_EQ(t1->sparsity->dim_metadata[0].array_segments, nullptr); in TEST()
444 ASSERT_EQ(t1->sparsity->dim_metadata[0].array_indices, nullptr); in TEST()
446 ASSERT_EQ(t1->sparsity->dim_metadata[1].format, kTfLiteDimSparseCSR); in TEST()
447 ASSERT_EQ(t1->sparsity->dim_metadata[1].dense_size, 0); in TEST()
452 ASSERT_TRUE(TfLiteIntArrayEqual(t1->sparsity->dim_metadata[1].array_segments, in TEST()
460 ASSERT_TRUE(TfLiteIntArrayEqual(t1->sparsity->dim_metadata[1].array_indices, in TEST()
464 ASSERT_EQ(t1->sparsity->dim_metadata[2].format, kTfLiteDimDense); in TEST()
465 ASSERT_EQ(t1->sparsity->dim_metadata[2].dense_size, 2); in TEST()
[all …]
Dinterpreter_builder.cc429 src_sparsity->dim_metadata() == nullptr) { in ParseSparsity()
454 const size_t dim_metadata_size = src_sparsity->dim_metadata()->size(); in ParseSparsity()
456 sparsity->dim_metadata = reinterpret_cast<TfLiteDimensionMetadata*>( in ParseSparsity()
458 memset(sparsity->dim_metadata, 0, in ParseSparsity()
462 const auto* src_metadata = src_sparsity->dim_metadata()->Get(i); in ParseSparsity()
470 auto* tgt_metadata = &sparsity->dim_metadata[i]; in ParseSparsity()
/external/tensorflow/tensorflow/lite/c/
Dcommon_test.cc127 t.sparsity->dim_metadata = static_cast<TfLiteDimensionMetadata*>( in TEST()
131 t.sparsity->dim_metadata[0].format = kTfLiteDimDense; in TEST()
132 t.sparsity->dim_metadata[0].dense_size = 4; in TEST()
134 t.sparsity->dim_metadata[1].format = kTfLiteDimSparseCSR; in TEST()
135 t.sparsity->dim_metadata[1].array_segments = TfLiteIntArrayCreate(2); in TEST()
136 t.sparsity->dim_metadata[1].array_indices = TfLiteIntArrayCreate(3); in TEST()
Dcommon.c124 if (sparsity->dim_metadata) { in TfLiteSparsityFree()
127 TfLiteDimensionMetadata metadata = sparsity->dim_metadata[i]; in TfLiteSparsityFree()
135 free(sparsity->dim_metadata); in TfLiteSparsityFree()
136 sparsity->dim_metadata = NULL; in TfLiteSparsityFree()
Dcommon.h365 TfLiteDimensionMetadata* dim_metadata; member
/external/tensorflow/tensorflow/lite/kernels/internal/optimized/sparse_ops/
Dfully_connected.h48 const int w0_size = sparsity.dim_metadata[0].dense_size; in FullyConnectedSparseWeight()
49 const int* w1_segments = sparsity.dim_metadata[1].array_segments->data; in FullyConnectedSparseWeight()
50 const int* w1_indices = sparsity.dim_metadata[1].array_indices->data; in FullyConnectedSparseWeight()
96 const int* w1_segments = sparsity.dim_metadata[1].array_segments->data; in FullyConnectedSparseWeight1x4Impl()
97 const int* w1_indices = sparsity.dim_metadata[1].array_indices->data; in FullyConnectedSparseWeight1x4Impl()
/external/tensorflow/tensorflow/lite/delegates/xnnpack/
Dbinary_elementwise_tester.cc267 std::vector<flatbuffers::Offset<DimensionMetadata>> dim_metadata( in CreateTfLiteModel() local
272 dim_metadata[i] = CreateDimensionMetadata(builder, DimensionType_DENSE, in CreateTfLiteModel()
277 0, builder.CreateVector(dim_metadata)); in CreateTfLiteModel()
293 std::vector<flatbuffers::Offset<DimensionMetadata>> dim_metadata( in CreateTfLiteModel() local
298 dim_metadata[i] = CreateDimensionMetadata(builder, DimensionType_DENSE, in CreateTfLiteModel()
303 0, builder.CreateVector(dim_metadata)); in CreateTfLiteModel()
Dprelu_tester.cc149 std::vector<flatbuffers::Offset<DimensionMetadata>> dim_metadata( in CreateTfLiteModel() local
154 dim_metadata[i] = CreateDimensionMetadata(builder, DimensionType_DENSE, in CreateTfLiteModel()
159 0, builder.CreateVector(dim_metadata)); in CreateTfLiteModel()
Dconv_2d_tester.cc257 std::vector<flatbuffers::Offset<DimensionMetadata>> dim_metadata( in CreateTfLiteModel() local
262 dim_metadata[i] = CreateDimensionMetadata(builder, DimensionType_DENSE, in CreateTfLiteModel()
267 0, builder.CreateVector(dim_metadata)); in CreateTfLiteModel()
Ddepthwise_conv_2d_tester.cc259 std::vector<flatbuffers::Offset<DimensionMetadata>> dim_metadata( in CreateTfLiteModel() local
264 dim_metadata[i] = CreateDimensionMetadata(builder, DimensionType_DENSE, in CreateTfLiteModel()
269 0, builder.CreateVector(dim_metadata)); in CreateTfLiteModel()
/external/tensorflow/tensorflow/lite/python/interpreter_wrapper/
Dinterpreter_wrapper.cc116 PyObject* dim_metadata = PyList_New(param.dim_metadata_size); in PyDictFromSparsityParam() local
119 if (param.dim_metadata[i].format == kTfLiteDimDense) { in PyDictFromSparsityParam()
122 PyLong_FromSize_t(param.dim_metadata[i].dense_size)); in PyDictFromSparsityParam()
125 const auto* array_segments = param.dim_metadata[i].array_segments; in PyDictFromSparsityParam()
126 const auto* array_indices = param.dim_metadata[i].array_indices; in PyDictFromSparsityParam()
134 PyList_SetItem(dim_metadata, i, dim_metadata_i); in PyDictFromSparsityParam()
136 PyDict_SetItemString(result, "dim_metadata", dim_metadata); in PyDictFromSparsityParam()
/external/tensorflow/tensorflow/lite/kernels/
Dtest_util.h228 const auto& dim_metadata = converter.GetDimMetadata(); in AddConstSparseInput() local
240 builder_.CreateVector(dim_metadata[metadata_idx])) in AddConstSparseInput()
244 builder_, builder_.CreateVector(dim_metadata[metadata_idx + 1])) in AddConstSparseInput()
252 builder_, DimensionType_DENSE, dim_metadata[metadata_idx][0]); in AddConstSparseInput()
300 const auto dim_metadata = converter.GetDimMetadata();
312 builder_.CreateVector(dim_metadata[metadata_idx]))
316 builder_, builder_.CreateVector(dim_metadata[metadata_idx + 1]))
324 builder_, DimensionType_DENSE, dim_metadata[metadata_idx][0]);
583 ->dim_metadata[tensor->sparsity->dim_metadata_size - 1] in ExtractVector()
Dfully_connected.cc45 if (sparsity.dim_metadata[0].format == kTfLiteDimDense && in SupportedSparsityFormat()
46 sparsity.dim_metadata[1].format == kTfLiteDimSparseCSR) { in SupportedSparsityFormat()
62 ledger_size->data[0] = sparsity->dim_metadata[1].array_indices->size + in CreateLedgerTensor()
63 sparsity->dim_metadata[1].array_segments->size - 1; in CreateLedgerTensor()
70 const auto* array_segments = sparsity->dim_metadata[1].array_segments; in PopulateLedgerData()
71 const auto* array_indices = sparsity->dim_metadata[1].array_indices; in PopulateLedgerData()
878 sparsity.dim_metadata[2].dense_size == 4) { in EvalFloat()
Dlstm.cc103 ledger_size->data[0] = sparsity->dim_metadata[1].array_indices->size + in make_ledger()
104 sparsity->dim_metadata[1].array_segments->size - 1; in make_ledger()
113 const auto* array_segments = sparsity->dim_metadata[1].array_segments; in copy_ledger()
114 const auto* array_indices = sparsity->dim_metadata[1].array_indices; in copy_ledger()
/external/tensorflow/tensorflow/compiler/mlir/lite/transforms/
Ddense_to_sparse.cc250 std::vector<Attribute> dim_metadata(traversal_order.size()); in BuildSparsityParameterAttribute() local
253 dim_metadata[i] = DimensionMetadataAttr::get( in BuildSparsityParameterAttribute()
259 dim_metadata[i] = DimensionMetadataAttr::get( in BuildSparsityParameterAttribute()
267 builder->getI32ArrayAttr(b_map), builder->getArrayAttr(dim_metadata), in BuildSparsityParameterAttribute()
/external/tensorflow/tensorflow/compiler/mlir/lite/ir/
Dtfl_structs.td38 StructFieldAttr<"dim_metadata", DimensionMetadataArrayAttr>]> {
/external/tensorflow/tensorflow/compiler/mlir/lite/
Dflatbuffer_export.cc1850 const int dim_size = s_attr.dim_metadata().size(); in BuildSparsityParameters()
1854 const auto dim_metadata = in BuildSparsityParameters() local
1855 s_attr.dim_metadata()[i].dyn_cast<mlir::TFL::DimensionMetadataAttr>(); in BuildSparsityParameters()
1856 if (dim_metadata.format().getValue() == "DENSE") { in BuildSparsityParameters()
1859 dim_metadata.dense_size().getInt()); in BuildSparsityParameters()
1862 auto segments = dim_metadata.segments(); in BuildSparsityParameters()
1893 auto indices = dim_metadata.indices(); in BuildSparsityParameters()
/external/tensorflow/tensorflow/compiler/mlir/lite/tests/flatbuffer2mlir/
Dtest_schema.fbs178 // The size of the dim_metadata array = the size of the traversal_order array
180 dim_metadata:[DimensionMetadata];
/external/tensorflow/tensorflow/lite/schema/
Dschema_v3a.fbs181 // The size of the dim_metadata array = the size of the traversal_order array
183 dim_metadata:[DimensionMetadata];
Dschema.fbs185 // The size of the dim_metadata array = the size of the traversal_order array
187 dim_metadata:[DimensionMetadata];

12