xref: /aosp_15_r20/external/tensorflow/tensorflow/lite/python/metrics/converter_error_data.proto (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1// Copyright 2021 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// This schema defines the converter error format to communicate between C++
16// and python.
17
18syntax = "proto2";
19
20package tflite.metrics;
21
22message ConverterErrorData {
23  // Error code for popular errors.
24  enum ErrorCode {
25    UNKNOWN = 0;
26    ERROR_NEEDS_FLEX_OPS = 1;
27    ERROR_NEEDS_CUSTOM_OPS = 2;
28    ERROR_UNSUPPORTED_CONTROL_FLOW_V1 = 3;
29
30    // 200- 209 error codes are reserved for backend(delegate) compatibility.
31    // Backend compatibility is checked at MlirToFlatBufferTranslateFunction()
32    // with the converted flatbuffer model. If some nodes are incompatibile with
33    // the given backends in TocoFlags.supported_backends, the error will be
34    // raised.
35    ERROR_GPU_NOT_COMPATIBLE = 200;
36  }
37
38  // Information about the op where the error occurs.
39  message Operator {
40    // The op name has "<dialect>.<name>" format, Ex: "tf.Abs".
41    optional string name = 1;
42  }
43
44  // Represents the type of location.
45  enum LocationType {
46    // No location information available.
47    UNKNOWNLOC = 0;
48    // The location is the nodename;
49    NAMELOC = 1;
50    // The location is a stacktrace.
51    CALLSITELOC = 2;
52    // The location is a fused location, usually represents the list of output
53    // tensor locations of that node.
54    FUSEDLOC = 3;
55  }
56
57  // Represents a source location with file name, line and column number.
58  message FileLoc {
59    optional string filename = 1;
60    optional uint32 line = 2;
61    optional uint32 column = 3;
62  }
63
64  // Represents the node name and its source location.
65  message SourceLoc {
66    optional string name = 1;
67    optional FileLoc source = 2;
68  }
69
70  // Represents the location information of current node.
71  message Location {
72    optional LocationType type = 1;
73    // For each location type, this field is different. If type is:
74    // - UNKNOWNLOC: call is empty.
75    // - NAMELOC: call has a single element representing the current node.
76    // - CALLSITELOC: call is a chain of source locations representing a
77    //     stacktrace.
78    // - FUSEDLOC: call is a list, represents the list of output tensor
79    //     locations.
80    repeated SourceLoc call = 2;
81  }
82
83  // The name of the component from which the error was originally thrown.
84  optional string component = 1;
85  // The name of the subcomponent from which the error was originally thrown. In
86  // MLIR, this field contains the pass name.
87  optional string subcomponent = 2;
88
89  optional ErrorCode error_code = 3;
90  optional string error_message = 4;
91  optional Operator operator = 5;
92  optional Location location = 6;
93}
94