Skip to content

Commit 6f53f22

Browse files
committed
IDF release/v5.1 d3c99ed3b8
1 parent 5476c4b commit 6f53f22

File tree

112 files changed

+5055
-239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+5055
-239
lines changed

esp32/dio_qspi/include/sdkconfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@
458458
#define CONFIG_ETH_USE_SPI_ETHERNET 1
459459
#define CONFIG_ETH_SPI_ETHERNET_DM9051 1
460460
#define CONFIG_ETH_SPI_ETHERNET_W5500 1
461+
#define CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL 1
461462
#define CONFIG_ESP_EVENT_POST_FROM_ISR 1
462463
#define CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR 1
463464
#define CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS 1
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef SIGNAL_MICRO_KERNELS_PCAN_FLEXBUFFERS_GENERATED_DATA_H_
2+
#define SIGNAL_MICRO_KERNELS_PCAN_FLEXBUFFERS_GENERATED_DATA_H_
3+
4+
extern const int g_gen_data_size_snr_shift_6_test;
5+
extern const unsigned char g_gen_data_snr_shift_6_test[];
6+
7+
#endif // SIGNAL_MICRO_KERNELS_PCAN_FLEXBUFFERS_GENERATED_DATA_H_
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
==============================================================================*/
15+
16+
#ifndef SIGNAL_MICRO_KERNELS__SRC_PCAN_AGC_FIXED_H
17+
#define SIGNAL_MICRO_KERNELS__SRC_PCAN_AGC_FIXED_H
18+
#include <cstdint>
19+
20+
#include "msb.h"
21+
#include "tensorflow/lite/kernels/internal/compatibility.h"
22+
23+
namespace tflite {
24+
namespace tflm_signal {
25+
26+
#define kPcanSnrBits 12
27+
#define kPcanOutputBits 6
28+
29+
int16_t WideDynamicFunction(const uint32_t x, const int16_t* lut);
30+
31+
uint32_t PcanShrink(const uint32_t x);
32+
33+
void ApplyPcanAutoGainControlFixed(const int16_t* gain_lut, int32_t snr_shift,
34+
const uint32_t* noise_estimate,
35+
uint32_t* filterbank_output,
36+
int num_channels);
37+
38+
} // namespace tflm_signal
39+
} // namespace tflite
40+
41+
#endif // SIGNAL_MICRO_KERNELS__PCAN_AGC_FIXED_H

esp32/include/esp-tflite-micro/tensorflow/lite/builtin_ops.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,23 @@ typedef enum {
200200
kTfLiteBuiltinStablehloBroadcastInDim = 170,
201201
kTfLiteBuiltinStablehloConvolution = 171,
202202
kTfLiteBuiltinStablehloSlice = 172,
203+
kTfLiteBuiltinStablehloCustomCall = 173,
204+
kTfLiteBuiltinStablehloReduce = 174,
205+
kTfLiteBuiltinStablehloAbs = 175,
206+
kTfLiteBuiltinStablehloAnd = 176,
207+
kTfLiteBuiltinStablehloCosine = 177,
208+
kTfLiteBuiltinStablehloExponential = 178,
209+
kTfLiteBuiltinStablehloFloor = 179,
210+
kTfLiteBuiltinStablehloLog = 180,
211+
kTfLiteBuiltinStablehloMinimum = 181,
212+
kTfLiteBuiltinStablehloNegate = 182,
213+
kTfLiteBuiltinStablehloOr = 183,
214+
kTfLiteBuiltinStablehloPower = 184,
215+
kTfLiteBuiltinStablehloRemainder = 185,
216+
kTfLiteBuiltinStablehloRsqrt = 186,
217+
kTfLiteBuiltinStablehloSelect = 187,
218+
kTfLiteBuiltinStablehloSubtract = 188,
219+
kTfLiteBuiltinStablehloTanh = 189,
203220
} TfLiteBuiltinOperator;
204221

205222
#ifdef __cplusplus

esp32/include/esp-tflite-micro/tensorflow/lite/kernels/internal/common.h

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ limitations under the License.
1616
#define TENSORFLOW_LITE_KERNELS_INTERNAL_COMMON_H_
1717

