Skip to content

Commit

Permalink
std::function cannot be used with bluepill target
Browse files Browse the repository at this point in the history
The bluepill target is compiled with -fnostdlib which means the bad_function_call exception is not available.
  • Loading branch information
ddavis-2015 committed Feb 21, 2021
1 parent 69d6e94 commit f7ef7cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tensorflow/lite/micro/kernels/elu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.

#include <algorithm>
#include <cmath>
#include <functional>
#include <limits>

#include "tensorflow/lite/c/common.h"
Expand All @@ -41,10 +40,11 @@ struct OpData {
int8_t table[256];
};

using TransformFunc = float (*)(float);

template <typename T>
void PopulateLookupTable(const TfLiteTensor* input, const TfLiteTensor* output,
const std::function<float(float)> transform,
OpData* data) {
const TransformFunc transform, OpData* data) {
if (sizeof(T) != 1) TF_LITE_FATAL("Lookup table valid only for 8bit");

const float inverse_scale = 1 / output->params.scale;
Expand Down Expand Up @@ -88,7 +88,7 @@ TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node) {
// Use LUT to handle quantized elu path.
if (input->type == kTfLiteInt8) {
OpData* data = static_cast<OpData*>(node->user_data);
auto transform = [](float value) {
TransformFunc transform = [](float value) {
return value < 0.0f ? std::exp(value) - 1.0f : value;
};
PopulateLookupTable<int8_t>(input, output, transform, data);
Expand Down

0 comments on commit f7ef7cd

Please sign in to comment.