xref: /aosp_15_r20/external/tensorflow/tensorflow/lite/experimental/telemetry/telemetry_settings.h (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1 /* Copyright 2022 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 TENSORFLOW_LITE_EXPERIMENTAL_TELEMETRY_TELEMETRY_INFO_H_
17 #define TENSORFLOW_LITE_EXPERIMENTAL_TELEMETRY_TELEMETRY_INFO_H_
18 
19 #include <map>
20 #include <string>
21 
22 #include "tensorflow/lite/experimental/telemetry/telemetry_status.h"
23 
24 namespace tflite {
25 
26 // TFLite model and interpreter settings that will be reported by telemetry.
27 struct TelemetrySettings {
28   // Source of the settings. Determines how `data` is interpreted.
29   TelemetrySource source;
30   // Settings data. Interpretation based on `source`.
31   // If `source` is TFLITE_INTERPRETER, the type of `data` will
32   // be `TelemetryInterpreterSettings`.
33   // Otherwise, the data is provided by the individual delegate.
34   const void* data = nullptr;
35 };
36 
37 // TfLite model information and settings of the interpreter.
38 struct TelemetryInterpreterSettings {
39   TelemetryInterpreterSettings() = default;
40 
41   // Metadata from the TfLite model.
42   std::map<std::string, std::string> model_metadata;
43 };
44 
45 }  // namespace tflite
46 
47 #endif  // TENSORFLOW_LITE_EXPERIMENTAL_TELEMETRY_TELEMETRY_INFO_H_
48