1818
#include <algorithm>
19+
#include <cstddef>
20+
21+
#include "tensorflow/lite/kernels/internal/runtime_shape.h"
1922
#ifndef ALLOW_SLOW_GENERIC_DEPTHWISECONV_FALLBACK
2023
#ifdef GEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK
2124
#define ALLOW_SLOW_GENERIC_DEPTHWISECONV_FALLBACK
@@ -35,6 +38,113 @@ namespace tflite {
3538

3639
constexpr int kReverseShift = -1;
3740

41+
template <int MAX_DIM = 6>
42+
inline void ReduceDimensionsForBroadcast(const RuntimeShape& input1_shape,
43+
const RuntimeShape& input2_shape,
44+
size_t* compressed_input1_stride,
45+
size_t* compressed_input2_stride,
46+
size_t* compressed_output_shape) {
47+
size_t num_compressed_dims = 0;
48+
size_t compressed_input1_shape[MAX_DIM];
49+
size_t compressed_input2_shape[MAX_DIM];
50+
std::fill(compressed_input1_shape, compressed_input1_shape + MAX_DIM, 1);
51+
std::fill(compressed_input2_shape, compressed_input2_shape + MAX_DIM, 1);
52+
std::fill(compressed_output_shape, compressed_output_shape + MAX_DIM, 1);
53+
bool broadcast_input1 = false;
54+
bool broadcast_input2 = false;
55+
bool first_nonunit = true;
56+
bool degenerate_shape = false;
57+
const size_t num_input1_dims = input1_shape.DimensionsCount();
58+
const size_t num_input2_dims = input2_shape.DimensionsCount();
59+
const int32_t* input1_dims = input1_shape.DimsData();
60+
const int32_t* input2_dims = input2_shape.DimsData();
61+
const size_t num_common_dims =
62+
(num_input1_dims < num_input2_dims) ? num_input1_dims : num_input2_dims;
63+
for (size_t i = 1; i <= num_common_dims; i++) {
64+
const size_t input1_dim = input1_dims[num_input1_dims - i];
65+
const size_t input2_dim = input2_dims[num_input2_dims - i];
66+
degenerate_shape |= input1_dim == 0;
67+
degenerate_shape |= input2_dim == 0;
68+
if (input1_dim == 1 && input2_dim == 1) {
69+
continue;
70+
}
71+
assert(!broadcast_input1 || !broadcast_input2);
72+
73+
if (input1_dim == 1) {
74+
if (!broadcast_input1) {
75+
broadcast_input1 = true;
76+
broadcast_input2 = false;
77+
num_compressed_dims++;
78+
}
79+
compressed_input2_shape[num_compressed_dims - 1] *= input2_dim;
80+
compressed_output_shape[num_compressed_dims - 1] *= input2_dim;
81+
} else if (input2_dim == 1) {
82+
if (!broadcast_input2) {
83+
broadcast_input1 = false;
84+
broadcast_input2 = true;
85+
num_compressed_dims++;
86+
}
87+
compressed_input1_shape[num_compressed_dims - 1] *= input1_dim;
88+
compressed_output_shape[num_compressed_dims - 1] *= input1_dim;
89+
} else {
90+
TFLITE_DCHECK(input1_dim == input2_dim);
91+
if (broadcast_input1 || broadcast_input2 || first_nonunit) {
92+
broadcast_input1 = false;
93+
broadcast_input2 = false;
94+
num_compressed_dims++;
95+
}
96+
compressed_input1_shape[num_compressed_dims - 1] *= input1_dim;
97+
compressed_input2_shape[num_compressed_dims - 1] *= input1_dim;
98+
compressed_output_shape[num_compressed_dims - 1] *= input1_dim;
99+
}
100+
first_nonunit = false;
101+
}
102+
if (num_input1_dims > num_input2_dims) {
103+
if (!broadcast_input2) {
104+
num_compressed_dims++;
105+
}
106+
for (size_t i = 0; i < num_input1_dims - num_input2_dims; i++) {
107+
const size_t input1_dim = input1_dims[i];
108+
degenerate_shape |= input1_dim == 0;
109+
compressed_input1_shape[num_compressed_dims - 1] *= input1_dim;
110+
compressed_output_shape[num_compressed_dims - 1] *= input1_dim;
111+
}
112+
} else if (num_input2_dims > num_input1_dims) {
113+
if (!broadcast_input1) {
114+
num_compressed_dims++;
115+
}
116+
for (size_t i = 0; i < num_input2_dims - num_input1_dims; i++) {
117+
const size_t input2_dim = input2_dims[i];
118+
degenerate_shape |= input2_dim == 0;
119+
compressed_input2_shape[num_compressed_dims - 1] *= input2_dim;
120+
compressed_output_shape[num_compressed_dims - 1] *= input2_dim;
121+
}
122+
}
123+
num_compressed_dims = (num_compressed_dims > 1) ? num_compressed_dims : 1;
124+
125+
// Early exit without setting up context if any shape dimension is zero.
126+
TFLITE_DCHECK(!degenerate_shape);
127+
128+
int input1_stride = 1;
129+
int input2_stride = 1;
130+
for (int i = 0; i < MAX_DIM; ++i) {
131+
compressed_input1_stride[i] = input1_stride;
132+
input1_stride *= compressed_input1_shape[i];
133+
compressed_input2_stride[i] = input2_stride;
134+
input2_stride *= compressed_input2_shape[i];
135+
}
136+
for (int i = 0; i < MAX_DIM; ++i) {
137+
if (compressed_input1_shape[i] != compressed_input2_shape[i]) {
138+
if (compressed_input1_shape[i] == 1) {
139+
compressed_input1_stride[i] = 0;
140+
} else {
141+
TFLITE_DCHECK_EQ(compressed_input2_shape[i], 1);
142+
compressed_input2_stride[i] = 0;
143+
}
144+
}
145+
}
146+
}
147+
38148
inline void GetActivationMinMax(FusedActivationFunctionType ac,
39149
float* output_activation_min,
40150
float* output_activation_max) {

0 commit comments

Comments
 (0)