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 31 // Information about the op where the error occurs. 32 message Operator { 33 // The op name has "<dialect>.<name>" format, Ex: "tf.Abs". 34 optional string name = 1; 35 } 36 37 // Represents the type of location. 38 enum LocationType { 39 // No location information available. 40 UNKNOWNLOC = 0; 41 // The location is the nodename; 42 NAMELOC = 1; 43 // The location is a stacktrace. 44 CALLSITELOC = 2; 45 // The location is a fused location, usually represents the list of output 46 // tensor locations of that node. 47 FUSEDLOC = 3; 48 } 49 50 // Represents a source location with file name, line and column number. 51 message FileLoc { 52 optional string filename = 1; 53 optional uint32 line = 2; 54 optional uint32 column = 3; 55 } 56 57 // Represents the node name and its source location. 58 message SourceLoc { 59 optional string name = 1; 60 optional FileLoc source = 2; 61 } 62 63 // Represents the location information of current node. 64 message Location { 65 optional LocationType type = 1; 66 // For each location type, this field is different. If type is: 67 // - UNKNOWNLOC: call is empty. 68 // - NAMELOC: call has a single element representing the current node. 69 // - CALLSITELOC: call is a chain of source locations representing a 70 // stacktrace. 71 // - FUSEDLOC: call is a list, represents the list of output tensor 72 // locations. 73 repeated SourceLoc call = 2; 74 } 75 76 // The name of the component from which the error was originally thrown. 77 optional string component = 1; 78 // The name of the subcomponent from which the error was originally thrown. In 79 // MLIR, this field contains the pass name. 80 optional string subcomponent = 2; 81 82 optional ErrorCode error_code = 3; 83 optional string error_message = 4; 84 optional Operator operator = 5; 85 optional Location location = 6; 86} 87