Getting this error while trying to compile my code "Compilation error: tensorflow/lite/micro/kernels/micro_ops.h: No such file or directory"

I'm trying to compile my sketch but keep getting this error eventhough I have the files in the correct path?
These are my header files

#include "TensorFlowLite.h"

#include "main_functions.h"

#include "tensorflow/lite/micro/kernels/micro_ops.h"

#include "tensorflow/lite/micro/micro_error_reporter.h"

#include "tensorflow/lite/micro/micro_interpreter.h"

#include "tensorflow/lite/micro/micro_mutable_op_resolver.h"

#include "tensorflow/lite/schema/schema_generated.h"

#include "tensorflow/lite/version.h"

#include "mnist.h"

My sketch is located in Arduino>libraries>tensorflow>mnist>mnist.ino

Can someone please explain to me what is the mistake?

Welcome to the forum

Please post the complete sketch and the full error message

Hi @vpranesh. Did you already resolve the problem? I had the impression from our discussion on your GitHub issue that it had been resolved:

But if you are still having a problem we will be happy to help you out.

C:\Users\prane\Documents\Arduino\libraries\tensorflow\mnist\mnist.ino:3:10: fatal error: tensorflow/lite/micro/kernels/micro_ops.h: No such file or directory
 #include "tensorflow/lite/micro/kernels/micro_ops.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: tensorflow/lite/micro/kernels/micro_ops.h: No such file or directory

I dont think the full sketch will be helpful, as the problem is not being able to detect the file inside the library. and the same problem occurs irrespective of the main sketch anyway I have provided the full code below

#include "TensorFlowLite.h"
#include "main_functions.h"
#include "tensorflow/lite/micro/kernels/micro_ops.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/micro/micro_mutable_op_resolver.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/version.h"

#include "mnist.h"

#define TFLITE_MINIMAL_CHECK(x)                              \
  if (!(x)) {                                                \
    error_reporter->Report("Error at %s:%d\n", __FILE__, __LINE__); \
    return kTfLiteError;                                    \
  }

// Return the top k results.
constexpr int kNumResults = 3;
constexpr float kThreshold = 0.1f;

namespace {
tflite::ErrorReporter* error_reporter = nullptr;
const tflite::Model* model = nullptr;
tflite::MicroInterpreter* interpreter = nullptr;
TfLiteTensor* input = nullptr;
TfLiteTensor* output = nullptr;

// Create an area of memory to use for input, output, and intermediate arrays.
constexpr int kTensorArenaSize = 60 * 1024;
uint8_t tensor_arena[kTensorArenaSize];

void GetTopN(int32_t* prediction, int num_results, float threshold,
             int* top_N, int& output_size) {
  // Find the top-N results.
  int32_t max_value = -1;
  int max_index = -1;
  for (int i = 0; i < num_results; ++i) {
    for (int j = 0; j < 10; ++j) {
      if (prediction[j] > max_value) {
        max_value = prediction[j];
        max_index = j;
      }
    }
    if (max_value < threshold) {
      output_size = i;
      return;
    }
    top_N[i] = max_index;
    prediction[max_index] = -1;
    max_index = -1;
    max_value = -1;
  }
  output_size = num_results;
}
}  // namespace

void setup() {
  // Set up logging. Google style is to avoid globals or statics because of
  // lifetime uncertainty, but since this routine is only called once, we can
  // make an exception.
  static tflite::MicroErrorReporter micro_error_reporter;
  error_reporter = &micro_error_reporter; 

Thanks

I still have the same problem inspite of using the new version. I just thought of posting the issue here

thanks

:pencil2: :point_down: <|> :point_up_2:

Edit your post to include code tags for readability

Good plan. Which version of Arduino IDE are you using (e.g., "2.0.1")? The version is shown on the window title bar and also in the Help > About dialog.

I ask for this information because I want to give you the appropriate instructions for the IDE version you are using.

version 2.0.3 ..the latest one

Is the issue resolved?

Hi @mrunaliontra. Please provide a detailed description of the problem you are having. Make sure to include the full and exact text of any error or warning messages you encountered.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.