| @@ -195,8 +195,40 @@ target_compile_options(parser_caffe_proto_obj PRIVATE | |||
| $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT> | |||
| ) | |||
| ############ lib_caffe_parser.so ############ | |||
| add_library(_caffe_parser SHARED | |||
| $<TARGET_OBJECTS:parser_caffe_proto_obj> | |||
| ) | |||
| target_compile_definitions(_caffe_parser PRIVATE | |||
| google=ascend_private | |||
| ) | |||
| target_include_directories(_caffe_parser PRIVATE | |||
| ${CMAKE_CURRENT_LIST_DIR} | |||
| ) | |||
| target_link_options(_caffe_parser PRIVATE | |||
| -Wl,-Bsymbolic | |||
| ) | |||
| target_link_libraries(_caffe_parser PRIVATE | |||
| $<BUILD_INTERFACE:intf_pub> | |||
| -Wl,--no-as-needed | |||
| ascend_protobuf | |||
| -Wl,--as-needed | |||
| ) | |||
| ############ install ############ | |||
| set(INSTALL_BASE_DIR "") | |||
| set(INSTALL_LIBRARY_DIR lib) | |||
| install(TARGETS _caffe_parser OPTIONAL | |||
| LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | |||
| ) | |||
| add_subdirectory(parser) | |||
| add_subdirectory(parser/common) | |||
| add_subdirectory(parser/func_to_graph) | |||
| add_subdirectory(parser/onnx) | |||
| add_subdirectory(parser/proto/caffe) | |||
| @@ -1,193 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package ge.proto; | |||
| enum DataType | |||
| { | |||
| DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set. | |||
| DT_FLOAT = 1; // float type | |||
| DT_FLOAT16 = 2; // fp16 type | |||
| DT_INT8 = 3; // int8 type | |||
| DT_UINT8 = 4; // uint8 type | |||
| DT_INT16 = 5; // int16 type | |||
| DT_UINT16 = 6; // uint16 type | |||
| DT_INT32 = 7; // | |||
| DT_INT64 = 8; // int64 type | |||
| DT_UINT32 = 9; // unsigned int32 | |||
| DT_UINT64 = 10; // unsigned int64 | |||
| DT_BOOL = 11; // bool type | |||
| DT_DOUBLE = 12; // double type | |||
| DT_STRING = 13; // string type | |||
| DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */ | |||
| DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */ | |||
| DT_COMPLEX64 = 16; // complex64 type | |||
| DT_COMPLEX128 = 17; // complex128 type | |||
| DT_QINT8 = 18; // qint8 type | |||
| DT_QINT16 = 19; // qint16 type | |||
| DT_QINT32 = 20; // qint32 type | |||
| DT_QUINT8 = 21; // quint8 type | |||
| DT_QUINT16 = 22; // quint16 type | |||
| DT_RESOURCE = 23; // resource type | |||
| DT_STRING_REF = 24; // string_ref type | |||
| DT_DUAL = 25; /**< dual output type */ | |||
| DT_VARIANT = 26; // variant type | |||
| DT_BF16 = 27; // bf16 type | |||
| DT_INT4 = 28; // int4 type | |||
| } | |||
| message AttrDef | |||
| { | |||
| message ListValue | |||
| { | |||
| enum ListValueType{ | |||
| VT_LIST_NONE = 0; | |||
| VT_LIST_STRING = 1; | |||
| VT_LIST_INT = 2; | |||
| VT_LIST_FLOAT = 3; | |||
| VT_LIST_BOOL = 4; | |||
| VT_LIST_BYTES = 5; | |||
| VT_LIST_TENSOR_DESC = 6; | |||
| VT_LIST_TENSOR = 7; | |||
| VT_LIST_GRAPH = 8; | |||
| VT_LIST_NAMED_ATTRS = 9; | |||
| VT_LIST_DATA_TYPE = 10; | |||
| } | |||
| repeated bytes s = 2; // "list(string)" | |||
| repeated int64 i = 3; // "list(int)" | |||
| repeated float f = 4; // "list(float)" | |||
| repeated bool b = 5; // "list(bool)" | |||
| repeated bytes bt = 7; | |||
| repeated TensorDescriptor td = 8; | |||
| repeated TensorDef t = 9; | |||
| repeated GraphDef g = 10; | |||
| repeated NamedAttrs na = 11; | |||
| repeated int64 dt = 12; // list ge::DataType | |||
| ListValueType val_type = 20; | |||
| } | |||
| message ListListInt{ | |||
| message ListInt{ | |||
| repeated int64 list_i = 1; // list int | |||
| } | |||
| repeated ListInt list_list_i = 1; // list list int | |||
| } | |||
| oneof value | |||
| { | |||
| bytes s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| bytes bt = 7; | |||
| ListValue list = 1; // any "list(...)" | |||
| NamedAttrs func = 10; // Used to support attr nesting | |||
| TensorDescriptor td = 11; // GeTensorDesc type | |||
| TensorDef t = 12; // GeTensor type | |||
| GraphDef g = 13; // Graph type | |||
| ListListInt list_list_int = 14; // List List Int type | |||
| int64 dt = 15; // ge::DataType | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NamedAttrs | |||
| { | |||
| string name = 1; | |||
| map<string, AttrDef> attr = 2; | |||
| } | |||
| // Shape / dimension description, using row-major order | |||
| message ShapeDef | |||
| { | |||
| repeated int64 dim = 1; // Size of each dimension | |||
| } | |||
| // Multidimensional data description | |||
| message TensorDescriptor | |||
| { | |||
| string name = 1; // Optional parameter, tensor name | |||
| DataType dtype = 2; // tensor datatype | |||
| ShapeDef shape = 3; // Shape / dimension | |||
| string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND" | |||
| bool has_out_attr = 9; | |||
| int64 size = 10; | |||
| int64 weight_size = 11; | |||
| bool reuse_input = 12; | |||
| bool output_tensor = 13; | |||
| string device_type = 14; | |||
| bool input_tensor =15; | |||
| int64 real_dim_cnt = 16; | |||
| int64 reuse_input_index = 17; | |||
| int64 data_offset = 18; | |||
| int64 cmps_size = 19; | |||
| string cmps_tab = 20; | |||
| int64 cmps_tab_offset = 21; | |||
| map<string, AttrDef> attr = 5; // Set of extra parameter fields | |||
| } | |||
| // GeTensor definition | |||
| message TensorDef | |||
| { | |||
| TensorDescriptor desc = 1; // Tensor description | |||
| bytes data = 2; // Tensor data | |||
| } | |||
| // Operator description | |||
| message OpDef | |||
| { | |||
| string name = 1; // name | |||
| string type = 2; // type | |||
| repeated string input = 5; // input original op name + outgoing index. op_name:index | |||
| map<string, AttrDef> attr = 10; // Set of operator parameter fields | |||
| bool has_out_attr = 20; | |||
| int64 id = 21; | |||
| int64 stream_id =22; | |||
| repeated string input_name = 23; | |||
| repeated string src_name = 24; | |||
| repeated int64 src_index = 25; | |||
| repeated string dst_name = 26; | |||
| repeated int64 dst_index = 27; | |||
| repeated int64 input_i = 28; | |||
| repeated int64 output_i = 29; | |||
| repeated int64 workspace = 30; | |||
| repeated int64 workspace_bytes = 31; | |||
| repeated bool is_input_const = 32; | |||
| repeated TensorDescriptor input_desc = 33; | |||
| repeated TensorDescriptor output_desc = 34; | |||
| repeated string subgraph_name = 35; | |||
| } | |||
| // Graph definition | |||
| message GraphDef | |||
| { | |||
| string name = 1; // name | |||
| repeated string input = 4; // Graph input | |||
| repeated string output = 5; // Graph output | |||
| repeated OpDef op = 6; // List of operators | |||
| map<string, AttrDef> attr = 11; // Extended field | |||
| } | |||
| // model definition | |||
| message ModelDef | |||
| { | |||
| string name = 1; // name | |||
| uint32 version = 2; // IR Proto verion | |||
| string custom_version = 3; // User model version number, passed in by user | |||
| repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef | |||
| map<string, AttrDef> attr = 11; // Extended field | |||
| } | |||
| @@ -1,396 +0,0 @@ | |||
| /* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * Apache License for more details at | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| */ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| enum TargetType | |||
| { | |||
| MINI = 0; | |||
| TINY = 1; | |||
| LITE = 2; | |||
| } | |||
| // offline model | |||
| message ModelDef { | |||
| string name = 1; | |||
| uint32 version = 2; | |||
| uint64 memory_size = 10; | |||
| uint32 stream_num = 11; | |||
| uint32 event_num = 12; | |||
| uint64 weight_size = 13; | |||
| uint32 label_num = 15; | |||
| repeated OpDef op = 20; | |||
| TargetType target_type = 23; | |||
| map<string, AttrDef> attr = 30; | |||
| }; | |||
| // operator define | |||
| message OpDef { | |||
| string name = 1; | |||
| string type = 2; | |||
| uint32 id = 3; | |||
| uint32 stream_id = 4; | |||
| repeated string input_name = 5; | |||
| repeated string src_name = 8; | |||
| repeated int32 src_index = 9; | |||
| repeated int64 input = 10; | |||
| repeated int64 output = 11; | |||
| repeated TensorDescriptor input_desc = 12; | |||
| repeated TensorDescriptor output_desc = 13; | |||
| repeated WeightDef weights = 14; | |||
| repeated string dst_name = 15; | |||
| repeated int32 dst_index = 16; | |||
| repeated int64 workspace = 20; | |||
| repeated uint32 workspace_bytes = 21; | |||
| repeated string weight_name = 22; | |||
| repeated bool is_input_const = 23; | |||
| map<string, AttrDef> attr = 30; | |||
| QuantizeFactorParams quantize_factor = 31; | |||
| oneof op_params { | |||
| // start at 100 here | |||
| SendOpParams sender_param = 100; | |||
| RecvOpParams receiver_param = 200; | |||
| ConvolutionOpParams convolution_param = 300; | |||
| PoolingOpParams pooling_param = 400; | |||
| EltwiseOpParams eltwise_param = 500; | |||
| BatchNormOpParams batchnorm_param = 600; | |||
| ScaleOpParams scale_param = 700; | |||
| FullConnectionOpParams full_connection_param = 800; | |||
| SoftmaxOpParams softmax_param = 900; | |||
| ActivationOpParams activation_param = 1000; | |||
| ReshapeOpParams reshape_param = 1100; | |||
| } | |||
| }; | |||
| message SendOpParams { | |||
| uint32 event_id = 1; | |||
| }; | |||
| message RecvOpParams { | |||
| uint32 event_id = 1; | |||
| }; | |||
| enum QuantizeScaleType | |||
| { | |||
| VECTOR_SCALE = 0; | |||
| SCALAR_SCALE = 1; | |||
| } | |||
| enum QuantizeScaleMode | |||
| { | |||
| NORMAL_MODE = 0; | |||
| SQRT_MODE = 1; | |||
| } | |||
| enum QuantizeAlgorithm | |||
| { | |||
| NON_OFFSET_ALGO = 0; | |||
| HALF_OFFSET_ALGO = 1; | |||
| ALL_OFFSET_ALGO = 2; | |||
| } | |||
| message QuantizeFactor | |||
| { | |||
| QuantizeScaleMode scale_mode = 1; | |||
| bytes scale_value = 2; | |||
| int64 scale_offset = 3; | |||
| bytes offset_data_value = 4; | |||
| int64 offset_data_offset = 5; | |||
| bytes offset_weight_value = 6; | |||
| int64 offset_weight_offset = 7; | |||
| bytes offset_pad_value = 8; | |||
| int64 offset_pad_offset = 9; | |||
| }; | |||
| message QuantizeCalcFactor | |||
| { | |||
| bytes offsetw = 1; | |||
| int64 offsetw_offset = 2; | |||
| bytes offsetd = 3; | |||
| int64 offsetd_offset = 4; | |||
| bytes scalereq = 5; | |||
| int64 scaledreq_offset = 6; | |||
| bytes offsetdnext = 7; | |||
| int64 offsetdnext_offset = 8; | |||
| } | |||
| message QuantizeFactorParams | |||
| { | |||
| QuantizeAlgorithm quantize_algo = 1; | |||
| QuantizeScaleType scale_type = 2; | |||
| QuantizeFactor quantize_param = 3; | |||
| QuantizeFactor dequantize_param = 4; | |||
| QuantizeFactor requantize_param = 5; | |||
| QuantizeCalcFactor quantizecalc_param = 6; | |||
| }; | |||
| message ConvolutionOpParams { | |||
| int32 mode = 1; | |||
| int32 algo = 2; | |||
| int32 pad_mode = 3; | |||
| uint32 group = 4; | |||
| uint32 num_output = 5; | |||
| repeated uint32 pad = 10; | |||
| repeated uint32 stride = 11; | |||
| repeated uint32 dilation = 12; | |||
| repeated uint32 kernel = 13; | |||
| float alpha = 20; | |||
| float beta = 21; | |||
| WeightDef filter = 40; | |||
| WeightDef bias = 41; | |||
| bool relu_flag = 62; | |||
| repeated uint32 adj = 70; | |||
| repeated uint32 target_shape = 71; | |||
| repeated uint32 before_pad = 72; | |||
| }; | |||
| message PoolingOpParams { | |||
| int32 mode = 1; | |||
| int32 nan_opt = 2; | |||
| int32 pad_mode = 3; | |||
| bool global_pooling = 4; | |||
| repeated uint32 window = 10; | |||
| repeated uint32 pad = 11; | |||
| repeated uint32 stride = 12; | |||
| bool ceil_mode = 13; | |||
| int32 data_mode = 14; | |||
| float alpha = 20; | |||
| float beta = 21; | |||
| repeated uint32 before_pad = 22; | |||
| }; | |||
| message EltwiseOpParams { | |||
| int32 mode = 1; | |||
| repeated float coeff = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| repeated WeightDef weight = 5; | |||
| bool relu_flag = 6; | |||
| }; | |||
| message ActivationOpParams { | |||
| int32 mode = 1; | |||
| float coef = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| }; | |||
| message BatchNormOpParams { | |||
| int32 mode = 1; | |||
| float alpha = 2; | |||
| float beta = 3; | |||
| double epsilon = 4;//optinal,[default = 1e-5] | |||
| bool use_global_stats = 5; //optinal,by default true,testing mode | |||
| float moving_average_fraction = 6; //optinal,[default = .999]; | |||
| WeightDef estimated_mean = 7; | |||
| WeightDef estimated_variance = 8; | |||
| WeightDef scale = 9; | |||
| WeightDef bias = 10; | |||
| }; | |||
| message ScaleOpParams { | |||
| WeightDef scale = 1; | |||
| WeightDef bias = 2; | |||
| }; | |||
| message ReshapeOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| ShapeDef shape = 3; | |||
| int32 axis = 4; | |||
| int32 num_axes = 5; | |||
| int32 format = 6; | |||
| }; | |||
| message SoftmaxOpParams { | |||
| int32 algo = 1; | |||
| int32 mode = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| }; | |||
| message FullConnectionOpParams { | |||
| WeightDef filter = 1; | |||
| WeightDef bias = 2; | |||
| uint32 num_output = 3; | |||
| bool relu_flag = 12; | |||
| }; | |||
| message FlattenOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 start_axis = 3; | |||
| int32 end_axis = 4; | |||
| } | |||
| message AddLimitedOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 axis = 3; | |||
| bool broadcast = 4; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message MulLimitedOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 axis = 3; | |||
| bool broadcast = 4; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message AddOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message MulOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message SubOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message BiasAddOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| WeightDef bias = 10; | |||
| }; | |||
| message MatMulOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| bool transposeX = 3; | |||
| bool transposeW = 4; | |||
| WeightDef filter = 10; | |||
| WeightDef bias = 12; | |||
| }; | |||
| message RsqrtOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| }; | |||
| message WeightDef { | |||
| int32 format = 1; | |||
| int32 data_type = 2; | |||
| ShapeDef shape = 3; | |||
| bytes data = 4; | |||
| int64 data_offset = 5; | |||
| uint32 cmps_size = 6; | |||
| bytes cmps_tab = 7; | |||
| int64 cmps_tab_offset = 10; | |||
| CompressInfo cmps_info = 8; | |||
| AllOffsetQuantizeInfo alloffset_quantize_info = 11; | |||
| } | |||
| message ShapeDef { | |||
| repeated int64 dim = 1; | |||
| } | |||
| enum DeviceType { | |||
| NPU = 0; // In default, we will use NPU. | |||
| CPU = 1; // CPU | |||
| } | |||
| message AllOffsetQuantizeInfo { | |||
| float scale = 1; | |||
| int32 offset = 2; | |||
| } | |||
| message TensorDescriptor { | |||
| int32 format = 1; | |||
| int32 data_type = 2; | |||
| repeated int64 dim = 3; | |||
| uint32 size = 4; | |||
| bool reuse_input = 5; | |||
| bool output_tensor = 7; | |||
| DeviceType device_type = 8; | |||
| bool input_tensor = 9; | |||
| uint32 real_dim_cnt = 10; | |||
| uint32 reuse_input_index = 11; | |||
| AllOffsetQuantizeInfo alloffset_quantize_info = 12; | |||
| } | |||
| message CompressInfo { | |||
| int32 blockRow = 1; // block row | |||
| int32 blockCol = 2; // block col | |||
| int32 fractalK = 3; // fractal K | |||
| int32 fractalN = 4; // fractal N | |||
| int32 lastFractalK = 5; // K of last fractal | |||
| int32 lastFractalN = 6; // N of last fractal | |||
| int32 cubeSize = 7; // cube's length | |||
| int32 loadDir = 8; // data load directtiono 0:col load 1:row load | |||
| } | |||
| message AttrDef { | |||
| message ListValue { | |||
| repeated string s = 2; // "list(string)" | |||
| repeated int64 i = 3 [packed = true]; // "list(int)" | |||
| repeated float f = 4 [packed = true]; // "list(float)" | |||
| repeated bool b = 5 [packed = true]; // "list(bool)" | |||
| repeated uint32 u = 6 [packed = true]; // "list(uint)" | |||
| repeated bytes bt = 7; | |||
| } | |||
| oneof value { | |||
| string s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| uint32 u = 6; // "uint32" | |||
| bytes bt = 7; | |||
| ListValue list = 1; // any "list(...)" | |||
| NamedAttrs func = 10; | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NamedAttrs { | |||
| string name = 1; | |||
| map<string, AttrDef> attr = 2; | |||
| } | |||
| @@ -1,179 +0,0 @@ | |||
| /* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * Apache License for more details at | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| */ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| message ModelTaskDef { | |||
| string version = 1; | |||
| map<string, string> attr = 9; // Extended field | |||
| repeated TaskDef task = 10; | |||
| uint64 memory_size = 11; | |||
| uint32 stream_num = 12; | |||
| uint32 event_num = 13; | |||
| uint64 weight_size = 14; | |||
| repeated bytes op = 15; // input/output opdef in bytes | |||
| uint64 base_addr = 16; // base addr | |||
| uint64 weight_addr = 17; // weight addr | |||
| uint32 batch_num = 18; | |||
| } | |||
| message TaskDef { | |||
| uint32 id = 1; | |||
| uint32 type = 2; | |||
| uint32 stream_id = 10; | |||
| uint32 event_id = 11; | |||
| KernelDef kernel = 20; | |||
| KernelExDef kernel_ex = 21; | |||
| KernelHcclDef kernel_hccl = 25; | |||
| EventExDef event_ex = 26; | |||
| LogTimeStampDef log_timestamp = 28; | |||
| uint32 label_id = 30; | |||
| MemcpyAsyncDef memcpy_async = 31; | |||
| StreamSwitchDef stream_switch = 32; | |||
| StreamActiveDef stream_active = 33; | |||
| bytes private_def = 34; | |||
| uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future | |||
| StreamSwitchNDef stream_switch_n = 36; | |||
| LabelSetDef label_set = 37; | |||
| LabelGotoExDef label_goto_ex = 38; | |||
| LabelSwitchByIndexDef label_switch_by_index = 39; | |||
| KernelDefWithHandle kernel_with_handle = 40; | |||
| } | |||
| message KernelDef { | |||
| KernelContext context = 1; | |||
| string stub_func = 10; | |||
| uint32 block_dim = 11; | |||
| uint32 args_size = 12; | |||
| bytes args = 13; | |||
| bytes sm_desc = 14; | |||
| bytes flowtable = 15; | |||
| string so_name = 16; | |||
| string kernel_name = 17; | |||
| bytes kernel_ext_info = 18; | |||
| uint32 kernel_ext_info_size = 19; | |||
| } | |||
| message KernelDefWithHandle { | |||
| KernelContext context = 1; | |||
| uint64 handle = 10; | |||
| string dev_func = 11; | |||
| uint32 block_dim = 12; | |||
| uint32 args_size = 13; | |||
| bytes args = 14; | |||
| bytes sm_desc = 15; | |||
| string original_kernel_key = 16; | |||
| string node_info = 17; | |||
| } | |||
| message KernelContext { | |||
| uint32 kernel_type = 1; | |||
| uint32 op_id = 2; // OP type in CCE | |||
| uint32 kernel_func_id = 3; | |||
| uint32 op_index = 4; // TE/Custom operator | |||
| bool is_flowtable = 5; // Identify whether args is a flowtable structure | |||
| bytes args_offset = 6; // args offset information | |||
| uint32 args_count = 7; // args count | |||
| repeated uint32 origin_op_index = 8; | |||
| } | |||
| message KernelExDef { | |||
| uint32 flags = 1; | |||
| uint32 op_index = 4; | |||
| uint32 args_size = 12; | |||
| bytes args = 13; | |||
| bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput | |||
| uint32 task_info_size = 15; | |||
| bytes kernel_ext_info = 16; | |||
| uint32 kernel_ext_info_size = 17; | |||
| } | |||
| message KernelHcclDef { | |||
| uint32 op_index = 8; | |||
| string hccl_type = 9; | |||
| } | |||
| message EventExDef { | |||
| uint32 op_index = 1; | |||
| uint32 event_type = 2; | |||
| } | |||
| message LogTimeStampDef { | |||
| uint64 logid = 1; | |||
| bool notify = 2; | |||
| uint32 flat = 3; | |||
| } | |||
| message MemcpyAsyncDef { | |||
| uint64 dst = 1; | |||
| uint64 dst_max = 2; | |||
| uint64 src = 3; | |||
| uint64 count = 4; | |||
| uint32 kind = 5; | |||
| uint32 op_index = 6; | |||
| } | |||
| message StreamSwitchDef { | |||
| uint32 op_index = 1; | |||
| uint32 true_stream_id = 2; | |||
| int64 value = 3; | |||
| uint64 value_ptr = 4; | |||
| uint32 data_type = 5; | |||
| } | |||
| message StreamActiveDef { | |||
| uint32 op_index = 1; | |||
| uint32 active_stream_id = 2; | |||
| } | |||
| message StreamSwitchNDef { | |||
| uint32 op_index = 1; | |||
| uint32 size = 2; | |||
| repeated int64 target_value = 3; | |||
| repeated uint32 true_stream_id = 4; | |||
| uint32 element_size = 5; | |||
| uint32 data_type = 6; | |||
| } | |||
| message LabelSetDef { | |||
| uint32 op_index = 1; | |||
| uint32 label_id = 2; | |||
| uint32 model_id = 3; | |||
| } | |||
| message LabelGotoExDef { | |||
| uint32 op_index = 1; | |||
| uint32 label_id = 2; | |||
| uint32 model_id = 3; | |||
| } | |||
| message LabelSwitchByIndexDef { | |||
| uint32 op_index = 1; | |||
| uint32 label_max = 2; | |||
| } | |||
| @@ -1,193 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package ge.proto; | |||
| enum DataType | |||
| { | |||
| DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set. | |||
| DT_FLOAT = 1; // float type | |||
| DT_FLOAT16 = 2; // fp16 type | |||
| DT_INT8 = 3; // int8 type | |||
| DT_UINT8 = 4; // uint8 type | |||
| DT_INT16 = 5; // int16 type | |||
| DT_UINT16 = 6; // uint16 type | |||
| DT_INT32 = 7; // | |||
| DT_INT64 = 8; // int64 type | |||
| DT_UINT32 = 9; // unsigned int32 | |||
| DT_UINT64 = 10; // unsigned int64 | |||
| DT_BOOL = 11; // bool type | |||
| DT_DOUBLE = 12; // double type | |||
| DT_STRING = 13; // string type | |||
| DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */ | |||
| DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */ | |||
| DT_COMPLEX64 = 16; // complex64 type | |||
| DT_COMPLEX128 = 17; // complex128 type | |||
| DT_QINT8 = 18; // qint8 type | |||
| DT_QINT16 = 19; // qint16 type | |||
| DT_QINT32 = 20; // qint32 type | |||
| DT_QUINT8 = 21; // quint8 type | |||
| DT_QUINT16 = 22; // quint16 type | |||
| DT_RESOURCE = 23; // resource type | |||
| DT_STRING_REF = 24; // string_ref type | |||
| DT_DUAL = 25; /**< dual output type */ | |||
| DT_VARIANT = 26; // variant type | |||
| DT_BF16 = 27; // bf16 type | |||
| DT_INT4 = 28; // int4 type | |||
| } | |||
| message AttrDef | |||
| { | |||
| message ListValue | |||
| { | |||
| enum ListValueType{ | |||
| VT_LIST_NONE = 0; | |||
| VT_LIST_STRING = 1; | |||
| VT_LIST_INT = 2; | |||
| VT_LIST_FLOAT = 3; | |||
| VT_LIST_BOOL = 4; | |||
| VT_LIST_BYTES = 5; | |||
| VT_LIST_TENSOR_DESC = 6; | |||
| VT_LIST_TENSOR = 7; | |||
| VT_LIST_GRAPH = 8; | |||
| VT_LIST_NAMED_ATTRS = 9; | |||
| VT_LIST_DATA_TYPE = 10; | |||
| } | |||
| repeated bytes s = 2; // "list(string)" | |||
| repeated int64 i = 3; // "list(int)" | |||
| repeated float f = 4; // "list(float)" | |||
| repeated bool b = 5; // "list(bool)" | |||
| repeated bytes bt = 7; | |||
| repeated TensorDescriptor td = 8; | |||
| repeated TensorDef t = 9; | |||
| repeated GraphDef g = 10; | |||
| repeated NamedAttrs na = 11; | |||
| repeated int64 dt = 12; // list ge::DataType | |||
| ListValueType val_type = 20; | |||
| } | |||
| message ListListInt{ | |||
| message ListInt{ | |||
| repeated int64 list_i = 1; // list int | |||
| } | |||
| repeated ListInt list_list_i = 1; // list list int | |||
| } | |||
| oneof value | |||
| { | |||
| bytes s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| bytes bt = 7; | |||
| ListValue list = 1; // any "list(...)" | |||
| NamedAttrs func = 10; // Used to support attr nesting | |||
| TensorDescriptor td = 11; // GeTensorDesc type | |||
| TensorDef t = 12; // GeTensor type | |||
| GraphDef g = 13; // Graph type | |||
| ListListInt list_list_int = 14; // List List Int type | |||
| int64 dt = 15; // ge::DataType | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NamedAttrs | |||
| { | |||
| string name = 1; | |||
| map<string, AttrDef> attr = 2; | |||
| } | |||
| // Shape / dimension description, using row-major order | |||
| message ShapeDef | |||
| { | |||
| repeated int64 dim = 1; // Size of each dimension | |||
| } | |||
| // Multidimensional data description | |||
| message TensorDescriptor | |||
| { | |||
| string name = 1; // Optional parameter, tensor name | |||
| DataType dtype = 2; // tensor datatype | |||
| ShapeDef shape = 3; // Shape / dimension | |||
| string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND" | |||
| bool has_out_attr = 9; | |||
| int64 size = 10; | |||
| int64 weight_size = 11; | |||
| bool reuse_input = 12; | |||
| bool output_tensor = 13; | |||
| string device_type = 14; | |||
| bool input_tensor =15; | |||
| int64 real_dim_cnt = 16; | |||
| int64 reuse_input_index = 17; | |||
| int64 data_offset = 18; | |||
| int64 cmps_size = 19; | |||
| string cmps_tab = 20; | |||
| int64 cmps_tab_offset = 21; | |||
| map<string, AttrDef> attr = 5; // Set of extra parameter fields | |||
| } | |||
| // GeTensor definition | |||
| message TensorDef | |||
| { | |||
| TensorDescriptor desc = 1; // Tensor description | |||
| bytes data = 2; // Tensor data | |||
| } | |||
| // Operator description | |||
| message OpDef | |||
| { | |||
| string name = 1; // name | |||
| string type = 2; // type | |||
| repeated string input = 5; // input original op name + outgoing index. op_name:index | |||
| map<string, AttrDef> attr = 10; // Set of operator parameter fields | |||
| bool has_out_attr = 20; | |||
| int64 id = 21; | |||
| int64 stream_id =22; | |||
| repeated string input_name = 23; | |||
| repeated string src_name = 24; | |||
| repeated int64 src_index = 25; | |||
| repeated string dst_name = 26; | |||
| repeated int64 dst_index = 27; | |||
| repeated int64 input_i = 28; | |||
| repeated int64 output_i = 29; | |||
| repeated int64 workspace = 30; | |||
| repeated int64 workspace_bytes = 31; | |||
| repeated bool is_input_const = 32; | |||
| repeated TensorDescriptor input_desc = 33; | |||
| repeated TensorDescriptor output_desc = 34; | |||
| repeated string subgraph_name = 35; | |||
| } | |||
| // Graph definition | |||
| message GraphDef | |||
| { | |||
| string name = 1; // name | |||
| repeated string input = 4; // Graph input | |||
| repeated string output = 5; // Graph output | |||
| repeated OpDef op = 6; // List of operators | |||
| map<string, AttrDef> attr = 11; // Extended field | |||
| } | |||
| // model definition | |||
| message ModelDef | |||
| { | |||
| string name = 1; // name | |||
| uint32 version = 2; // IR Proto verion | |||
| string custom_version = 3; // User model version number, passed in by user | |||
| repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef | |||
| map<string, AttrDef> attr = 11; // Extended field | |||
| } | |||
| @@ -1,140 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| message InsertNewOps { | |||
| repeated AippOpParams aipp_op = 1; | |||
| repeated MultiShapeOpParams multi_shape_op = 2; | |||
| } | |||
| message AippOpParams { | |||
| enum InputFormat { | |||
| UNDEFINED = 0; | |||
| YUV420SP_U8 = 1; | |||
| XRGB8888_U8 = 2; | |||
| RGB888_U8 = 3; | |||
| YUV400_U8 = 4; | |||
| NC1HWC0DI_FP16 = 5; | |||
| NC1HWC0DI_S8 = 6; | |||
| ARGB8888_U8 = 7; | |||
| YUYV_U8 = 8; | |||
| YUV422SP_U8 = 9; | |||
| AYUV444_U8 = 10; | |||
| RAW10 = 11; | |||
| RAW12 = 12; | |||
| RAW16 = 13; | |||
| RAW24 = 14; | |||
| RGB16 = 15; | |||
| RGB20 = 16; | |||
| RGB24 = 17; | |||
| RGB8_IR = 18; | |||
| RGB16_IR = 19; | |||
| RGB24_IR = 20; | |||
| } | |||
| enum AippMode { | |||
| undefined = 0; | |||
| static = 1; | |||
| dynamic = 2; | |||
| } | |||
| // AIPP模式,区分静态AIPP和动态AIPP | |||
| AippMode aipp_mode = 1; | |||
| // related_input_rank参数为必填,类型为整型,配置范围>=0, <=输入Data算子的个数,默认值为0。 | |||
| // 标识对模型的第几个输入做AIPP处理,例如模型有两个输入,需要对第2个输入做AIPP,则配置related_input_rank为1。 | |||
| uint32 related_input_rank = 2; | |||
| // related_input_name is optional and the top name of data node which inserts aipp | |||
| string related_input_name = 6; | |||
| // input_edge_idx参数为可选,类型为整型,配置范围为>=0。 | |||
| // 配置该参数的作用,在于对Data算子不同的输出做不同的AIPP处理,如果该参数没有配置,默认对related_input_rank指定的模型输入的所有输出边做AIPP。 | |||
| // 配置值 <= Data算子输出边的个数。 | |||
| repeated uint32 input_edge_idx = 3; | |||
| // [Begin] 动态AIPP参数,配置静态AIPP时无效 | |||
| uint32 max_src_image_size = 4; | |||
| // 是否支持旋转。默认不支持,开启支持旋转时,会有额外的空间和性能损失 | |||
| bool support_rotation = 5; | |||
| // [End] 动态AIPP参数 | |||
| // [Begin] 静态AIPP参数,配置动态AIPP时无效 | |||
| InputFormat input_format = 51; | |||
| bool csc_switch = 52; | |||
| float cpadding_value = 53; | |||
| bool rbuv_swap_switch = 54; | |||
| bool ax_swap_switch = 55; | |||
| bool single_line_mode = 56; | |||
| int32 src_image_size_w = 57; | |||
| int32 src_image_size_h = 58; | |||
| bool crop = 59; | |||
| int32 load_start_pos_w = 60; | |||
| int32 load_start_pos_h = 61; | |||
| int32 crop_size_w = 62; | |||
| int32 crop_size_h = 63; | |||
| bool resize = 64; | |||
| int32 resize_output_w = 65; | |||
| int32 resize_output_h = 66; | |||
| bool padding = 67; | |||
| int32 left_padding_size = 68; | |||
| int32 right_padding_size = 69; | |||
| int32 top_padding_size = 70; | |||
| int32 bottom_padding_size = 71; | |||
| float padding_value = 72; | |||
| int32 mean_chn_0 = 10; | |||
| int32 mean_chn_1 = 11; | |||
| int32 mean_chn_2 = 12; | |||
| int32 mean_chn_3 = 19; | |||
| float min_chn_0 = 13; | |||
| float min_chn_1 = 14; | |||
| float min_chn_2 = 15; | |||
| float min_chn_3 = 20; | |||
| repeated float var_reci_chn_0 = 16; | |||
| repeated float var_reci_chn_1 = 17; | |||
| repeated float var_reci_chn_2 = 18; | |||
| repeated float var_reci_chn_3 = 21; | |||
| repeated int32 matrix_r0c0 = 30; | |||
| repeated int32 matrix_r0c1 = 31; | |||
| repeated int32 matrix_r0c2 = 32; | |||
| repeated int32 matrix_r1c0 = 33; | |||
| repeated int32 matrix_r1c1 = 34; | |||
| repeated int32 matrix_r1c2 = 35; | |||
| repeated int32 matrix_r2c0 = 36; | |||
| repeated int32 matrix_r2c1 = 37; | |||
| repeated int32 matrix_r2c2 = 38; | |||
| repeated int32 output_bias_0 = 39; | |||
| repeated int32 output_bias_1 = 40; | |||
| repeated int32 output_bias_2 = 41; | |||
| repeated int32 input_bias_0 = 42; | |||
| repeated int32 input_bias_1 = 43; | |||
| repeated int32 input_bias_2 = 44; | |||
| // [End] 静态AIPP参数 | |||
| // The n number that is used for raw/rgbir data into f16 transformation. | |||
| // The transformation equation is x/(2^n). If set to 0, no transform is performed. | |||
| uint32 raw_rgbir_to_f16_n = 45; | |||
| } | |||
| message MultiShapeOpParams { | |||
| enum MultiShapeMode { | |||
| batch = 0; //动态batch | |||
| resolution = 1; //动态分辨率,扩展用 | |||
| } | |||
| MultiShapeMode mode = 1; //算子模式 | |||
| uint32 related_input_rank = 2; //新增算子插入到哪个输入 | |||
| repeated uint32 batch_list = 11; //batch_list值,batch_list的个数是2到8之间 | |||
| } | |||
| @@ -1,396 +0,0 @@ | |||
| /* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * Apache License for more details at | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| */ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| enum TargetType | |||
| { | |||
| MINI = 0; | |||
| TINY = 1; | |||
| LITE = 2; | |||
| } | |||
| // offline model | |||
| message ModelDef { | |||
| string name = 1; | |||
| uint32 version = 2; | |||
| uint64 memory_size = 10; | |||
| uint32 stream_num = 11; | |||
| uint32 event_num = 12; | |||
| uint64 weight_size = 13; | |||
| uint32 label_num = 15; | |||
| repeated OpDef op = 20; | |||
| TargetType target_type = 23; | |||
| map<string, AttrDef> attr = 30; | |||
| }; | |||
| // operator define | |||
| message OpDef { | |||
| string name = 1; | |||
| string type = 2; | |||
| uint32 id = 3; | |||
| uint32 stream_id = 4; | |||
| repeated string input_name = 5; | |||
| repeated string src_name = 8; | |||
| repeated int32 src_index = 9; | |||
| repeated int64 input = 10; | |||
| repeated int64 output = 11; | |||
| repeated TensorDescriptor input_desc = 12; | |||
| repeated TensorDescriptor output_desc = 13; | |||
| repeated WeightDef weights = 14; | |||
| repeated string dst_name = 15; | |||
| repeated int32 dst_index = 16; | |||
| repeated int64 workspace = 20; | |||
| repeated uint32 workspace_bytes = 21; | |||
| repeated string weight_name = 22; | |||
| repeated bool is_input_const = 23; | |||
| map<string, AttrDef> attr = 30; | |||
| QuantizeFactorParams quantize_factor = 31; | |||
| oneof op_params { | |||
| // start at 100 here | |||
| SendOpParams sender_param = 100; | |||
| RecvOpParams receiver_param = 200; | |||
| ConvolutionOpParams convolution_param = 300; | |||
| PoolingOpParams pooling_param = 400; | |||
| EltwiseOpParams eltwise_param = 500; | |||
| BatchNormOpParams batchnorm_param = 600; | |||
| ScaleOpParams scale_param = 700; | |||
| FullConnectionOpParams full_connection_param = 800; | |||
| SoftmaxOpParams softmax_param = 900; | |||
| ActivationOpParams activation_param = 1000; | |||
| ReshapeOpParams reshape_param = 1100; | |||
| } | |||
| }; | |||
| message SendOpParams { | |||
| uint32 event_id = 1; | |||
| }; | |||
| message RecvOpParams { | |||
| uint32 event_id = 1; | |||
| }; | |||
| enum QuantizeScaleType | |||
| { | |||
| VECTOR_SCALE = 0; | |||
| SCALAR_SCALE = 1; | |||
| } | |||
| enum QuantizeScaleMode | |||
| { | |||
| NORMAL_MODE = 0; | |||
| SQRT_MODE = 1; | |||
| } | |||
| enum QuantizeAlgorithm | |||
| { | |||
| NON_OFFSET_ALGO = 0; | |||
| HALF_OFFSET_ALGO = 1; | |||
| ALL_OFFSET_ALGO = 2; | |||
| } | |||
| message QuantizeFactor | |||
| { | |||
| QuantizeScaleMode scale_mode = 1; | |||
| bytes scale_value = 2; | |||
| int64 scale_offset = 3; | |||
| bytes offset_data_value = 4; | |||
| int64 offset_data_offset = 5; | |||
| bytes offset_weight_value = 6; | |||
| int64 offset_weight_offset = 7; | |||
| bytes offset_pad_value = 8; | |||
| int64 offset_pad_offset = 9; | |||
| }; | |||
| message QuantizeCalcFactor | |||
| { | |||
| bytes offsetw = 1; | |||
| int64 offsetw_offset = 2; | |||
| bytes offsetd = 3; | |||
| int64 offsetd_offset = 4; | |||
| bytes scalereq = 5; | |||
| int64 scaledreq_offset = 6; | |||
| bytes offsetdnext = 7; | |||
| int64 offsetdnext_offset = 8; | |||
| } | |||
| message QuantizeFactorParams | |||
| { | |||
| QuantizeAlgorithm quantize_algo = 1; | |||
| QuantizeScaleType scale_type = 2; | |||
| QuantizeFactor quantize_param = 3; | |||
| QuantizeFactor dequantize_param = 4; | |||
| QuantizeFactor requantize_param = 5; | |||
| QuantizeCalcFactor quantizecalc_param = 6; | |||
| }; | |||
| message ConvolutionOpParams { | |||
| int32 mode = 1; | |||
| int32 algo = 2; | |||
| int32 pad_mode = 3; | |||
| uint32 group = 4; | |||
| uint32 num_output = 5; | |||
| repeated uint32 pad = 10; | |||
| repeated uint32 stride = 11; | |||
| repeated uint32 dilation = 12; | |||
| repeated uint32 kernel = 13; | |||
| float alpha = 20; | |||
| float beta = 21; | |||
| WeightDef filter = 40; | |||
| WeightDef bias = 41; | |||
| bool relu_flag = 62; | |||
| repeated uint32 adj = 70; | |||
| repeated uint32 target_shape = 71; | |||
| repeated uint32 before_pad = 72; | |||
| }; | |||
| message PoolingOpParams { | |||
| int32 mode = 1; | |||
| int32 nan_opt = 2; | |||
| int32 pad_mode = 3; | |||
| bool global_pooling = 4; | |||
| repeated uint32 window = 10; | |||
| repeated uint32 pad = 11; | |||
| repeated uint32 stride = 12; | |||
| bool ceil_mode = 13; | |||
| int32 data_mode = 14; | |||
| float alpha = 20; | |||
| float beta = 21; | |||
| repeated uint32 before_pad = 22; | |||
| }; | |||
| message EltwiseOpParams { | |||
| int32 mode = 1; | |||
| repeated float coeff = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| repeated WeightDef weight = 5; | |||
| bool relu_flag = 6; | |||
| }; | |||
| message ActivationOpParams { | |||
| int32 mode = 1; | |||
| float coef = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| }; | |||
| message BatchNormOpParams { | |||
| int32 mode = 1; | |||
| float alpha = 2; | |||
| float beta = 3; | |||
| double epsilon = 4;//optinal,[default = 1e-5] | |||
| bool use_global_stats = 5; //optinal,by default true,testing mode | |||
| float moving_average_fraction = 6; //optinal,[default = .999]; | |||
| WeightDef estimated_mean = 7; | |||
| WeightDef estimated_variance = 8; | |||
| WeightDef scale = 9; | |||
| WeightDef bias = 10; | |||
| }; | |||
| message ScaleOpParams { | |||
| WeightDef scale = 1; | |||
| WeightDef bias = 2; | |||
| }; | |||
| message ReshapeOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| ShapeDef shape = 3; | |||
| int32 axis = 4; | |||
| int32 num_axes = 5; | |||
| int32 format = 6; | |||
| }; | |||
| message SoftmaxOpParams { | |||
| int32 algo = 1; | |||
| int32 mode = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| }; | |||
| message FullConnectionOpParams { | |||
| WeightDef filter = 1; | |||
| WeightDef bias = 2; | |||
| uint32 num_output = 3; | |||
| bool relu_flag = 12; | |||
| }; | |||
| message FlattenOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 start_axis = 3; | |||
| int32 end_axis = 4; | |||
| } | |||
| message AddLimitedOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 axis = 3; | |||
| bool broadcast = 4; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message MulLimitedOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 axis = 3; | |||
| bool broadcast = 4; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message AddOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message MulOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message SubOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message BiasAddOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| WeightDef bias = 10; | |||
| }; | |||
| message MatMulOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| bool transposeX = 3; | |||
| bool transposeW = 4; | |||
| WeightDef filter = 10; | |||
| WeightDef bias = 12; | |||
| }; | |||
| message RsqrtOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| }; | |||
| message WeightDef { | |||
| int32 format = 1; | |||
| int32 data_type = 2; | |||
| ShapeDef shape = 3; | |||
| bytes data = 4; | |||
| int64 data_offset = 5; | |||
| uint32 cmps_size = 6; | |||
| bytes cmps_tab = 7; | |||
| int64 cmps_tab_offset = 10; | |||
| CompressInfo cmps_info = 8; | |||
| AllOffsetQuantizeInfo alloffset_quantize_info = 11; | |||
| } | |||
| message ShapeDef { | |||
| repeated int64 dim = 1; | |||
| } | |||
| enum DeviceType { | |||
| NPU = 0; // In default, we will use NPU. | |||
| CPU = 1; // CPU | |||
| } | |||
| message AllOffsetQuantizeInfo { | |||
| float scale = 1; | |||
| int32 offset = 2; | |||
| } | |||
| message TensorDescriptor { | |||
| int32 format = 1; | |||
| int32 data_type = 2; | |||
| repeated int64 dim = 3; | |||
| uint32 size = 4; | |||
| bool reuse_input = 5; | |||
| bool output_tensor = 7; | |||
| DeviceType device_type = 8; | |||
| bool input_tensor = 9; | |||
| uint32 real_dim_cnt = 10; | |||
| uint32 reuse_input_index = 11; | |||
| AllOffsetQuantizeInfo alloffset_quantize_info = 12; | |||
| } | |||
| message CompressInfo { | |||
| int32 blockRow = 1; // block row | |||
| int32 blockCol = 2; // block col | |||
| int32 fractalK = 3; // fractal K | |||
| int32 fractalN = 4; // fractal N | |||
| int32 lastFractalK = 5; // K of last fractal | |||
| int32 lastFractalN = 6; // N of last fractal | |||
| int32 cubeSize = 7; // cube's length | |||
| int32 loadDir = 8; // data load directtiono 0:col load 1:row load | |||
| } | |||
| message AttrDef { | |||
| message ListValue { | |||
| repeated string s = 2; // "list(string)" | |||
| repeated int64 i = 3 [packed = true]; // "list(int)" | |||
| repeated float f = 4 [packed = true]; // "list(float)" | |||
| repeated bool b = 5 [packed = true]; // "list(bool)" | |||
| repeated uint32 u = 6 [packed = true]; // "list(uint)" | |||
| repeated bytes bt = 7; | |||
| } | |||
| oneof value { | |||
| string s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| uint32 u = 6; // "uint32" | |||
| bytes bt = 7; | |||
| ListValue list = 1; // any "list(...)" | |||
| NamedAttrs func = 10; | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NamedAttrs { | |||
| string name = 1; | |||
| map<string, AttrDef> attr = 2; | |||
| } | |||
| @@ -1,62 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "AttrValueProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "tensor.proto"; | |||
| import "tensor_shape.proto"; | |||
| import "types.proto"; | |||
| // Protocol buffer representing the value for an attr used to configure an Op. | |||
| // Comment indicates the corresponding attr type. Only the field matching the | |||
| // attr type may be filled. | |||
| message AttrValue { | |||
| // LINT.IfChange | |||
| message ListValue { | |||
| repeated bytes s = 2; // "list(string)" | |||
| repeated int64 i = 3 [packed = true]; // "list(int)" | |||
| repeated float f = 4 [packed = true]; // "list(float)" | |||
| repeated bool b = 5 [packed = true]; // "list(bool)" | |||
| repeated DataType type = 6 [packed = true]; // "list(type)" | |||
| repeated TensorShapeProto shape = 7; // "list(shape)" | |||
| repeated TensorProto tensor = 8; // "list(tensor)" | |||
| repeated NameAttrList func = 9; // "list(attr)" | |||
| } | |||
| // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.cc) | |||
| oneof value { | |||
| bytes s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| DataType type = 6; // "type" | |||
| TensorShapeProto shape = 7; // "shape" | |||
| TensorProto tensor = 8; // "tensor" | |||
| ListValue list = 1; // any "list(...)" | |||
| // "func" represents a function. func.name is a function's name or | |||
| // a primitive op's name. func.attr.first is the name of an attr | |||
| // defined for that function. func.attr.second is the value for | |||
| // that attr in the instantiation. | |||
| NameAttrList func = 10; | |||
| // This is a placeholder only used in nodes defined inside a | |||
| // function. It indicates the attr value will be supplied when | |||
| // the function is instantiated. For example, let us suppose a | |||
| // node "N" in function "FN". "N" has an attr "A" with value | |||
| // placeholder = "foo". When FN is instantiated with attr "foo" | |||
| // set to "bar", the instantiated node N's attr A will have been | |||
| // given the value "bar". | |||
| string placeholder = 9; | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NameAttrList { | |||
| string name = 1; | |||
| map<string, AttrValue> attr = 2; | |||
| } | |||
| @@ -1,100 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "FunctionProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| import "node_def.proto"; | |||
| import "op_def.proto"; | |||
| // A library is a set of named functions. | |||
| message FunctionDefLibrary { | |||
| repeated FunctionDef function = 1; | |||
| repeated GradientDef gradient = 2; | |||
| } | |||
| // A function can be instantiated when the runtime can bind every attr | |||
| // with a value. When a GraphDef has a call to a function, it must | |||
| // have binding for every attr defined in the signature. | |||
| // * device spec, etc. | |||
| message FunctionDef { | |||
| // The definition of the function's name, arguments, return values, | |||
| // attrs etc. | |||
| OpDef signature = 1; | |||
| // Attributes specific to this function definition. | |||
| map<string, AttrValue> attr = 5; | |||
| // NOTE: field id 2 deleted on Jan 11, 2017, GraphDef version 21. | |||
| reserved 2; | |||
| // In both of the following fields, there is the need to specify an | |||
| // output that is used as either the input to another node (in | |||
| // `node_def`) or as a return value of the function (in `ret`). | |||
| // Unlike the NodeDefs in GraphDef, we need to be able to specify a | |||
| // list in some cases (instead of just single outputs). Also, we | |||
| // need to be able to deal with lists of unknown length (so the | |||
| // output index may not be known at function definition time). So | |||
| // we use the following format instead: | |||
| // * "fun_in" where "fun_in" is the name of a function input arg in | |||
| // the `signature` field above. This represents that input, whether | |||
| // it is a single tensor or a list. | |||
| // * "fun_in:0" gives the first element of a function input arg (a | |||
| // non-list input is considered a list of length 1 for these | |||
| // purposes). | |||
| // * "node:out" where "node" is the name of a node in `node_def` and | |||
| // "out" is the name one of its op's output arguments (the name | |||
| // comes from the OpDef of the node's op). This represents that | |||
| // node's output, whether it is a single tensor or a list. | |||
| // Note: We enforce that an op's output arguments are never | |||
| // renamed in the backwards-compatibility test. | |||
| // * "node:out:0" gives the first element of a node output arg (a | |||
| // non-list output is considered a list of length 1 for these | |||
| // purposes). | |||
| // | |||
| // NOT CURRENTLY SUPPORTED (but may be in the future): | |||
| // * "node:out:-1" gives last element in a node output list | |||
| // * "node:out:1:" gives a list with all but the first element in a | |||
| // node output list | |||
| // * "node:out::-1" gives a list with all but the last element in a | |||
| // node output list | |||
| // The body of the function. Unlike the NodeDefs in a GraphDef, attrs | |||
| // may have values of type `placeholder` and the `input` field uses | |||
| // the "output" format above. | |||
| // By convention, "op" in node_def is resolved by consulting with a | |||
| // user-defined library first. If not resolved, "func" is assumed to | |||
| // be a builtin op. | |||
| repeated NodeDef node_def = 3; | |||
| // A mapping from the output arg names from `signature` to the | |||
| // outputs from `node_def` that should be returned by the function. | |||
| map<string, string> ret = 4; | |||
| } | |||
| // GradientDef defines the gradient function of a function defined in | |||
| // a function library. | |||
| // | |||
| // A gradient function g (specified by gradient_func) for a function f | |||
| // (specified by function_name) must follow the following: | |||
| // | |||
| // The function 'f' must be a numerical function which takes N inputs | |||
| // and produces M outputs. Its gradient function 'g', which is a | |||
| // function taking N + M inputs and produces N outputs. | |||
| // | |||
| // I.e. if we have | |||
| // (y1, y2, ..., y_M) = f(x1, x2, ..., x_N), | |||
| // then, g is | |||
| // (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N, | |||
| // dL/dy1, dL/dy2, ..., dL/dy_M), | |||
| // where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the | |||
| // loss function). dL/dx_i is the partial derivative of L with respect | |||
| // to x_i. | |||
| message GradientDef { | |||
| string function_name = 1; // The function name. | |||
| string gradient_func = 2; // The gradient function's name. | |||
| } | |||
| @@ -1,56 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "GraphProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "node_def.proto"; | |||
| import "function.proto"; | |||
| import "versions.proto"; | |||
| // Represents the graph of operations | |||
| message GraphDef { | |||
| repeated NodeDef node = 1; | |||
| // Compatibility versions of the graph. See core/public/version.h for version | |||
| // history. The GraphDef version is distinct from the TensorFlow version, and | |||
| // each release of TensorFlow will support a range of GraphDef versions. | |||
| VersionDef versions = 4; | |||
| // Deprecated single version field; use versions above instead. Since all | |||
| // GraphDef changes before "versions" was introduced were forward | |||
| // compatible, this field is entirely ignored. | |||
| int32 version = 3 [deprecated = true]; | |||
| // EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET. | |||
| // | |||
| // "library" provides user-defined functions. | |||
| // | |||
| // Naming: | |||
| // * library.function.name are in a flat namespace. | |||
| // NOTE: We may need to change it to be hierarchical to support | |||
| // different orgs. E.g., | |||
| // { "/google/nn", { ... }}, | |||
| // { "/google/vision", { ... }} | |||
| // { "/org_foo/module_bar", { ... }} | |||
| // map<string, FunctionDefLib> named_lib; | |||
| // * If node[i].op is the name of one function in "library", | |||
| // node[i] is deemed as a function call. Otherwise, node[i].op | |||
| // must be a primitive operation supported by the runtime. | |||
| // | |||
| // | |||
| // Function call semantics: | |||
| // | |||
| // * The callee may start execution as soon as some of its inputs | |||
| // are ready. The caller may want to use Tuple() mechanism to | |||
| // ensure all inputs are ready in the same time. | |||
| // | |||
| // * The consumer of return values may start executing as soon as | |||
| // the return values the consumer depends on are ready. The | |||
| // consumer may want to use Tuple() mechanism to ensure the | |||
| // consumer does not start until all return values of the callee | |||
| // function are ready. | |||
| FunctionDefLibrary library = 2; | |||
| }; | |||
| @@ -1,14 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| import "graph.proto"; | |||
| message GeGraphDef { | |||
| string name = 1; | |||
| GraphDef graph = 2; | |||
| } | |||
| message GraphDefLibrary { | |||
| repeated GeGraphDef graph_def = 1; | |||
| }; | |||
| @@ -1,63 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "NodeProto"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| message NodeDef { | |||
| // The name given to this operator. Used for naming inputs, | |||
| // logging, visualization, etc. Unique within a single GraphDef. | |||
| // Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_./]*". | |||
| string name = 1; | |||
| // The operation name. There may be custom parameters in attrs. | |||
| // Op names starting with an underscore are reserved for internal use. | |||
| string op = 2; | |||
| // Each input is "node:src_output" with "node" being a string name and | |||
| // "src_output" indicating which output tensor to use from "node". If | |||
| // "src_output" is 0 the ":0" suffix can be omitted. Regular inputs | |||
| // may optionally be followed by control inputs that have the format | |||
| // "^node". | |||
| repeated string input = 3; | |||
| // A (possibly partial) specification for the device on which this | |||
| // node should be placed. | |||
| // The expected syntax for this string is as follows: | |||
| // | |||
| // DEVICE_SPEC ::= PARTIAL_SPEC | |||
| // | |||
| // PARTIAL_SPEC ::= ("/" CONSTRAINT) * | |||
| // CONSTRAINT ::= ("job:" JOB_NAME) | |||
| // | ("replica:" [1-9][0-9]*) | |||
| // | ("task:" [1-9][0-9]*) | |||
| // | ("device:" [A-Za-z]* ":" ([1-9][0-9]* | "*") ) | |||
| // | |||
| // Valid values for this string include: | |||
| // * "/job:worker/replica:0/task:1/device:GPU:3" (full specification) | |||
| // * "/job:worker/device:GPU:3" (partial specification) | |||
| // * "" (no specification) | |||
| // | |||
| // If the constraints do not resolve to a single device (or if this | |||
| // field is empty or not present), the runtime will attempt to | |||
| // choose a device automatically. | |||
| string device = 4; | |||
| // Operation-specific graph-construction-time configuration. | |||
| // Note that this should include all attrs defined in the | |||
| // corresponding OpDef, including those with a value matching | |||
| // the default -- this allows the default to change and makes | |||
| // NodeDefs easier to interpret on their own. However, if | |||
| // an attr with a default is not specified in this list, the | |||
| // default will be used. | |||
| // The "names" (keys) must match the regexp "[a-z][a-z0-9_]+" (and | |||
| // one of the names from the corresponding OpDef's attr field). | |||
| // The values must have a type matching the corresponding OpDef | |||
| // attr's type field. | |||
| // Add some examples here showing best practices. | |||
| map<string, AttrValue> attr = 5; | |||
| }; | |||
| @@ -1,164 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "OpDefProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| import "types.proto"; | |||
| // Defines an operation. A NodeDef in a GraphDef specifies an Op by | |||
| // using the "op" field which should match the name of a OpDef. | |||
| // LINT.IfChange | |||
| message OpDef { | |||
| // Op names starting with an underscore are reserved for internal use. | |||
| // Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9_]*". | |||
| string name = 1; | |||
| // For describing inputs and outputs. | |||
| message ArgDef { | |||
| // Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*". | |||
| string name = 1; | |||
| // Human readable description. | |||
| string description = 2; | |||
| // Describes the type of one or more tensors that are accepted/produced | |||
| // by this input/output arg. The only legal combinations are: | |||
| // * For a single tensor: either the "type" field is set or the | |||
| // "type_attr" field is set to the name of an attr with type "type". | |||
| // * For a sequence of tensors with the same type: the "number_attr" | |||
| // field will be set to the name of an attr with type "int", and | |||
| // either the "type" or "type_attr" field will be set as for | |||
| // single tensors. | |||
| // * For a sequence of tensors, the "type_list_attr" field will be set | |||
| // to the name of an attr with type "list(type)". | |||
| DataType type = 3; | |||
| string type_attr = 4; // if specified, attr must have type "type" | |||
| string number_attr = 5; // if specified, attr must have type "int" | |||
| // If specified, attr must have type "list(type)", and none of | |||
| // type, type_attr, and number_attr may be specified. | |||
| string type_list_attr = 6; | |||
| // For inputs: if true, the inputs are required to be refs. | |||
| // By default, inputs can be either refs or non-refs. | |||
| // For outputs: if true, outputs are refs, otherwise they are not. | |||
| bool is_ref = 16; | |||
| }; | |||
| // Description of the input(s). | |||
| repeated ArgDef input_arg = 2; | |||
| // Description of the output(s). | |||
| repeated ArgDef output_arg = 3; | |||
| // Description of the graph-construction-time configuration of this | |||
| // Op. That is to say, this describes the attr fields that will | |||
| // be specified in the NodeDef. | |||
| message AttrDef { | |||
| // A descriptive name for the argument. May be used, e.g. by the | |||
| // Python client, as a keyword argument name, and so should match | |||
| // the regexp "[a-z][a-z0-9_]+". | |||
| string name = 1; | |||
| // One of the type names from attr_value.proto ("string", "list(string)", | |||
| // "int", etc.). | |||
| string type = 2; | |||
| // A reasonable default for this attribute if the user does not supply | |||
| // a value. If not specified, the user must supply a value. | |||
| AttrValue default_value = 3; | |||
| // Human-readable description. | |||
| string description = 4; | |||
| // --- Constraints --- | |||
| // These constraints are only in effect if specified. Default is no | |||
| // constraints. | |||
| // For type == "int", this is a minimum value. For "list(___)" | |||
| // types, this is the minimum length. | |||
| bool has_minimum = 5; | |||
| int64 minimum = 6; | |||
| // The set of allowed values. Has type that is the "list" version | |||
| // of the "type" field above (uses the "list" field of AttrValue). | |||
| // If type == "type" or "list(type)" above, then the "type" field | |||
| // of "allowed_values.list" has the set of allowed DataTypes. | |||
| // If type == "string" or "list(string)", then the "s" field of | |||
| // "allowed_values.list" has the set of allowed strings. | |||
| AttrValue allowed_values = 7; | |||
| } | |||
| repeated AttrDef attr = 4; | |||
| // Optional deprecation based on GraphDef versions. | |||
| OpDeprecation deprecation = 8; | |||
| // One-line human-readable description of what the Op does. | |||
| string summary = 5; | |||
| // Additional, longer human-readable description of what the Op does. | |||
| string description = 6; | |||
| // ------------------------------------------------------------------------- | |||
| // Which optimizations this operation can participate in. | |||
| // True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs) | |||
| bool is_commutative = 18; | |||
| // If is_aggregate is true, then this operation accepts N >= 2 | |||
| // inputs and produces 1 output all of the same type. Should be | |||
| // associative and commutative, and produce output with the same | |||
| // shape as the input. The optimizer may replace an aggregate op | |||
| // taking input from multiple devices with a tree of aggregate ops | |||
| // that aggregate locally within each device (and possibly within | |||
| // groups of nearby devices) before communicating. | |||
| bool is_aggregate = 16; // for things like add | |||
| // Other optimizations go here, like | |||
| // can_alias_input, rewrite_when_output_unused, partitioning_strategy, etc. | |||
| // ------------------------------------------------------------------------- | |||
| // Optimization constraints. | |||
| // Ops are marked as stateful if their behavior depends on some state beyond | |||
| // their input tensors (e.g. variable reading op) or if they have | |||
| // a side-effect (e.g. printing or asserting ops). Equivalently, stateless ops | |||
| // must always produce the same output for the same input and have | |||
| // no side-effects. | |||
| // | |||
| // By default Ops may be moved between devices. Stateful ops should | |||
| // either not be moved, or should only be moved if that state can also | |||
| // be moved (e.g. via some sort of save / restore). | |||
| // Stateful ops are guaranteed to never be optimized away by Common | |||
| // Subexpression Elimination (CSE). | |||
| bool is_stateful = 17; // for things like variables, queue | |||
| // ------------------------------------------------------------------------- | |||
| // Non-standard options. | |||
| // By default, all inputs to an Op must be initialized Tensors. Ops | |||
| // that may initialize tensors for the first time should set this | |||
| // field to true, to allow the Op to take an uninitialized Tensor as | |||
| // input. | |||
| bool allows_uninitialized_input = 19; // for Assign, etc. | |||
| }; | |||
| // LINT.ThenChange( | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/op_def_util.cc) | |||
| // Information about version-dependent deprecation of an op | |||
| message OpDeprecation { | |||
| // First GraphDef version at which the op is disallowed. | |||
| int32 version = 1; | |||
| // Explanation of why it was deprecated and what to use instead. | |||
| string explanation = 2; | |||
| }; | |||
| // A collection of OpDefs | |||
| message OpList { | |||
| repeated OpDef op = 1; | |||
| }; | |||
| @@ -1,29 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "ResourceHandle"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // Protocol buffer representing a handle to a tensorflow resource. Handles are | |||
| // not valid across executions, but can be serialized back and forth from within | |||
| // a single run. | |||
| message ResourceHandleProto { | |||
| // Unique name for the device containing the resource. | |||
| string device = 1; | |||
| // Container in which this resource is placed. | |||
| string container = 2; | |||
| // Unique name of this resource. | |||
| string name = 3; | |||
| // Hash code for the type of the resource. Is only valid in the same device | |||
| // and in the same execution. | |||
| uint64 hash_code = 4; | |||
| // For debug-only, the name of the type pointed to by this handle, if | |||
| // available. | |||
| string maybe_type_name = 5; | |||
| }; | |||
| @@ -1,94 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TensorProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "resource_handle.proto"; | |||
| import "tensor_shape.proto"; | |||
| import "types.proto"; | |||
| // Protocol buffer representing a tensor. | |||
| message TensorProto { | |||
| DataType dtype = 1; | |||
| // Shape of the tensor. | |||
| TensorShapeProto tensor_shape = 2; | |||
| // Only one of the representations below is set, one of "tensor_contents" and | |||
| // the "xxx_val" attributes. We are not using oneof because as oneofs cannot | |||
| // contain repeated fields it would require another extra set of messages. | |||
| // Version number. | |||
| // | |||
| // In version 0, if the "repeated xxx" representations contain only one | |||
| // element, that element is repeated to fill the shape. This makes it easy | |||
| // to represent a constant Tensor with a single value. | |||
| int32 version_number = 3; | |||
| // Serialized raw tensor content from either Tensor::AsProtoTensorContent or | |||
| // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation | |||
| // can be used for all tensor types. The purpose of this representation is to | |||
| // reduce serialization overhead during RPC call by avoiding serialization of | |||
| // many repeated small items. | |||
| bytes tensor_content = 4; | |||
| // Type specific representations that make it easy to create tensor protos in | |||
| // all languages. Only the representation corresponding to "dtype" can | |||
| // be set. The values hold the flattened representation of the tensor in | |||
| // row major order. | |||
| // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll | |||
| // have some pointless zero padding for each value here. | |||
| repeated int32 half_val = 13 [packed = true]; | |||
| // DT_FLOAT. | |||
| repeated float float_val = 5 [packed = true]; | |||
| // DT_DOUBLE. | |||
| repeated double double_val = 6 [packed = true]; | |||
| // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. | |||
| repeated int32 int_val = 7 [packed = true]; | |||
| // DT_STRING | |||
| repeated bytes string_val = 8; | |||
| // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real | |||
| // and imaginary parts of i-th single precision complex. | |||
| repeated float scomplex_val = 9 [packed = true]; | |||
| // DT_INT64 | |||
| repeated int64 int64_val = 10 [packed = true]; | |||
| // DT_BOOL | |||
| repeated bool bool_val = 11 [packed = true]; | |||
| // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real | |||
| // and imaginary parts of i-th double precision complex. | |||
| repeated double dcomplex_val = 12 [packed = true]; | |||
| // DT_RESOURCE | |||
| repeated ResourceHandleProto resource_handle_val = 14; | |||
| // DT_VARIANT | |||
| repeated VariantTensorDataProto variant_val = 15; | |||
| // DT_UINT32 | |||
| repeated uint32 uint32_val = 16 [packed = true]; | |||
| // DT_UINT64 | |||
| repeated uint64 uint64_val = 17 [packed = true]; | |||
| }; | |||
| // Protocol buffer representing the serialization format of DT_VARIANT tensors. | |||
| message VariantTensorDataProto { | |||
| // Name of the type of objects being serialized. | |||
| string type_name = 1; | |||
| // Portions of the object that are not Tensors. | |||
| bytes metadata = 2; | |||
| // Tensors contained within objects being serialized. | |||
| repeated TensorProto tensors = 3; | |||
| } | |||
| @@ -1,45 +0,0 @@ | |||
| // Protocol buffer representing the shape of tensors. | |||
| syntax = "proto3"; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TensorShapeProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| package domi.tensorflow; | |||
| // Dimensions of a tensor. | |||
| message TensorShapeProto { | |||
| // One dimension of the tensor. | |||
| message Dim { | |||
| // Size of the tensor in that dimension. | |||
| // This value must be >= -1, but values of -1 are reserved for "unknown" | |||
| // shapes (values of -1 mean "unknown" dimension). Certain wrappers | |||
| // that work with TensorShapeProto may fail at runtime when deserializing | |||
| // a TensorShapeProto containing a dim value of -1. | |||
| int64 size = 1; | |||
| // Optional name of the tensor dimension. | |||
| string name = 2; | |||
| }; | |||
| // Dimensions of the tensor, such as {"input", 30}, {"output", 40} | |||
| // for a 30 x 40 2D tensor. If an entry has size -1, this | |||
| // corresponds to a dimension of unknown size. The names are | |||
| // optional. | |||
| // | |||
| // The order of entries in "dim" matters: It indicates the layout of the | |||
| // values in the tensor in-memory representation. | |||
| // | |||
| // The first entry in "dim" is the outermost dimension used to layout the | |||
| // values, the last entry is the innermost dimension. This matches the | |||
| // in-memory layout of RowMajor Eigen tensors. | |||
| // | |||
| // If "dim.size()" > 0, "unknown_rank" must be false. | |||
| repeated Dim dim = 2; | |||
| // If true, the number of dimensions in the shape is unknown. | |||
| // | |||
| // If true, "dim.size()" must be 0. | |||
| bool unknown_rank = 3; | |||
| }; | |||
| @@ -1,74 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TypesProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // LINT.IfChange | |||
| enum DataType { | |||
| // Not a legal value for DataType. Used to indicate a DataType field | |||
| // has not been set. | |||
| DT_INVALID = 0; | |||
| // Data types that all computation devices are expected to be | |||
| // capable to support. | |||
| DT_FLOAT = 1; | |||
| DT_DOUBLE = 2; | |||
| DT_INT32 = 3; | |||
| DT_UINT8 = 4; | |||
| DT_INT16 = 5; | |||
| DT_INT8 = 6; | |||
| DT_STRING = 7; | |||
| DT_COMPLEX64 = 8; // Single-precision complex | |||
| DT_INT64 = 9; | |||
| DT_BOOL = 10; | |||
| DT_QINT8 = 11; // Quantized int8 | |||
| DT_QUINT8 = 12; // Quantized uint8 | |||
| DT_QINT32 = 13; // Quantized int32 | |||
| DT_BFLOAT16 = 14; // Float32 truncated to 16 bits. Only for cast ops. | |||
| DT_QINT16 = 15; // Quantized int16 | |||
| DT_QUINT16 = 16; // Quantized uint16 | |||
| DT_UINT16 = 17; | |||
| DT_COMPLEX128 = 18; // Double-precision complex | |||
| DT_HALF = 19; | |||
| DT_RESOURCE = 20; | |||
| DT_VARIANT = 21; // Arbitrary C++ data types | |||
| DT_UINT32 = 22; | |||
| DT_UINT64 = 23; | |||
| // Do not use! These are only for parameters. Every enum above | |||
| // should have a corresponding value below (verified by types_test). | |||
| DT_FLOAT_REF = 101; | |||
| DT_DOUBLE_REF = 102; | |||
| DT_INT32_REF = 103; | |||
| DT_UINT8_REF = 104; | |||
| DT_INT16_REF = 105; | |||
| DT_INT8_REF = 106; | |||
| DT_STRING_REF = 107; | |||
| DT_COMPLEX64_REF = 108; | |||
| DT_INT64_REF = 109; | |||
| DT_BOOL_REF = 110; | |||
| DT_QINT8_REF = 111; | |||
| DT_QUINT8_REF = 112; | |||
| DT_QINT32_REF = 113; | |||
| DT_BFLOAT16_REF = 114; | |||
| DT_QINT16_REF = 115; | |||
| DT_QUINT16_REF = 116; | |||
| DT_UINT16_REF = 117; | |||
| DT_COMPLEX128_REF = 118; | |||
| DT_HALF_REF = 119; | |||
| DT_RESOURCE_REF = 120; | |||
| DT_VARIANT_REF = 121; | |||
| DT_UINT32_REF = 122; | |||
| DT_UINT64_REF = 123; | |||
| } | |||
| // LINT.ThenChange( | |||
| // https://www.tensorflow.org/code/tensorflow/c/c_api.h, | |||
| // https://www.tensorflow.org/code/tensorflow/go/tensor.go, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/types.h, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/types.cc, | |||
| // https://www.tensorflow.org/code/tensorflow/python/framework/dtypes.py, | |||
| // https://www.tensorflow.org/code/tensorflow/python/framework/function.py) | |||
| @@ -1,31 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "VersionsProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // Version information for a piece of serialized data | |||
| // | |||
| // There are different types of versions for each type of data | |||
| // (GraphDef, etc.), but they all have the same common shape | |||
| // described here. | |||
| // | |||
| // Each consumer has "consumer" and "min_producer" versions (specified | |||
| // elsewhere). A consumer is allowed to consume this data if | |||
| // | |||
| // producer >= min_producer | |||
| // consumer >= min_consumer | |||
| // consumer not in bad_consumers | |||
| // | |||
| message VersionDef { | |||
| // The version of the code that produced this data. | |||
| int32 producer = 1; | |||
| // Any consumer below this version is not allowed to consume this data. | |||
| int32 min_consumer = 2; | |||
| // Specific consumer versions which are disallowed (e.g. due to bugs). | |||
| repeated int32 bad_consumers = 3; | |||
| }; | |||
| @@ -1,62 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "AttrValueProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "tensor.proto"; | |||
| import "tensor_shape.proto"; | |||
| import "types.proto"; | |||
| // Protocol buffer representing the value for an attr used to configure an Op. | |||
| // Comment indicates the corresponding attr type. Only the field matching the | |||
| // attr type may be filled. | |||
| message AttrValue { | |||
| // LINT.IfChange | |||
| message ListValue { | |||
| repeated bytes s = 2; // "list(string)" | |||
| repeated int64 i = 3 [packed = true]; // "list(int)" | |||
| repeated float f = 4 [packed = true]; // "list(float)" | |||
| repeated bool b = 5 [packed = true]; // "list(bool)" | |||
| repeated DataType type = 6 [packed = true]; // "list(type)" | |||
| repeated TensorShapeProto shape = 7; // "list(shape)" | |||
| repeated TensorProto tensor = 8; // "list(tensor)" | |||
| repeated NameAttrList func = 9; // "list(attr)" | |||
| } | |||
| // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.cc) | |||
| oneof value { | |||
| bytes s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| DataType type = 6; // "type" | |||
| TensorShapeProto shape = 7; // "shape" | |||
| TensorProto tensor = 8; // "tensor" | |||
| ListValue list = 1; // any "list(...)" | |||
| // "func" represents a function. func.name is a function's name or | |||
| // a primitive op's name. func.attr.first is the name of an attr | |||
| // defined for that function. func.attr.second is the value for | |||
| // that attr in the instantiation. | |||
| NameAttrList func = 10; | |||
| // This is a placeholder only used in nodes defined inside a | |||
| // function. It indicates the attr value will be supplied when | |||
| // the function is instantiated. For example, let us suppose a | |||
| // node "N" in function "FN". "N" has an attr "A" with value | |||
| // placeholder = "foo". When FN is instantiated with attr "foo" | |||
| // set to "bar", the instantiated node N's attr A will have been | |||
| // given the value "bar". | |||
| string placeholder = 9; | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NameAttrList { | |||
| string name = 1; | |||
| map<string, AttrValue> attr = 2; | |||
| } | |||
| @@ -1,100 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "FunctionProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| import "node_def.proto"; | |||
| import "op_def.proto"; | |||
| // A library is a set of named functions. | |||
| message FunctionDefLibrary { | |||
| repeated FunctionDef function = 1; | |||
| repeated GradientDef gradient = 2; | |||
| } | |||
| // A function can be instantiated when the runtime can bind every attr | |||
| // with a value. When a GraphDef has a call to a function, it must | |||
| // have binding for every attr defined in the signature. | |||
| // * device spec, etc. | |||
| message FunctionDef { | |||
| // The definition of the function's name, arguments, return values, | |||
| // attrs etc. | |||
| OpDef signature = 1; | |||
| // Attributes specific to this function definition. | |||
| map<string, AttrValue> attr = 5; | |||
| // NOTE: field id 2 deleted on Jan 11, 2017, GraphDef version 21. | |||
| reserved 2; | |||
| // In both of the following fields, there is the need to specify an | |||
| // output that is used as either the input to another node (in | |||
| // `node_def`) or as a return value of the function (in `ret`). | |||
| // Unlike the NodeDefs in GraphDef, we need to be able to specify a | |||
| // list in some cases (instead of just single outputs). Also, we | |||
| // need to be able to deal with lists of unknown length (so the | |||
| // output index may not be known at function definition time). So | |||
| // we use the following format instead: | |||
| // * "fun_in" where "fun_in" is the name of a function input arg in | |||
| // the `signature` field above. This represents that input, whether | |||
| // it is a single tensor or a list. | |||
| // * "fun_in:0" gives the first element of a function input arg (a | |||
| // non-list input is considered a list of length 1 for these | |||
| // purposes). | |||
| // * "node:out" where "node" is the name of a node in `node_def` and | |||
| // "out" is the name one of its op's output arguments (the name | |||
| // comes from the OpDef of the node's op). This represents that | |||
| // node's output, whether it is a single tensor or a list. | |||
| // Note: We enforce that an op's output arguments are never | |||
| // renamed in the backwards-compatibility test. | |||
| // * "node:out:0" gives the first element of a node output arg (a | |||
| // non-list output is considered a list of length 1 for these | |||
| // purposes). | |||
| // | |||
| // NOT CURRENTLY SUPPORTED (but may be in the future): | |||
| // * "node:out:-1" gives last element in a node output list | |||
| // * "node:out:1:" gives a list with all but the first element in a | |||
| // node output list | |||
| // * "node:out::-1" gives a list with all but the last element in a | |||
| // node output list | |||
| // The body of the function. Unlike the NodeDefs in a GraphDef, attrs | |||
| // may have values of type `placeholder` and the `input` field uses | |||
| // the "output" format above. | |||
| // By convention, "op" in node_def is resolved by consulting with a | |||
| // user-defined library first. If not resolved, "func" is assumed to | |||
| // be a builtin op. | |||
| repeated NodeDef node_def = 3; | |||
| // A mapping from the output arg names from `signature` to the | |||
| // outputs from `node_def` that should be returned by the function. | |||
| map<string, string> ret = 4; | |||
| } | |||
| // GradientDef defines the gradient function of a function defined in | |||
| // a function library. | |||
| // | |||
| // A gradient function g (specified by gradient_func) for a function f | |||
| // (specified by function_name) must follow the following: | |||
| // | |||
| // The function 'f' must be a numerical function which takes N inputs | |||
| // and produces M outputs. Its gradient function 'g', which is a | |||
| // function taking N + M inputs and produces N outputs. | |||
| // | |||
| // I.e. if we have | |||
| // (y1, y2, ..., y_M) = f(x1, x2, ..., x_N), | |||
| // then, g is | |||
| // (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N, | |||
| // dL/dy1, dL/dy2, ..., dL/dy_M), | |||
| // where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the | |||
| // loss function). dL/dx_i is the partial derivative of L with respect | |||
| // to x_i. | |||
| message GradientDef { | |||
| string function_name = 1; // The function name. | |||
| string gradient_func = 2; // The gradient function's name. | |||
| } | |||
| @@ -1,56 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "GraphProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "node_def.proto"; | |||
| import "function.proto"; | |||
| import "versions.proto"; | |||
| // Represents the graph of operations | |||
| message GraphDef { | |||
| repeated NodeDef node = 1; | |||
| // Compatibility versions of the graph. See core/public/version.h for version | |||
| // history. The GraphDef version is distinct from the TensorFlow version, and | |||
| // each release of TensorFlow will support a range of GraphDef versions. | |||
| VersionDef versions = 4; | |||
| // Deprecated single version field; use versions above instead. Since all | |||
| // GraphDef changes before "versions" was introduced were forward | |||
| // compatible, this field is entirely ignored. | |||
| int32 version = 3 [deprecated = true]; | |||
| // EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET. | |||
| // | |||
| // "library" provides user-defined functions. | |||
| // | |||
| // Naming: | |||
| // * library.function.name are in a flat namespace. | |||
| // NOTE: We may need to change it to be hierarchical to support | |||
| // different orgs. E.g., | |||
| // { "/google/nn", { ... }}, | |||
| // { "/google/vision", { ... }} | |||
| // { "/org_foo/module_bar", { ... }} | |||
| // map<string, FunctionDefLib> named_lib; | |||
| // * If node[i].op is the name of one function in "library", | |||
| // node[i] is deemed as a function call. Otherwise, node[i].op | |||
| // must be a primitive operation supported by the runtime. | |||
| // | |||
| // | |||
| // Function call semantics: | |||
| // | |||
| // * The callee may start execution as soon as some of its inputs | |||
| // are ready. The caller may want to use Tuple() mechanism to | |||
| // ensure all inputs are ready in the same time. | |||
| // | |||
| // * The consumer of return values may start executing as soon as | |||
| // the return values the consumer depends on are ready. The | |||
| // consumer may want to use Tuple() mechanism to ensure the | |||
| // consumer does not start until all return values of the callee | |||
| // function are ready. | |||
| FunctionDefLibrary library = 2; | |||
| }; | |||
| @@ -1,14 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| import "graph.proto"; | |||
| message GeGraphDef { | |||
| string name = 1; | |||
| GraphDef graph = 2; | |||
| } | |||
| message GraphDefLibrary { | |||
| repeated GeGraphDef graph_def = 1; | |||
| }; | |||
| @@ -1,63 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "NodeProto"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| message NodeDef { | |||
| // The name given to this operator. Used for naming inputs, | |||
| // logging, visualization, etc. Unique within a single GraphDef. | |||
| // Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_./]*". | |||
| string name = 1; | |||
| // The operation name. There may be custom parameters in attrs. | |||
| // Op names starting with an underscore are reserved for internal use. | |||
| string op = 2; | |||
| // Each input is "node:src_output" with "node" being a string name and | |||
| // "src_output" indicating which output tensor to use from "node". If | |||
| // "src_output" is 0 the ":0" suffix can be omitted. Regular inputs | |||
| // may optionally be followed by control inputs that have the format | |||
| // "^node". | |||
| repeated string input = 3; | |||
| // A (possibly partial) specification for the device on which this | |||
| // node should be placed. | |||
| // The expected syntax for this string is as follows: | |||
| // | |||
| // DEVICE_SPEC ::= PARTIAL_SPEC | |||
| // | |||
| // PARTIAL_SPEC ::= ("/" CONSTRAINT) * | |||
| // CONSTRAINT ::= ("job:" JOB_NAME) | |||
| // | ("replica:" [1-9][0-9]*) | |||
| // | ("task:" [1-9][0-9]*) | |||
| // | ("device:" [A-Za-z]* ":" ([1-9][0-9]* | "*") ) | |||
| // | |||
| // Valid values for this string include: | |||
| // * "/job:worker/replica:0/task:1/device:GPU:3" (full specification) | |||
| // * "/job:worker/device:GPU:3" (partial specification) | |||
| // * "" (no specification) | |||
| // | |||
| // If the constraints do not resolve to a single device (or if this | |||
| // field is empty or not present), the runtime will attempt to | |||
| // choose a device automatically. | |||
| string device = 4; | |||
| // Operation-specific graph-construction-time configuration. | |||
| // Note that this should include all attrs defined in the | |||
| // corresponding OpDef, including those with a value matching | |||
| // the default -- this allows the default to change and makes | |||
| // NodeDefs easier to interpret on their own. However, if | |||
| // an attr with a default is not specified in this list, the | |||
| // default will be used. | |||
| // The "names" (keys) must match the regexp "[a-z][a-z0-9_]+" (and | |||
| // one of the names from the corresponding OpDef's attr field). | |||
| // The values must have a type matching the corresponding OpDef | |||
| // attr's type field. | |||
| // Add some examples here showing best practices. | |||
| map<string, AttrValue> attr = 5; | |||
| }; | |||
| @@ -1,164 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "OpDefProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| import "types.proto"; | |||
| // Defines an operation. A NodeDef in a GraphDef specifies an Op by | |||
| // using the "op" field which should match the name of a OpDef. | |||
| // LINT.IfChange | |||
| message OpDef { | |||
| // Op names starting with an underscore are reserved for internal use. | |||
| // Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9_]*". | |||
| string name = 1; | |||
| // For describing inputs and outputs. | |||
| message ArgDef { | |||
| // Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*". | |||
| string name = 1; | |||
| // Human readable description. | |||
| string description = 2; | |||
| // Describes the type of one or more tensors that are accepted/produced | |||
| // by this input/output arg. The only legal combinations are: | |||
| // * For a single tensor: either the "type" field is set or the | |||
| // "type_attr" field is set to the name of an attr with type "type". | |||
| // * For a sequence of tensors with the same type: the "number_attr" | |||
| // field will be set to the name of an attr with type "int", and | |||
| // either the "type" or "type_attr" field will be set as for | |||
| // single tensors. | |||
| // * For a sequence of tensors, the "type_list_attr" field will be set | |||
| // to the name of an attr with type "list(type)". | |||
| DataType type = 3; | |||
| string type_attr = 4; // if specified, attr must have type "type" | |||
| string number_attr = 5; // if specified, attr must have type "int" | |||
| // If specified, attr must have type "list(type)", and none of | |||
| // type, type_attr, and number_attr may be specified. | |||
| string type_list_attr = 6; | |||
| // For inputs: if true, the inputs are required to be refs. | |||
| // By default, inputs can be either refs or non-refs. | |||
| // For outputs: if true, outputs are refs, otherwise they are not. | |||
| bool is_ref = 16; | |||
| }; | |||
| // Description of the input(s). | |||
| repeated ArgDef input_arg = 2; | |||
| // Description of the output(s). | |||
| repeated ArgDef output_arg = 3; | |||
| // Description of the graph-construction-time configuration of this | |||
| // Op. That is to say, this describes the attr fields that will | |||
| // be specified in the NodeDef. | |||
| message AttrDef { | |||
| // A descriptive name for the argument. May be used, e.g. by the | |||
| // Python client, as a keyword argument name, and so should match | |||
| // the regexp "[a-z][a-z0-9_]+". | |||
| string name = 1; | |||
| // One of the type names from attr_value.proto ("string", "list(string)", | |||
| // "int", etc.). | |||
| string type = 2; | |||
| // A reasonable default for this attribute if the user does not supply | |||
| // a value. If not specified, the user must supply a value. | |||
| AttrValue default_value = 3; | |||
| // Human-readable description. | |||
| string description = 4; | |||
| // --- Constraints --- | |||
| // These constraints are only in effect if specified. Default is no | |||
| // constraints. | |||
| // For type == "int", this is a minimum value. For "list(___)" | |||
| // types, this is the minimum length. | |||
| bool has_minimum = 5; | |||
| int64 minimum = 6; | |||
| // The set of allowed values. Has type that is the "list" version | |||
| // of the "type" field above (uses the "list" field of AttrValue). | |||
| // If type == "type" or "list(type)" above, then the "type" field | |||
| // of "allowed_values.list" has the set of allowed DataTypes. | |||
| // If type == "string" or "list(string)", then the "s" field of | |||
| // "allowed_values.list" has the set of allowed strings. | |||
| AttrValue allowed_values = 7; | |||
| } | |||
| repeated AttrDef attr = 4; | |||
| // Optional deprecation based on GraphDef versions. | |||
| OpDeprecation deprecation = 8; | |||
| // One-line human-readable description of what the Op does. | |||
| string summary = 5; | |||
| // Additional, longer human-readable description of what the Op does. | |||
| string description = 6; | |||
| // ------------------------------------------------------------------------- | |||
| // Which optimizations this operation can participate in. | |||
| // True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs) | |||
| bool is_commutative = 18; | |||
| // If is_aggregate is true, then this operation accepts N >= 2 | |||
| // inputs and produces 1 output all of the same type. Should be | |||
| // associative and commutative, and produce output with the same | |||
| // shape as the input. The optimizer may replace an aggregate op | |||
| // taking input from multiple devices with a tree of aggregate ops | |||
| // that aggregate locally within each device (and possibly within | |||
| // groups of nearby devices) before communicating. | |||
| bool is_aggregate = 16; // for things like add | |||
| // Other optimizations go here, like | |||
| // can_alias_input, rewrite_when_output_unused, partitioning_strategy, etc. | |||
| // ------------------------------------------------------------------------- | |||
| // Optimization constraints. | |||
| // Ops are marked as stateful if their behavior depends on some state beyond | |||
| // their input tensors (e.g. variable reading op) or if they have | |||
| // a side-effect (e.g. printing or asserting ops). Equivalently, stateless ops | |||
| // must always produce the same output for the same input and have | |||
| // no side-effects. | |||
| // | |||
| // By default Ops may be moved between devices. Stateful ops should | |||
| // either not be moved, or should only be moved if that state can also | |||
| // be moved (e.g. via some sort of save / restore). | |||
| // Stateful ops are guaranteed to never be optimized away by Common | |||
| // Subexpression Elimination (CSE). | |||
| bool is_stateful = 17; // for things like variables, queue | |||
| // ------------------------------------------------------------------------- | |||
| // Non-standard options. | |||
| // By default, all inputs to an Op must be initialized Tensors. Ops | |||
| // that may initialize tensors for the first time should set this | |||
| // field to true, to allow the Op to take an uninitialized Tensor as | |||
| // input. | |||
| bool allows_uninitialized_input = 19; // for Assign, etc. | |||
| }; | |||
| // LINT.ThenChange( | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/op_def_util.cc) | |||
| // Information about version-dependent deprecation of an op | |||
| message OpDeprecation { | |||
| // First GraphDef version at which the op is disallowed. | |||
| int32 version = 1; | |||
| // Explanation of why it was deprecated and what to use instead. | |||
| string explanation = 2; | |||
| }; | |||
| // A collection of OpDefs | |||
| message OpList { | |||
| repeated OpDef op = 1; | |||
| }; | |||
| @@ -1,29 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "ResourceHandle"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // Protocol buffer representing a handle to a tensorflow resource. Handles are | |||
| // not valid across executions, but can be serialized back and forth from within | |||
| // a single run. | |||
| message ResourceHandleProto { | |||
| // Unique name for the device containing the resource. | |||
| string device = 1; | |||
| // Container in which this resource is placed. | |||
| string container = 2; | |||
| // Unique name of this resource. | |||
| string name = 3; | |||
| // Hash code for the type of the resource. Is only valid in the same device | |||
| // and in the same execution. | |||
| uint64 hash_code = 4; | |||
| // For debug-only, the name of the type pointed to by this handle, if | |||
| // available. | |||
| string maybe_type_name = 5; | |||
| }; | |||
| @@ -1,94 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TensorProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "resource_handle.proto"; | |||
| import "tensor_shape.proto"; | |||
| import "types.proto"; | |||
| // Protocol buffer representing a tensor. | |||
| message TensorProto { | |||
| DataType dtype = 1; | |||
| // Shape of the tensor. | |||
| TensorShapeProto tensor_shape = 2; | |||
| // Only one of the representations below is set, one of "tensor_contents" and | |||
| // the "xxx_val" attributes. We are not using oneof because as oneofs cannot | |||
| // contain repeated fields it would require another extra set of messages. | |||
| // Version number. | |||
| // | |||
| // In version 0, if the "repeated xxx" representations contain only one | |||
| // element, that element is repeated to fill the shape. This makes it easy | |||
| // to represent a constant Tensor with a single value. | |||
| int32 version_number = 3; | |||
| // Serialized raw tensor content from either Tensor::AsProtoTensorContent or | |||
| // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation | |||
| // can be used for all tensor types. The purpose of this representation is to | |||
| // reduce serialization overhead during RPC call by avoiding serialization of | |||
| // many repeated small items. | |||
| bytes tensor_content = 4; | |||
| // Type specific representations that make it easy to create tensor protos in | |||
| // all languages. Only the representation corresponding to "dtype" can | |||
| // be set. The values hold the flattened representation of the tensor in | |||
| // row major order. | |||
| // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll | |||
| // have some pointless zero padding for each value here. | |||
| repeated int32 half_val = 13 [packed = true]; | |||
| // DT_FLOAT. | |||
| repeated float float_val = 5 [packed = true]; | |||
| // DT_DOUBLE. | |||
| repeated double double_val = 6 [packed = true]; | |||
| // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. | |||
| repeated int32 int_val = 7 [packed = true]; | |||
| // DT_STRING | |||
| repeated bytes string_val = 8; | |||
| // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real | |||
| // and imaginary parts of i-th single precision complex. | |||
| repeated float scomplex_val = 9 [packed = true]; | |||
| // DT_INT64 | |||
| repeated int64 int64_val = 10 [packed = true]; | |||
| // DT_BOOL | |||
| repeated bool bool_val = 11 [packed = true]; | |||
| // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real | |||
| // and imaginary parts of i-th double precision complex. | |||
| repeated double dcomplex_val = 12 [packed = true]; | |||
| // DT_RESOURCE | |||
| repeated ResourceHandleProto resource_handle_val = 14; | |||
| // DT_VARIANT | |||
| repeated VariantTensorDataProto variant_val = 15; | |||
| // DT_UINT32 | |||
| repeated uint32 uint32_val = 16 [packed = true]; | |||
| // DT_UINT64 | |||
| repeated uint64 uint64_val = 17 [packed = true]; | |||
| }; | |||
| // Protocol buffer representing the serialization format of DT_VARIANT tensors. | |||
| message VariantTensorDataProto { | |||
| // Name of the type of objects being serialized. | |||
| string type_name = 1; | |||
| // Portions of the object that are not Tensors. | |||
| bytes metadata = 2; | |||
| // Tensors contained within objects being serialized. | |||
| repeated TensorProto tensors = 3; | |||
| } | |||
| @@ -1,45 +0,0 @@ | |||
| // Protocol buffer representing the shape of tensors. | |||
| syntax = "proto3"; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TensorShapeProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| package domi.tensorflow; | |||
| // Dimensions of a tensor. | |||
| message TensorShapeProto { | |||
| // One dimension of the tensor. | |||
| message Dim { | |||
| // Size of the tensor in that dimension. | |||
| // This value must be >= -1, but values of -1 are reserved for "unknown" | |||
| // shapes (values of -1 mean "unknown" dimension). Certain wrappers | |||
| // that work with TensorShapeProto may fail at runtime when deserializing | |||
| // a TensorShapeProto containing a dim value of -1. | |||
| int64 size = 1; | |||
| // Optional name of the tensor dimension. | |||
| string name = 2; | |||
| }; | |||
| // Dimensions of the tensor, such as {"input", 30}, {"output", 40} | |||
| // for a 30 x 40 2D tensor. If an entry has size -1, this | |||
| // corresponds to a dimension of unknown size. The names are | |||
| // optional. | |||
| // | |||
| // The order of entries in "dim" matters: It indicates the layout of the | |||
| // values in the tensor in-memory representation. | |||
| // | |||
| // The first entry in "dim" is the outermost dimension used to layout the | |||
| // values, the last entry is the innermost dimension. This matches the | |||
| // in-memory layout of RowMajor Eigen tensors. | |||
| // | |||
| // If "dim.size()" > 0, "unknown_rank" must be false. | |||
| repeated Dim dim = 2; | |||
| // If true, the number of dimensions in the shape is unknown. | |||
| // | |||
| // If true, "dim.size()" must be 0. | |||
| bool unknown_rank = 3; | |||
| }; | |||
| @@ -1,74 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TypesProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // LINT.IfChange | |||
| enum DataType { | |||
| // Not a legal value for DataType. Used to indicate a DataType field | |||
| // has not been set. | |||
| DT_INVALID = 0; | |||
| // Data types that all computation devices are expected to be | |||
| // capable to support. | |||
| DT_FLOAT = 1; | |||
| DT_DOUBLE = 2; | |||
| DT_INT32 = 3; | |||
| DT_UINT8 = 4; | |||
| DT_INT16 = 5; | |||
| DT_INT8 = 6; | |||
| DT_STRING = 7; | |||
| DT_COMPLEX64 = 8; // Single-precision complex | |||
| DT_INT64 = 9; | |||
| DT_BOOL = 10; | |||
| DT_QINT8 = 11; // Quantized int8 | |||
| DT_QUINT8 = 12; // Quantized uint8 | |||
| DT_QINT32 = 13; // Quantized int32 | |||
| DT_BFLOAT16 = 14; // Float32 truncated to 16 bits. Only for cast ops. | |||
| DT_QINT16 = 15; // Quantized int16 | |||
| DT_QUINT16 = 16; // Quantized uint16 | |||
| DT_UINT16 = 17; | |||
| DT_COMPLEX128 = 18; // Double-precision complex | |||
| DT_HALF = 19; | |||
| DT_RESOURCE = 20; | |||
| DT_VARIANT = 21; // Arbitrary C++ data types | |||
| DT_UINT32 = 22; | |||
| DT_UINT64 = 23; | |||
| // Do not use! These are only for parameters. Every enum above | |||
| // should have a corresponding value below (verified by types_test). | |||
| DT_FLOAT_REF = 101; | |||
| DT_DOUBLE_REF = 102; | |||
| DT_INT32_REF = 103; | |||
| DT_UINT8_REF = 104; | |||
| DT_INT16_REF = 105; | |||
| DT_INT8_REF = 106; | |||
| DT_STRING_REF = 107; | |||
| DT_COMPLEX64_REF = 108; | |||
| DT_INT64_REF = 109; | |||
| DT_BOOL_REF = 110; | |||
| DT_QINT8_REF = 111; | |||
| DT_QUINT8_REF = 112; | |||
| DT_QINT32_REF = 113; | |||
| DT_BFLOAT16_REF = 114; | |||
| DT_QINT16_REF = 115; | |||
| DT_QUINT16_REF = 116; | |||
| DT_UINT16_REF = 117; | |||
| DT_COMPLEX128_REF = 118; | |||
| DT_HALF_REF = 119; | |||
| DT_RESOURCE_REF = 120; | |||
| DT_VARIANT_REF = 121; | |||
| DT_UINT32_REF = 122; | |||
| DT_UINT64_REF = 123; | |||
| } | |||
| // LINT.ThenChange( | |||
| // https://www.tensorflow.org/code/tensorflow/c/c_api.h, | |||
| // https://www.tensorflow.org/code/tensorflow/go/tensor.go, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/types.h, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/types.cc, | |||
| // https://www.tensorflow.org/code/tensorflow/python/framework/dtypes.py, | |||
| // https://www.tensorflow.org/code/tensorflow/python/framework/function.py) | |||
| @@ -1,31 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "VersionsProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // Version information for a piece of serialized data | |||
| // | |||
| // There are different types of versions for each type of data | |||
| // (GraphDef, etc.), but they all have the same common shape | |||
| // described here. | |||
| // | |||
| // Each consumer has "consumer" and "min_producer" versions (specified | |||
| // elsewhere). A consumer is allowed to consume this data if | |||
| // | |||
| // producer >= min_producer | |||
| // consumer >= min_consumer | |||
| // consumer not in bad_consumers | |||
| // | |||
| message VersionDef { | |||
| // The version of the code that produced this data. | |||
| int32 producer = 1; | |||
| // Any consumer below this version is not allowed to consume this data. | |||
| int32 min_consumer = 2; | |||
| // Specific consumer versions which are disallowed (e.g. due to bugs). | |||
| repeated int32 bad_consumers = 3; | |||
| }; | |||
| @@ -1,396 +0,0 @@ | |||
| /* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * Apache License for more details at | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| */ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| enum TargetType | |||
| { | |||
| MINI = 0; | |||
| TINY = 1; | |||
| LITE = 2; | |||
| } | |||
| // offline model | |||
| message ModelDef { | |||
| string name = 1; | |||
| uint32 version = 2; | |||
| uint64 memory_size = 10; | |||
| uint32 stream_num = 11; | |||
| uint32 event_num = 12; | |||
| uint64 weight_size = 13; | |||
| uint32 label_num = 15; | |||
| repeated OpDef op = 20; | |||
| TargetType target_type = 23; | |||
| map<string, AttrDef> attr = 30; | |||
| }; | |||
| // operator define | |||
| message OpDef { | |||
| string name = 1; | |||
| string type = 2; | |||
| uint32 id = 3; | |||
| uint32 stream_id = 4; | |||
| repeated string input_name = 5; | |||
| repeated string src_name = 8; | |||
| repeated int32 src_index = 9; | |||
| repeated int64 input = 10; | |||
| repeated int64 output = 11; | |||
| repeated TensorDescriptor input_desc = 12; | |||
| repeated TensorDescriptor output_desc = 13; | |||
| repeated WeightDef weights = 14; | |||
| repeated string dst_name = 15; | |||
| repeated int32 dst_index = 16; | |||
| repeated int64 workspace = 20; | |||
| repeated uint32 workspace_bytes = 21; | |||
| repeated string weight_name = 22; | |||
| repeated bool is_input_const = 23; | |||
| map<string, AttrDef> attr = 30; | |||
| QuantizeFactorParams quantize_factor = 31; | |||
| oneof op_params { | |||
| // start at 100 here | |||
| SendOpParams sender_param = 100; | |||
| RecvOpParams receiver_param = 200; | |||
| ConvolutionOpParams convolution_param = 300; | |||
| PoolingOpParams pooling_param = 400; | |||
| EltwiseOpParams eltwise_param = 500; | |||
| BatchNormOpParams batchnorm_param = 600; | |||
| ScaleOpParams scale_param = 700; | |||
| FullConnectionOpParams full_connection_param = 800; | |||
| SoftmaxOpParams softmax_param = 900; | |||
| ActivationOpParams activation_param = 1000; | |||
| ReshapeOpParams reshape_param = 1100; | |||
| } | |||
| }; | |||
| message SendOpParams { | |||
| uint32 event_id = 1; | |||
| }; | |||
| message RecvOpParams { | |||
| uint32 event_id = 1; | |||
| }; | |||
| enum QuantizeScaleType | |||
| { | |||
| VECTOR_SCALE = 0; | |||
| SCALAR_SCALE = 1; | |||
| } | |||
| enum QuantizeScaleMode | |||
| { | |||
| NORMAL_MODE = 0; | |||
| SQRT_MODE = 1; | |||
| } | |||
| enum QuantizeAlgorithm | |||
| { | |||
| NON_OFFSET_ALGO = 0; | |||
| HALF_OFFSET_ALGO = 1; | |||
| ALL_OFFSET_ALGO = 2; | |||
| } | |||
| message QuantizeFactor | |||
| { | |||
| QuantizeScaleMode scale_mode = 1; | |||
| bytes scale_value = 2; | |||
| int64 scale_offset = 3; | |||
| bytes offset_data_value = 4; | |||
| int64 offset_data_offset = 5; | |||
| bytes offset_weight_value = 6; | |||
| int64 offset_weight_offset = 7; | |||
| bytes offset_pad_value = 8; | |||
| int64 offset_pad_offset = 9; | |||
| }; | |||
| message QuantizeCalcFactor | |||
| { | |||
| bytes offsetw = 1; | |||
| int64 offsetw_offset = 2; | |||
| bytes offsetd = 3; | |||
| int64 offsetd_offset = 4; | |||
| bytes scalereq = 5; | |||
| int64 scaledreq_offset = 6; | |||
| bytes offsetdnext = 7; | |||
| int64 offsetdnext_offset = 8; | |||
| } | |||
| message QuantizeFactorParams | |||
| { | |||
| QuantizeAlgorithm quantize_algo = 1; | |||
| QuantizeScaleType scale_type = 2; | |||
| QuantizeFactor quantize_param = 3; | |||
| QuantizeFactor dequantize_param = 4; | |||
| QuantizeFactor requantize_param = 5; | |||
| QuantizeCalcFactor quantizecalc_param = 6; | |||
| }; | |||
| message ConvolutionOpParams { | |||
| int32 mode = 1; | |||
| int32 algo = 2; | |||
| int32 pad_mode = 3; | |||
| uint32 group = 4; | |||
| uint32 num_output = 5; | |||
| repeated uint32 pad = 10; | |||
| repeated uint32 stride = 11; | |||
| repeated uint32 dilation = 12; | |||
| repeated uint32 kernel = 13; | |||
| float alpha = 20; | |||
| float beta = 21; | |||
| WeightDef filter = 40; | |||
| WeightDef bias = 41; | |||
| bool relu_flag = 62; | |||
| repeated uint32 adj = 70; | |||
| repeated uint32 target_shape = 71; | |||
| repeated uint32 before_pad = 72; | |||
| }; | |||
| message PoolingOpParams { | |||
| int32 mode = 1; | |||
| int32 nan_opt = 2; | |||
| int32 pad_mode = 3; | |||
| bool global_pooling = 4; | |||
| repeated uint32 window = 10; | |||
| repeated uint32 pad = 11; | |||
| repeated uint32 stride = 12; | |||
| bool ceil_mode = 13; | |||
| int32 data_mode = 14; | |||
| float alpha = 20; | |||
| float beta = 21; | |||
| repeated uint32 before_pad = 22; | |||
| }; | |||
| message EltwiseOpParams { | |||
| int32 mode = 1; | |||
| repeated float coeff = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| repeated WeightDef weight = 5; | |||
| bool relu_flag = 6; | |||
| }; | |||
| message ActivationOpParams { | |||
| int32 mode = 1; | |||
| float coef = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| }; | |||
| message BatchNormOpParams { | |||
| int32 mode = 1; | |||
| float alpha = 2; | |||
| float beta = 3; | |||
| double epsilon = 4;//optinal,[default = 1e-5] | |||
| bool use_global_stats = 5; //optinal,by default true,testing mode | |||
| float moving_average_fraction = 6; //optinal,[default = .999]; | |||
| WeightDef estimated_mean = 7; | |||
| WeightDef estimated_variance = 8; | |||
| WeightDef scale = 9; | |||
| WeightDef bias = 10; | |||
| }; | |||
| message ScaleOpParams { | |||
| WeightDef scale = 1; | |||
| WeightDef bias = 2; | |||
| }; | |||
| message ReshapeOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| ShapeDef shape = 3; | |||
| int32 axis = 4; | |||
| int32 num_axes = 5; | |||
| int32 format = 6; | |||
| }; | |||
| message SoftmaxOpParams { | |||
| int32 algo = 1; | |||
| int32 mode = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| }; | |||
| message FullConnectionOpParams { | |||
| WeightDef filter = 1; | |||
| WeightDef bias = 2; | |||
| uint32 num_output = 3; | |||
| bool relu_flag = 12; | |||
| }; | |||
| message FlattenOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 start_axis = 3; | |||
| int32 end_axis = 4; | |||
| } | |||
| message AddLimitedOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 axis = 3; | |||
| bool broadcast = 4; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message MulLimitedOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 axis = 3; | |||
| bool broadcast = 4; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message AddOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message MulOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message SubOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message BiasAddOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| WeightDef bias = 10; | |||
| }; | |||
| message MatMulOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| bool transposeX = 3; | |||
| bool transposeW = 4; | |||
| WeightDef filter = 10; | |||
| WeightDef bias = 12; | |||
| }; | |||
| message RsqrtOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| }; | |||
| message WeightDef { | |||
| int32 format = 1; | |||
| int32 data_type = 2; | |||
| ShapeDef shape = 3; | |||
| bytes data = 4; | |||
| int64 data_offset = 5; | |||
| uint32 cmps_size = 6; | |||
| bytes cmps_tab = 7; | |||
| int64 cmps_tab_offset = 10; | |||
| CompressInfo cmps_info = 8; | |||
| AllOffsetQuantizeInfo alloffset_quantize_info = 11; | |||
| } | |||
| message ShapeDef { | |||
| repeated int64 dim = 1; | |||
| } | |||
| enum DeviceType { | |||
| NPU = 0; // In default, we will use NPU. | |||
| CPU = 1; // CPU | |||
| } | |||
| message AllOffsetQuantizeInfo { | |||
| float scale = 1; | |||
| int32 offset = 2; | |||
| } | |||
| message TensorDescriptor { | |||
| int32 format = 1; | |||
| int32 data_type = 2; | |||
| repeated int64 dim = 3; | |||
| uint32 size = 4; | |||
| bool reuse_input = 5; | |||
| bool output_tensor = 7; | |||
| DeviceType device_type = 8; | |||
| bool input_tensor = 9; | |||
| uint32 real_dim_cnt = 10; | |||
| uint32 reuse_input_index = 11; | |||
| AllOffsetQuantizeInfo alloffset_quantize_info = 12; | |||
| } | |||
| message CompressInfo { | |||
| int32 blockRow = 1; // block row | |||
| int32 blockCol = 2; // block col | |||
| int32 fractalK = 3; // fractal K | |||
| int32 fractalN = 4; // fractal N | |||
| int32 lastFractalK = 5; // K of last fractal | |||
| int32 lastFractalN = 6; // N of last fractal | |||
| int32 cubeSize = 7; // cube's length | |||
| int32 loadDir = 8; // data load directtiono 0:col load 1:row load | |||
| } | |||
| message AttrDef { | |||
| message ListValue { | |||
| repeated string s = 2; // "list(string)" | |||
| repeated int64 i = 3 [packed = true]; // "list(int)" | |||
| repeated float f = 4 [packed = true]; // "list(float)" | |||
| repeated bool b = 5 [packed = true]; // "list(bool)" | |||
| repeated uint32 u = 6 [packed = true]; // "list(uint)" | |||
| repeated bytes bt = 7; | |||
| } | |||
| oneof value { | |||
| string s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| uint32 u = 6; // "uint32" | |||
| bytes bt = 7; | |||
| ListValue list = 1; // any "list(...)" | |||
| NamedAttrs func = 10; | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NamedAttrs { | |||
| string name = 1; | |||
| map<string, AttrDef> attr = 2; | |||
| } | |||
| @@ -1,563 +0,0 @@ | |||
| // Copyright (c) ONNX Project Contributors. | |||
| // Licensed under the MIT license. | |||
| syntax = "proto3"; | |||
| package ge.onnx; | |||
| // Overview | |||
| // | |||
| // ONNX is an open specification that is comprised of the following components: | |||
| // | |||
| // 1) A definition of an extensible computation graph model. | |||
| // 2) Definitions of standard data types. | |||
| // 3) Definitions of built-in operators. | |||
| // | |||
| // This document describes the syntax of models and their computation graphs, | |||
| // as well as the standard data types. Together, they are referred to as the ONNX | |||
| // Intermediate Representation, or 'IR' for short. | |||
| // | |||
| // The normative semantic specification of the ONNX IR is found in docs/IR.md. | |||
| // Definitions of the built-in neural network operators may be found in docs/Operators.md. | |||
| // Notes | |||
| // | |||
| // Release | |||
| // | |||
| // We are still in the very early stage of defining ONNX. The current | |||
| // version of ONNX is a starting point. While we are actively working | |||
| // towards a complete spec, we would like to get the community involved | |||
| // by sharing our working version of ONNX. | |||
| // | |||
| // Protobuf compatibility | |||
| // | |||
| // To simplify framework compatibility, ONNX is defined using the subset of protobuf | |||
| // that is compatible with both protobuf v2 and v3. This means that we do not use any | |||
| // protobuf features that are only available in one of the two versions. | |||
| // | |||
| // Here are the most notable contortions we have to carry out to work around | |||
| // these limitations: | |||
| // | |||
| // - No 'map' (added protobuf 3.0). We instead represent mappings as lists | |||
| // of key-value pairs, where order does not matter and duplicates | |||
| // are not allowed. | |||
| // Versioning | |||
| // | |||
| // ONNX versioning is specified in docs/IR.md and elaborated on in docs/Versioning.md | |||
| // | |||
| // To be compatible with both proto2 and proto3, we will use a version number | |||
| // that is not defined by the default value but an explicit enum number. | |||
| enum Version { | |||
| // proto3 requires the first enum value to be zero. | |||
| // We add this just to appease the compiler. | |||
| _START_VERSION = 0; | |||
| // The version field is always serialized and we will use it to store the | |||
| // version that the graph is generated from. This helps us set up version | |||
| // control. | |||
| // For the IR, we are using simple numbers starting with with 0x00000001, | |||
| // which was the version we published on Oct 10, 2017. | |||
| IR_VERSION_2017_10_10 = 0x0000000000000001; | |||
| // IR_VERSION 2 published on Oct 30, 2017 | |||
| // - Added type discriminator to AttributeProto to support proto3 users | |||
| IR_VERSION_2017_10_30 = 0x0000000000000002; | |||
| // IR VERSION 3 published on Nov 3, 2017 | |||
| // - For operator versioning: | |||
| // - Added new message OperatorSetIdProto | |||
| // - Added opset_import in ModelProto | |||
| // - For vendor extensions, added domain in NodeProto | |||
| IR_VERSION_2017_11_3 = 0x0000000000000003; | |||
| // IR VERSION 4 published on Jan 22, 2019 | |||
| // - Relax constraint that initializers should be a subset of graph inputs | |||
| // - Add type BFLOAT16 | |||
| IR_VERSION_2019_1_22 = 0x0000000000000004; | |||
| // IR VERSION 5 published on March 18, 2019 | |||
| // - Add message TensorAnnotation. | |||
| // - Add quantization annotation in GraphProto to map tensor with its scale and zero point quantization parameters. | |||
| IR_VERSION_2019_3_18 = 0x0000000000000005; | |||
| // IR VERSION 6 published on Sep 19, 2019 | |||
| // - Add support for sparse tensor constants stored in model. | |||
| // - Add message SparseTensorProto | |||
| // - Add sparse initializers | |||
| IR_VERSION = 0x0000000000000006; | |||
| } | |||
| // Attributes | |||
| // | |||
| // A named attribute containing either singular float, integer, string, graph, | |||
| // and tensor values, or repeated float, integer, string, graph, and tensor values. | |||
| // An AttributeProto MUST contain the name field, and *only one* of the | |||
| // following content fields, effectively enforcing a C/C++ union equivalent. | |||
| message AttributeProto { | |||
| // Note: this enum is structurally identical to the OpSchema::AttrType | |||
| // enum defined in schema.h. If you rev one, you likely need to rev the other. | |||
| enum AttributeType { | |||
| UNDEFINED = 0; | |||
| FLOAT = 1; | |||
| INT = 2; | |||
| STRING = 3; | |||
| TENSOR = 4; | |||
| GRAPH = 5; | |||
| SPARSE_TENSOR = 11; | |||
| FLOATS = 6; | |||
| INTS = 7; | |||
| STRINGS = 8; | |||
| TENSORS = 9; | |||
| GRAPHS = 10; | |||
| SPARSE_TENSORS = 12; | |||
| } | |||
| // The name field MUST be present for this version of the IR. | |||
| string name = 1; // namespace Attribute | |||
| // if ref_attr_name is not empty, ref_attr_name is the attribute name in parent function. | |||
| // In this case, this AttributeProto does not contain data, and it's a reference of attribute | |||
| // in parent scope. | |||
| // NOTE: This should ONLY be used in function (sub-graph). It's invalid to be used in main graph. | |||
| string ref_attr_name = 21; | |||
| // A human-readable documentation for this attribute. Markdown is allowed. | |||
| string doc_string = 13; | |||
| // The type field MUST be present for this version of the IR. | |||
| // For 0.0.1 versions of the IR, this field was not defined, and | |||
| // implementations needed to use has_field hueristics to determine | |||
| // which value field was in use. For IR_VERSION 0.0.2 or later, this | |||
| // field MUST be set and match the f|i|s|t|... field in use. This | |||
| // change was made to accomodate proto3 implementations. | |||
| AttributeType type = 20; // discriminator that indicates which field below is in use | |||
| // Exactly ONE of the following fields must be present for this version of the IR | |||
| float f = 2; // float | |||
| int64 i = 3; // int | |||
| bytes s = 4; // UTF-8 string | |||
| TensorProto t = 5; // tensor value | |||
| GraphProto g = 6; // graph | |||
| SparseTensorProto sparse_tensor = 22; // sparse tensor value | |||
| // Do not use field below, it's deprecated. | |||
| // optional ValueProto v = 12; // value - subsumes everything but graph | |||
| repeated float floats = 7; // list of floats | |||
| repeated int64 ints = 8; // list of ints | |||
| repeated bytes strings = 9; // list of UTF-8 strings | |||
| repeated TensorProto tensors = 10; // list of tensors | |||
| repeated GraphProto graphs = 11; // list of graph | |||
| repeated SparseTensorProto sparse_tensors = 23; // list of sparse tensors | |||
| } | |||
| // Defines information on value, including the name, the type, and | |||
| // the shape of the value. | |||
| message ValueInfoProto { | |||
| // This field MUST be present in this version of the IR. | |||
| string name = 1; // namespace Value | |||
| // This field MUST be present in this version of the IR for | |||
| // inputs and outputs of the top-level graph. | |||
| TypeProto type = 2; | |||
| // A human-readable documentation for this value. Markdown is allowed. | |||
| string doc_string = 3; | |||
| } | |||
| // Nodes | |||
| // | |||
| // Computation graphs are made up of a DAG of nodes, which represent what is | |||
| // commonly called a "layer" or "pipeline stage" in machine learning frameworks. | |||
| // | |||
| // For example, it can be a node of type "Conv" that takes in an image, a filter | |||
| // tensor and a bias tensor, and produces the convolved output. | |||
| message NodeProto { | |||
| repeated string input = 1; // namespace Value | |||
| repeated string output = 2; // namespace Value | |||
| // An optional identifier for this node in a graph. | |||
| // This field MAY be absent in ths version of the IR. | |||
| string name = 3; // namespace Node | |||
| // The symbolic identifier of the Operator to execute. | |||
| string op_type = 4; // namespace Operator | |||
| // The domain of the OperatorSet that specifies the operator named by op_type. | |||
| string domain = 7; // namespace Domain | |||
| // Additional named attributes. | |||
| repeated AttributeProto attribute = 5; | |||
| // A human-readable documentation for this node. Markdown is allowed. | |||
| string doc_string = 6; | |||
| } | |||
| // Models | |||
| // | |||
| // ModelProto is a top-level file/container format for bundling a ML model and | |||
| // associating its computation graph with metadata. | |||
| // | |||
| // The semantics of the model are described by the associated GraphProto. | |||
| message ModelProto { | |||
| // The version of the IR this model targets. See Version enum above. | |||
| // This field MUST be present. | |||
| int64 ir_version = 1; | |||
| // The OperatorSets this model relies on. | |||
| // All ModelProtos MUST have at least one entry that | |||
| // specifies which version of the ONNX OperatorSet is | |||
| // being imported. | |||
| // | |||
| // All nodes in the ModelProto's graph will bind against the operator | |||
| // with the same-domain/same-op_type operator with the HIGHEST version | |||
| // in the referenced operator sets. | |||
| repeated OperatorSetIdProto opset_import = 8; | |||
| // The name of the framework or tool used to generate this model. | |||
| // This field SHOULD be present to indicate which implementation/tool/framework | |||
| // emitted the model. | |||
| string producer_name = 2; | |||
| // The version of the framework or tool used to generate this model. | |||
| // This field SHOULD be present to indicate which implementation/tool/framework | |||
| // emitted the model. | |||
| string producer_version = 3; | |||
| // Domain name of the model. | |||
| // We use reverse domain names as name space indicators. For example: | |||
| // `com.facebook.fair` or `com.microsoft.cognitiveservices` | |||
| // | |||
| // Together with `model_version` and GraphProto.name, this forms the unique identity of | |||
| // the graph. | |||
| string domain = 4; | |||
| // The version of the graph encoded. See Version enum below. | |||
| int64 model_version = 5; | |||
| // A human-readable documentation for this model. Markdown is allowed. | |||
| string doc_string = 6; | |||
| // The parameterized graph that is evaluated to execute the model. | |||
| GraphProto graph = 7; | |||
| // Named metadata values; keys should be distinct. | |||
| repeated StringStringEntryProto metadata_props = 14; | |||
| }; | |||
| // StringStringEntryProto follows the pattern for cross-proto-version maps. | |||
| // See https://developers.google.com/protocol-buffers/docs/proto3#maps | |||
| message StringStringEntryProto { | |||
| string key = 1; | |||
| string value= 2; | |||
| }; | |||
| message TensorAnnotation { | |||
| string tensor_name = 1; | |||
| // <key, value> pairs to annotate tensor specified by <tensor_name> above. | |||
| // The keys used in the mapping below must be pre-defined in ONNX spec. | |||
| // For example, for 8-bit linear quantization case, 'SCALE_TENSOR', 'ZERO_POINT_TENSOR' will be pre-defined as | |||
| // quantization parameter keys. | |||
| repeated StringStringEntryProto quant_parameter_tensor_names = 2; | |||
| } | |||
| // Graphs | |||
| // | |||
| // A graph defines the computational logic of a model and is comprised of a parameterized | |||
| // list of nodes that form a directed acyclic graph based on their inputs and outputs. | |||
| // This is the equivalent of the "network" or "graph" in many deep learning | |||
| // frameworks. | |||
| message GraphProto { | |||
| // The nodes in the graph, sorted topologically. | |||
| repeated NodeProto node = 1; | |||
| // The name of the graph. | |||
| string name = 2; // namespace Graph | |||
| // A list of named tensor values, used to specify constant inputs of the graph. | |||
| // Each TensorProto entry must have a distinct name (within the list) that | |||
| // MAY also appear in the input list. | |||
| repeated TensorProto initializer = 5; | |||
| // Initializers (see above) stored in sparse format. | |||
| repeated SparseTensorProto sparse_initializer = 15; | |||
| // A human-readable documentation for this graph. Markdown is allowed. | |||
| string doc_string = 10; | |||
| // The inputs and outputs of the graph. | |||
| repeated ValueInfoProto input = 11; | |||
| repeated ValueInfoProto output = 12; | |||
| // Information for the values in the graph. The ValueInfoProto.name's | |||
| // must be distinct. It is optional for a value to appear in value_info list. | |||
| repeated ValueInfoProto value_info = 13; | |||
| // This field carries information to indicate the mapping among a tensor and its | |||
| // quantization parameter tensors. For example: | |||
| // For tensor 'a', it may have {'SCALE_TENSOR', 'a_scale'} and {'ZERO_POINT_TENSOR', 'a_zero_point'} annotated, | |||
| // which means, tensor 'a_scale' and tensor 'a_zero_point' are scale and zero point of tensor 'a' in the model. | |||
| repeated TensorAnnotation quantization_annotation = 14; | |||
| // DO NOT USE the following fields, they were deprecated from earlier versions. | |||
| // repeated string input = 3; | |||
| // repeated string output = 4; | |||
| // optional int64 ir_version = 6; | |||
| // optional int64 producer_version = 7; | |||
| // optional string producer_tag = 8; | |||
| // optional string domain = 9; | |||
| } | |||
| // Tensors | |||
| // | |||
| // A serialized tensor value. | |||
| message TensorProto { | |||
| enum DataType { | |||
| UNDEFINED = 0; | |||
| // Basic types. | |||
| FLOAT = 1; // float | |||
| UINT8 = 2; // uint8_t | |||
| INT8 = 3; // int8_t | |||
| UINT16 = 4; // uint16_t | |||
| INT16 = 5; // int16_t | |||
| INT32 = 6; // int32_t | |||
| INT64 = 7; // int64_t | |||
| STRING = 8; // string | |||
| BOOL = 9; // bool | |||
| // IEEE754 half-precision floating-point format (16 bits wide). | |||
| // This format has 1 sign bit, 5 exponent bits, and 10 mantissa bits. | |||
| FLOAT16 = 10; | |||
| DOUBLE = 11; | |||
| UINT32 = 12; | |||
| UINT64 = 13; | |||
| COMPLEX64 = 14; // complex with float32 real and imaginary components | |||
| COMPLEX128 = 15; // complex with float64 real and imaginary components | |||
| // Non-IEEE floating-point format based on IEEE754 single-precision | |||
| // floating-point number truncated to 16 bits. | |||
| // This format has 1 sign bit, 8 exponent bits, and 7 mantissa bits. | |||
| BFLOAT16 = 16; | |||
| // Future extensions go here. | |||
| } | |||
| // The shape of the tensor. | |||
| repeated int64 dims = 1; | |||
| // The data type of the tensor. | |||
| // This field MUST have a valid TensorProto.DataType value | |||
| int32 data_type = 2; | |||
| // For very large tensors, we may want to store them in chunks, in which | |||
| // case the following fields will specify the segment that is stored in | |||
| // the current TensorProto. | |||
| message Segment { | |||
| int64 begin = 1; | |||
| int64 end = 2; | |||
| } | |||
| Segment segment = 3; | |||
| // Tensor content must be organized in row-major order. | |||
| // | |||
| // Depending on the data_type field, exactly one of the fields below with | |||
| // name ending in _data is used to store the elements of the tensor. | |||
| // For float and complex64 values | |||
| // Complex64 tensors are encoded as a single array of floats, | |||
| // with the real components appearing in odd numbered positions, | |||
| // and the corresponding imaginary component apparing in the | |||
| // subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] | |||
| // is encoded as [1.0, 2.0 ,3.0 ,4.0] | |||
| // When this field is present, the data_type field MUST be FLOAT or COMPLEX64. | |||
| repeated float float_data = 4 [packed = true]; | |||
| // For int32, uint8, int8, uint16, int16, bool, and float16 values | |||
| // float16 values must be bit-wise converted to an uint16_t prior | |||
| // to writing to the buffer. | |||
| // When this field is present, the data_type field MUST be | |||
| // INT32, INT16, INT8, UINT16, UINT8, BOOL, or FLOAT16 | |||
| repeated int32 int32_data = 5 [packed = true]; | |||
| // For strings. | |||
| // Each element of string_data is a UTF-8 encoded Unicode | |||
| // string. No trailing null, no leading BOM. The protobuf "string" | |||
| // scalar type is not used to match ML community conventions. | |||
| // When this field is present, the data_type field MUST be STRING | |||
| repeated bytes string_data = 6; | |||
| // For int64. | |||
| // When this field is present, the data_type field MUST be INT64 | |||
| repeated int64 int64_data = 7 [packed = true]; | |||
| // Optionally, a name for the tensor. | |||
| string name = 8; // namespace Value | |||
| // A human-readable documentation for this tensor. Markdown is allowed. | |||
| string doc_string = 12; | |||
| // Serializations can either use one of the fields above, or use this | |||
| // raw bytes field. The only exception is the string case, where one is | |||
| // required to store the content in the repeated bytes string_data field. | |||
| // | |||
| // When this raw_data field is used to store tensor value, elements MUST | |||
| // be stored in as fixed-width, little-endian order. | |||
| // Floating-point data types MUST be stored in IEEE 754 format. | |||
| // Complex64 elements must be written as two consecutive FLOAT values, real component first. | |||
| // Complex128 elements must be written as two consecutive DOUBLE values, real component first. | |||
| // Boolean type MUST be written one byte per tensor element (00000001 for true, 00000000 for false). | |||
| // | |||
| // Note: the advantage of specific field rather than the raw_data field is | |||
| // that in some cases (e.g. int data), protobuf does a better packing via | |||
| // variable length storage, and may lead to smaller binary footprint. | |||
| // When this field is present, the data_type field MUST NOT be STRING or UNDEFINED | |||
| bytes raw_data = 9; | |||
| // Data can be stored inside the protobuf file using type-specific fields or raw_data. | |||
| // Alternatively, raw bytes data can be stored in an external file, using the external_data field. | |||
| // external_data stores key-value pairs describing data location. Recognized keys are: | |||
| // - "location" (required) - POSIX filesystem path relative to the directory where the ONNX | |||
| // protobuf model was stored | |||
| // - "offset" (optional) - position of byte at which stored data begins. Integer stored as string. | |||
| // Offset values SHOULD be multiples 4096 (page size) to enable mmap support. | |||
| // - "length" (optional) - number of bytes containing data. Integer stored as string. | |||
| // - "checksum" (optional) - SHA1 digest of file specified in under 'location' key. | |||
| repeated StringStringEntryProto external_data = 13; | |||
| // Location of the data for this tensor. MUST be one of: | |||
| // - DEFAULT - data stored inside the protobuf message. Data is stored in raw_data (if set) otherwise in type-specified field. | |||
| // - EXTERNAL - data stored in an external location as described by external_data field. | |||
| enum DataLocation { | |||
| DEFAULT = 0; | |||
| EXTERNAL = 1; | |||
| } | |||
| // If value not set, data is stored in raw_data (if set) otherwise in type-specified field. | |||
| DataLocation data_location = 14; | |||
| // For double | |||
| // Complex128 tensors are encoded as a single array of doubles, | |||
| // with the real components appearing in odd numbered positions, | |||
| // and the corresponding imaginary component apparing in the | |||
| // subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] | |||
| // is encoded as [1.0, 2.0 ,3.0 ,4.0] | |||
| // When this field is present, the data_type field MUST be DOUBLE or COMPLEX128 | |||
| repeated double double_data = 10 [packed = true]; | |||
| // For uint64 and uint32 values | |||
| // When this field is present, the data_type field MUST be | |||
| // UINT32 or UINT64 | |||
| repeated uint64 uint64_data = 11 [packed = true]; | |||
| } | |||
| // A serialized sparse-tensor value | |||
| message SparseTensorProto { | |||
| // The sequence of non-default values are encoded as a tensor of shape [NNZ]. | |||
| // The default-value is zero for numeric tensors, and empty-string for string tensors. | |||
| TensorProto values = 1; | |||
| // The indices of the non-default values, which may be stored in one of two formats. | |||
| // (a) Indices can be a tensor of shape [NNZ, rank] with the [i,j]-th value | |||
| // corresponding to the j-th index of the i-th value (in the values tensor). | |||
| // (b) Indices can be a tensor of shape [NNZ], in which case the i-th value | |||
| // must be the linearized-index of the i-th value (in the values tensor). | |||
| // The linearized-index can be converted into an index tuple (k_1,...,k_rank) | |||
| // using the shape provided below. | |||
| // The indices must appear in ascending order without duplication. | |||
| // In the first format, the ordering is lexicographic-ordering: | |||
| // e.g., index-value [1,4] must appear before [2,1] | |||
| TensorProto indices = 2; | |||
| // The shape of the underlying dense-tensor: [dim_1, dim_2, ... dim_rank] | |||
| repeated int64 dims = 3; | |||
| } | |||
| // Defines a tensor shape. A dimension can be either an integer value | |||
| // or a symbolic variable. A symbolic variable represents an unknown | |||
| // dimension. | |||
| message TensorShapeProto { | |||
| message Dimension { | |||
| oneof value { | |||
| int64 dim_value = 1; | |||
| string dim_param = 2; // namespace Shape | |||
| }; | |||
| // Standard denotation can optionally be used to denote tensor | |||
| // dimensions with standard semantic descriptions to ensure | |||
| // that operations are applied to the correct axis of a tensor. | |||
| // Refer to https://github.com/onnx/onnx/blob/master/docs/DimensionDenotation.md#denotation-definition | |||
| // for pre-defined dimension denotations. | |||
| string denotation = 3; | |||
| }; | |||
| repeated Dimension dim = 1; | |||
| } | |||
| // Types | |||
| // | |||
| // The standard ONNX data types. | |||
| message TypeProto { | |||
| message Tensor { | |||
| // This field MUST NOT have the value of UNDEFINED | |||
| // This field MUST have a valid TensorProto.DataType value | |||
| // This field MUST be present for this version of the IR. | |||
| int32 elem_type = 1; | |||
| TensorShapeProto shape = 2; | |||
| } | |||
| // repeated T | |||
| message Sequence { | |||
| // The type and optional shape of each element of the sequence. | |||
| // This field MUST be present for this version of the IR. | |||
| TypeProto elem_type = 1; | |||
| }; | |||
| // map<K,V> | |||
| message Map { | |||
| // This field MUST have a valid TensorProto.DataType value | |||
| // This field MUST be present for this version of the IR. | |||
| // This field MUST refer to an integral type ([U]INT{8|16|32|64}) or STRING | |||
| int32 key_type = 1; | |||
| // This field MUST be present for this version of the IR. | |||
| TypeProto value_type = 2; | |||
| }; | |||
| oneof value { | |||
| // The type of a tensor. | |||
| Tensor tensor_type = 1; | |||
| // NOTE: DNN-only implementations of ONNX MAY elect to not support non-tensor values | |||
| // as input and output to graphs and nodes. These types are needed to naturally | |||
| // support classical ML operators. DNN operators SHOULD restrict their input | |||
| // and output types to tensors. | |||
| // The type of a sequence. | |||
| Sequence sequence_type = 4; | |||
| // The type of a map. | |||
| Map map_type = 5; | |||
| } | |||
| // An optional denotation can be used to denote the whole | |||
| // type with a standard semantic description as to what is | |||
| // stored inside. Refer to https://github.com/onnx/onnx/blob/master/docs/TypeDenotation.md#type-denotation-definition | |||
| // for pre-defined type denotations. | |||
| string denotation = 6; | |||
| } | |||
| // Operator Sets | |||
| // | |||
| // OperatorSets are uniquely identified by a (domain, opset_version) pair. | |||
| message OperatorSetIdProto { | |||
| // The domain of the operator set being identified. | |||
| // The empty string ("") or absence of this field implies the operator | |||
| // set that is defined as part of the ONNX specification. | |||
| // This field MUST be present in this version of the IR when referring to any other operator set. | |||
| string domain = 1; | |||
| // The version of the operator set being identified. | |||
| // This field MUST be present in this version of the IR. | |||
| int64 version = 2; | |||
| } | |||
| @@ -1,31 +0,0 @@ | |||
| ############ lib_caffe_parser.so ############ | |||
| add_library(_caffe_parser SHARED | |||
| $<TARGET_OBJECTS:parser_caffe_proto_obj> | |||
| ) | |||
| target_compile_definitions(_caffe_parser PRIVATE | |||
| google=ascend_private | |||
| ) | |||
| target_include_directories(_caffe_parser PRIVATE | |||
| ${CMAKE_CURRENT_LIST_DIR} | |||
| ) | |||
| target_link_options(_caffe_parser PRIVATE | |||
| -Wl,-Bsymbolic | |||
| ) | |||
| target_link_libraries(_caffe_parser PRIVATE | |||
| $<BUILD_INTERFACE:intf_pub> | |||
| -Wl,--no-as-needed | |||
| ascend_protobuf | |||
| -Wl,--as-needed | |||
| ) | |||
| ############ install ############ | |||
| set(INSTALL_BASE_DIR "") | |||
| set(INSTALL_LIBRARY_DIR lib) | |||
| install(TARGETS _caffe_parser OPTIONAL | |||
| LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | |||
| ) | |||
| @@ -1,21 +0,0 @@ | |||
| LOCAL_PATH := $(call my-dir) | |||
| include $(CLEAR_VARS) | |||
| LOCAL_MODULE := lib_caffe_parser | |||
| LOCAL_CFLAGS += -Dgoogle=ascend_private | |||
| ifeq ($(DEBUG), 1) | |||
| LOCAL_CFLAGS += -g -O0 | |||
| endif | |||
| LOCAL_SRC_FILES := \ | |||
| caffe.proto \ | |||
| LOCAL_C_INCLUDES := \ | |||
| third_party/protobuf/include \ | |||
| LOCAL_SHARED_LIBRARIES := \ | |||
| libascend_protobuf \ | |||
| include $(BUILD_HOST_SHARED_LIBRARY) | |||
| @@ -1,193 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package ge.proto; | |||
| enum DataType | |||
| { | |||
| DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set. | |||
| DT_FLOAT = 1; // float type | |||
| DT_FLOAT16 = 2; // fp16 type | |||
| DT_INT8 = 3; // int8 type | |||
| DT_UINT8 = 4; // uint8 type | |||
| DT_INT16 = 5; // int16 type | |||
| DT_UINT16 = 6; // uint16 type | |||
| DT_INT32 = 7; // | |||
| DT_INT64 = 8; // int64 type | |||
| DT_UINT32 = 9; // unsigned int32 | |||
| DT_UINT64 = 10; // unsigned int64 | |||
| DT_BOOL = 11; // bool type | |||
| DT_DOUBLE = 12; // double type | |||
| DT_STRING = 13; // string type | |||
| DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */ | |||
| DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */ | |||
| DT_COMPLEX64 = 16; // complex64 type | |||
| DT_COMPLEX128 = 17; // complex128 type | |||
| DT_QINT8 = 18; // qint8 type | |||
| DT_QINT16 = 19; // qint16 type | |||
| DT_QINT32 = 20; // qint32 type | |||
| DT_QUINT8 = 21; // quint8 type | |||
| DT_QUINT16 = 22; // quint16 type | |||
| DT_RESOURCE = 23; // resource type | |||
| DT_STRING_REF = 24; // string_ref type | |||
| DT_DUAL = 25; /**< dual output type */ | |||
| DT_VARIANT = 26; // variant type | |||
| DT_BF16 = 27; // bf16 type | |||
| DT_INT4 = 28; // int4 type | |||
| } | |||
| message AttrDef | |||
| { | |||
| message ListValue | |||
| { | |||
| enum ListValueType{ | |||
| VT_LIST_NONE = 0; | |||
| VT_LIST_STRING = 1; | |||
| VT_LIST_INT = 2; | |||
| VT_LIST_FLOAT = 3; | |||
| VT_LIST_BOOL = 4; | |||
| VT_LIST_BYTES = 5; | |||
| VT_LIST_TENSOR_DESC = 6; | |||
| VT_LIST_TENSOR = 7; | |||
| VT_LIST_GRAPH = 8; | |||
| VT_LIST_NAMED_ATTRS = 9; | |||
| VT_LIST_DATA_TYPE = 10; | |||
| } | |||
| repeated bytes s = 2; // "list(string)" | |||
| repeated int64 i = 3; // "list(int)" | |||
| repeated float f = 4; // "list(float)" | |||
| repeated bool b = 5; // "list(bool)" | |||
| repeated bytes bt = 7; | |||
| repeated TensorDescriptor td = 8; | |||
| repeated TensorDef t = 9; | |||
| repeated GraphDef g = 10; | |||
| repeated NamedAttrs na = 11; | |||
| repeated int64 dt = 12; // list ge::DataType | |||
| ListValueType val_type = 20; | |||
| } | |||
| message ListListInt{ | |||
| message ListInt{ | |||
| repeated int64 list_i = 1; // list int | |||
| } | |||
| repeated ListInt list_list_i = 1; // list list int | |||
| } | |||
| oneof value | |||
| { | |||
| bytes s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| bytes bt = 7; | |||
| ListValue list = 1; // any "list(...)" | |||
| NamedAttrs func = 10; // Used to support attr nesting | |||
| TensorDescriptor td = 11; // GeTensorDesc type | |||
| TensorDef t = 12; // GeTensor type | |||
| GraphDef g = 13; // Graph type | |||
| ListListInt list_list_int = 14; // List List Int type | |||
| int64 dt = 15; // ge::DataType | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NamedAttrs | |||
| { | |||
| string name = 1; | |||
| map<string, AttrDef> attr = 2; | |||
| } | |||
| // Shape / dimension description, using row-major order | |||
| message ShapeDef | |||
| { | |||
| repeated int64 dim = 1; // Size of each dimension | |||
| } | |||
| // Multidimensional data description | |||
| message TensorDescriptor | |||
| { | |||
| string name = 1; // Optional parameter, tensor name | |||
| DataType dtype = 2; // tensor datatype | |||
| ShapeDef shape = 3; // Shape / dimension | |||
| string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND" | |||
| bool has_out_attr = 9; | |||
| int64 size = 10; | |||
| int64 weight_size = 11; | |||
| bool reuse_input = 12; | |||
| bool output_tensor = 13; | |||
| string device_type = 14; | |||
| bool input_tensor =15; | |||
| int64 real_dim_cnt = 16; | |||
| int64 reuse_input_index = 17; | |||
| int64 data_offset = 18; | |||
| int64 cmps_size = 19; | |||
| string cmps_tab = 20; | |||
| int64 cmps_tab_offset = 21; | |||
| map<string, AttrDef> attr = 5; // Set of extra parameter fields | |||
| } | |||
| // GeTensor definition | |||
| message TensorDef | |||
| { | |||
| TensorDescriptor desc = 1; // Tensor description | |||
| bytes data = 2; // Tensor data | |||
| } | |||
| // Operator description | |||
| message OpDef | |||
| { | |||
| string name = 1; // name | |||
| string type = 2; // type | |||
| repeated string input = 5; // input original op name + outgoing index. op_name:index | |||
| map<string, AttrDef> attr = 10; // Set of operator parameter fields | |||
| bool has_out_attr = 20; | |||
| int64 id = 21; | |||
| int64 stream_id =22; | |||
| repeated string input_name = 23; | |||
| repeated string src_name = 24; | |||
| repeated int64 src_index = 25; | |||
| repeated string dst_name = 26; | |||
| repeated int64 dst_index = 27; | |||
| repeated int64 input_i = 28; | |||
| repeated int64 output_i = 29; | |||
| repeated int64 workspace = 30; | |||
| repeated int64 workspace_bytes = 31; | |||
| repeated bool is_input_const = 32; | |||
| repeated TensorDescriptor input_desc = 33; | |||
| repeated TensorDescriptor output_desc = 34; | |||
| repeated string subgraph_name = 35; | |||
| } | |||
| // Graph definition | |||
| message GraphDef | |||
| { | |||
| string name = 1; // name | |||
| repeated string input = 4; // Graph input | |||
| repeated string output = 5; // Graph output | |||
| repeated OpDef op = 6; // List of operators | |||
| map<string, AttrDef> attr = 11; // Extended field | |||
| } | |||
| // model definition | |||
| message ModelDef | |||
| { | |||
| string name = 1; // name | |||
| uint32 version = 2; // IR Proto verion | |||
| string custom_version = 3; // User model version number, passed in by user | |||
| repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef | |||
| map<string, AttrDef> attr = 11; // Extended field | |||
| } | |||
| @@ -1,140 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| message InsertNewOps { | |||
| repeated AippOpParams aipp_op = 1; | |||
| repeated MultiShapeOpParams multi_shape_op = 2; | |||
| } | |||
| message AippOpParams { | |||
| enum InputFormat { | |||
| UNDEFINED = 0; | |||
| YUV420SP_U8 = 1; | |||
| XRGB8888_U8 = 2; | |||
| RGB888_U8 = 3; | |||
| YUV400_U8 = 4; | |||
| NC1HWC0DI_FP16 = 5; | |||
| NC1HWC0DI_S8 = 6; | |||
| ARGB8888_U8 = 7; | |||
| YUYV_U8 = 8; | |||
| YUV422SP_U8 = 9; | |||
| AYUV444_U8 = 10; | |||
| RAW10 = 11; | |||
| RAW12 = 12; | |||
| RAW16 = 13; | |||
| RAW24 = 14; | |||
| RGB16 = 15; | |||
| RGB20 = 16; | |||
| RGB24 = 17; | |||
| RGB8_IR = 18; | |||
| RGB16_IR = 19; | |||
| RGB24_IR = 20; | |||
| } | |||
| enum AippMode { | |||
| undefined = 0; | |||
| static = 1; | |||
| dynamic = 2; | |||
| } | |||
| // AIPP模式,区分静态AIPP和动态AIPP | |||
| AippMode aipp_mode = 1; | |||
| // related_input_rank参数为必填,类型为整型,配置范围>=0, <=输入Data算子的个数,默认值为0。 | |||
| // 标识对模型的第几个输入做AIPP处理,例如模型有两个输入,需要对第2个输入做AIPP,则配置related_input_rank为1。 | |||
| uint32 related_input_rank = 2; | |||
| // related_input_name is optional and the top name of data node which inserts aipp | |||
| string related_input_name = 6; | |||
| // input_edge_idx参数为可选,类型为整型,配置范围为>=0。 | |||
| // 配置该参数的作用,在于对Data算子不同的输出做不同的AIPP处理,如果该参数没有配置,默认对related_input_rank指定的模型输入的所有输出边做AIPP。 | |||
| // 配置值 <= Data算子输出边的个数。 | |||
| repeated uint32 input_edge_idx = 3; | |||
| // [Begin] 动态AIPP参数,配置静态AIPP时无效 | |||
| uint32 max_src_image_size = 4; | |||
| // 是否支持旋转。默认不支持,开启支持旋转时,会有额外的空间和性能损失 | |||
| bool support_rotation = 5; | |||
| // [End] 动态AIPP参数 | |||
| // [Begin] 静态AIPP参数,配置动态AIPP时无效 | |||
| InputFormat input_format = 51; | |||
| bool csc_switch = 52; | |||
| float cpadding_value = 53; | |||
| bool rbuv_swap_switch = 54; | |||
| bool ax_swap_switch = 55; | |||
| bool single_line_mode = 56; | |||
| int32 src_image_size_w = 57; | |||
| int32 src_image_size_h = 58; | |||
| bool crop = 59; | |||
| int32 load_start_pos_w = 60; | |||
| int32 load_start_pos_h = 61; | |||
| int32 crop_size_w = 62; | |||
| int32 crop_size_h = 63; | |||
| bool resize = 64; | |||
| int32 resize_output_w = 65; | |||
| int32 resize_output_h = 66; | |||
| bool padding = 67; | |||
| int32 left_padding_size = 68; | |||
| int32 right_padding_size = 69; | |||
| int32 top_padding_size = 70; | |||
| int32 bottom_padding_size = 71; | |||
| float padding_value = 72; | |||
| int32 mean_chn_0 = 10; | |||
| int32 mean_chn_1 = 11; | |||
| int32 mean_chn_2 = 12; | |||
| int32 mean_chn_3 = 19; | |||
| float min_chn_0 = 13; | |||
| float min_chn_1 = 14; | |||
| float min_chn_2 = 15; | |||
| float min_chn_3 = 20; | |||
| repeated float var_reci_chn_0 = 16; | |||
| repeated float var_reci_chn_1 = 17; | |||
| repeated float var_reci_chn_2 = 18; | |||
| repeated float var_reci_chn_3 = 21; | |||
| repeated int32 matrix_r0c0 = 30; | |||
| repeated int32 matrix_r0c1 = 31; | |||
| repeated int32 matrix_r0c2 = 32; | |||
| repeated int32 matrix_r1c0 = 33; | |||
| repeated int32 matrix_r1c1 = 34; | |||
| repeated int32 matrix_r1c2 = 35; | |||
| repeated int32 matrix_r2c0 = 36; | |||
| repeated int32 matrix_r2c1 = 37; | |||
| repeated int32 matrix_r2c2 = 38; | |||
| repeated int32 output_bias_0 = 39; | |||
| repeated int32 output_bias_1 = 40; | |||
| repeated int32 output_bias_2 = 41; | |||
| repeated int32 input_bias_0 = 42; | |||
| repeated int32 input_bias_1 = 43; | |||
| repeated int32 input_bias_2 = 44; | |||
| // [End] 静态AIPP参数 | |||
| // The n number that is used for raw/rgbir data into f16 transformation. | |||
| // The transformation equation is x/(2^n). If set to 0, no transform is performed. | |||
| uint32 raw_rgbir_to_f16_n = 45; | |||
| } | |||
| message MultiShapeOpParams { | |||
| enum MultiShapeMode { | |||
| batch = 0; //动态batch | |||
| resolution = 1; //动态分辨率,扩展用 | |||
| } | |||
| MultiShapeMode mode = 1; //算子模式 | |||
| uint32 related_input_rank = 2; //新增算子插入到哪个输入 | |||
| repeated uint32 batch_list = 11; //batch_list值,batch_list的个数是2到8之间 | |||
| } | |||
| @@ -1,396 +0,0 @@ | |||
| /* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * Apache License for more details at | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| */ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| enum TargetType | |||
| { | |||
| MINI = 0; | |||
| TINY = 1; | |||
| LITE = 2; | |||
| } | |||
| // offline model | |||
| message ModelDef { | |||
| string name = 1; | |||
| uint32 version = 2; | |||
| uint64 memory_size = 10; | |||
| uint32 stream_num = 11; | |||
| uint32 event_num = 12; | |||
| uint64 weight_size = 13; | |||
| uint32 label_num = 15; | |||
| repeated OpDef op = 20; | |||
| TargetType target_type = 23; | |||
| map<string, AttrDef> attr = 30; | |||
| }; | |||
| // operator define | |||
| message OpDef { | |||
| string name = 1; | |||
| string type = 2; | |||
| uint32 id = 3; | |||
| uint32 stream_id = 4; | |||
| repeated string input_name = 5; | |||
| repeated string src_name = 8; | |||
| repeated int32 src_index = 9; | |||
| repeated int64 input = 10; | |||
| repeated int64 output = 11; | |||
| repeated TensorDescriptor input_desc = 12; | |||
| repeated TensorDescriptor output_desc = 13; | |||
| repeated WeightDef weights = 14; | |||
| repeated string dst_name = 15; | |||
| repeated int32 dst_index = 16; | |||
| repeated int64 workspace = 20; | |||
| repeated uint32 workspace_bytes = 21; | |||
| repeated string weight_name = 22; | |||
| repeated bool is_input_const = 23; | |||
| map<string, AttrDef> attr = 30; | |||
| QuantizeFactorParams quantize_factor = 31; | |||
| oneof op_params { | |||
| // start at 100 here | |||
| SendOpParams sender_param = 100; | |||
| RecvOpParams receiver_param = 200; | |||
| ConvolutionOpParams convolution_param = 300; | |||
| PoolingOpParams pooling_param = 400; | |||
| EltwiseOpParams eltwise_param = 500; | |||
| BatchNormOpParams batchnorm_param = 600; | |||
| ScaleOpParams scale_param = 700; | |||
| FullConnectionOpParams full_connection_param = 800; | |||
| SoftmaxOpParams softmax_param = 900; | |||
| ActivationOpParams activation_param = 1000; | |||
| ReshapeOpParams reshape_param = 1100; | |||
| } | |||
| }; | |||
| message SendOpParams { | |||
| uint32 event_id = 1; | |||
| }; | |||
| message RecvOpParams { | |||
| uint32 event_id = 1; | |||
| }; | |||
| enum QuantizeScaleType | |||
| { | |||
| VECTOR_SCALE = 0; | |||
| SCALAR_SCALE = 1; | |||
| } | |||
| enum QuantizeScaleMode | |||
| { | |||
| NORMAL_MODE = 0; | |||
| SQRT_MODE = 1; | |||
| } | |||
| enum QuantizeAlgorithm | |||
| { | |||
| NON_OFFSET_ALGO = 0; | |||
| HALF_OFFSET_ALGO = 1; | |||
| ALL_OFFSET_ALGO = 2; | |||
| } | |||
| message QuantizeFactor | |||
| { | |||
| QuantizeScaleMode scale_mode = 1; | |||
| bytes scale_value = 2; | |||
| int64 scale_offset = 3; | |||
| bytes offset_data_value = 4; | |||
| int64 offset_data_offset = 5; | |||
| bytes offset_weight_value = 6; | |||
| int64 offset_weight_offset = 7; | |||
| bytes offset_pad_value = 8; | |||
| int64 offset_pad_offset = 9; | |||
| }; | |||
| message QuantizeCalcFactor | |||
| { | |||
| bytes offsetw = 1; | |||
| int64 offsetw_offset = 2; | |||
| bytes offsetd = 3; | |||
| int64 offsetd_offset = 4; | |||
| bytes scalereq = 5; | |||
| int64 scaledreq_offset = 6; | |||
| bytes offsetdnext = 7; | |||
| int64 offsetdnext_offset = 8; | |||
| } | |||
| message QuantizeFactorParams | |||
| { | |||
| QuantizeAlgorithm quantize_algo = 1; | |||
| QuantizeScaleType scale_type = 2; | |||
| QuantizeFactor quantize_param = 3; | |||
| QuantizeFactor dequantize_param = 4; | |||
| QuantizeFactor requantize_param = 5; | |||
| QuantizeCalcFactor quantizecalc_param = 6; | |||
| }; | |||
| message ConvolutionOpParams { | |||
| int32 mode = 1; | |||
| int32 algo = 2; | |||
| int32 pad_mode = 3; | |||
| uint32 group = 4; | |||
| uint32 num_output = 5; | |||
| repeated uint32 pad = 10; | |||
| repeated uint32 stride = 11; | |||
| repeated uint32 dilation = 12; | |||
| repeated uint32 kernel = 13; | |||
| float alpha = 20; | |||
| float beta = 21; | |||
| WeightDef filter = 40; | |||
| WeightDef bias = 41; | |||
| bool relu_flag = 62; | |||
| repeated uint32 adj = 70; | |||
| repeated uint32 target_shape = 71; | |||
| repeated uint32 before_pad = 72; | |||
| }; | |||
| message PoolingOpParams { | |||
| int32 mode = 1; | |||
| int32 nan_opt = 2; | |||
| int32 pad_mode = 3; | |||
| bool global_pooling = 4; | |||
| repeated uint32 window = 10; | |||
| repeated uint32 pad = 11; | |||
| repeated uint32 stride = 12; | |||
| bool ceil_mode = 13; | |||
| int32 data_mode = 14; | |||
| float alpha = 20; | |||
| float beta = 21; | |||
| repeated uint32 before_pad = 22; | |||
| }; | |||
| message EltwiseOpParams { | |||
| int32 mode = 1; | |||
| repeated float coeff = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| repeated WeightDef weight = 5; | |||
| bool relu_flag = 6; | |||
| }; | |||
| message ActivationOpParams { | |||
| int32 mode = 1; | |||
| float coef = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| }; | |||
| message BatchNormOpParams { | |||
| int32 mode = 1; | |||
| float alpha = 2; | |||
| float beta = 3; | |||
| double epsilon = 4;//optinal,[default = 1e-5] | |||
| bool use_global_stats = 5; //optinal,by default true,testing mode | |||
| float moving_average_fraction = 6; //optinal,[default = .999]; | |||
| WeightDef estimated_mean = 7; | |||
| WeightDef estimated_variance = 8; | |||
| WeightDef scale = 9; | |||
| WeightDef bias = 10; | |||
| }; | |||
| message ScaleOpParams { | |||
| WeightDef scale = 1; | |||
| WeightDef bias = 2; | |||
| }; | |||
| message ReshapeOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| ShapeDef shape = 3; | |||
| int32 axis = 4; | |||
| int32 num_axes = 5; | |||
| int32 format = 6; | |||
| }; | |||
| message SoftmaxOpParams { | |||
| int32 algo = 1; | |||
| int32 mode = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| }; | |||
| message FullConnectionOpParams { | |||
| WeightDef filter = 1; | |||
| WeightDef bias = 2; | |||
| uint32 num_output = 3; | |||
| bool relu_flag = 12; | |||
| }; | |||
| message FlattenOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 start_axis = 3; | |||
| int32 end_axis = 4; | |||
| } | |||
| message AddLimitedOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 axis = 3; | |||
| bool broadcast = 4; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message MulLimitedOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 axis = 3; | |||
| bool broadcast = 4; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message AddOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message MulOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message SubOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message BiasAddOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| WeightDef bias = 10; | |||
| }; | |||
| message MatMulOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| bool transposeX = 3; | |||
| bool transposeW = 4; | |||
| WeightDef filter = 10; | |||
| WeightDef bias = 12; | |||
| }; | |||
| message RsqrtOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| }; | |||
| message WeightDef { | |||
| int32 format = 1; | |||
| int32 data_type = 2; | |||
| ShapeDef shape = 3; | |||
| bytes data = 4; | |||
| int64 data_offset = 5; | |||
| uint32 cmps_size = 6; | |||
| bytes cmps_tab = 7; | |||
| int64 cmps_tab_offset = 10; | |||
| CompressInfo cmps_info = 8; | |||
| AllOffsetQuantizeInfo alloffset_quantize_info = 11; | |||
| } | |||
| message ShapeDef { | |||
| repeated int64 dim = 1; | |||
| } | |||
| enum DeviceType { | |||
| NPU = 0; // In default, we will use NPU. | |||
| CPU = 1; // CPU | |||
| } | |||
| message AllOffsetQuantizeInfo { | |||
| float scale = 1; | |||
| int32 offset = 2; | |||
| } | |||
| message TensorDescriptor { | |||
| int32 format = 1; | |||
| int32 data_type = 2; | |||
| repeated int64 dim = 3; | |||
| uint32 size = 4; | |||
| bool reuse_input = 5; | |||
| bool output_tensor = 7; | |||
| DeviceType device_type = 8; | |||
| bool input_tensor = 9; | |||
| uint32 real_dim_cnt = 10; | |||
| uint32 reuse_input_index = 11; | |||
| AllOffsetQuantizeInfo alloffset_quantize_info = 12; | |||
| } | |||
| message CompressInfo { | |||
| int32 blockRow = 1; // block row | |||
| int32 blockCol = 2; // block col | |||
| int32 fractalK = 3; // fractal K | |||
| int32 fractalN = 4; // fractal N | |||
| int32 lastFractalK = 5; // K of last fractal | |||
| int32 lastFractalN = 6; // N of last fractal | |||
| int32 cubeSize = 7; // cube's length | |||
| int32 loadDir = 8; // data load directtiono 0:col load 1:row load | |||
| } | |||
| message AttrDef { | |||
| message ListValue { | |||
| repeated string s = 2; // "list(string)" | |||
| repeated int64 i = 3 [packed = true]; // "list(int)" | |||
| repeated float f = 4 [packed = true]; // "list(float)" | |||
| repeated bool b = 5 [packed = true]; // "list(bool)" | |||
| repeated uint32 u = 6 [packed = true]; // "list(uint)" | |||
| repeated bytes bt = 7; | |||
| } | |||
| oneof value { | |||
| string s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| uint32 u = 6; // "uint32" | |||
| bytes bt = 7; | |||
| ListValue list = 1; // any "list(...)" | |||
| NamedAttrs func = 10; | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NamedAttrs { | |||
| string name = 1; | |||
| map<string, AttrDef> attr = 2; | |||
| } | |||
| @@ -1,179 +0,0 @@ | |||
| /* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * Apache License for more details at | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| */ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| message ModelTaskDef { | |||
| string version = 1; | |||
| map<string, string> attr = 9; // Extended field | |||
| repeated TaskDef task = 10; | |||
| uint64 memory_size = 11; | |||
| uint32 stream_num = 12; | |||
| uint32 event_num = 13; | |||
| uint64 weight_size = 14; | |||
| repeated bytes op = 15; // input/output opdef in bytes | |||
| uint64 base_addr = 16; // base addr | |||
| uint64 weight_addr = 17; // weight addr | |||
| uint32 batch_num = 18; | |||
| } | |||
| message TaskDef { | |||
| uint32 id = 1; | |||
| uint32 type = 2; | |||
| uint32 stream_id = 10; | |||
| uint32 event_id = 11; | |||
| KernelDef kernel = 20; | |||
| KernelExDef kernel_ex = 21; | |||
| KernelHcclDef kernel_hccl = 25; | |||
| EventExDef event_ex = 26; | |||
| LogTimeStampDef log_timestamp = 28; | |||
| uint32 label_id = 30; | |||
| MemcpyAsyncDef memcpy_async = 31; | |||
| StreamSwitchDef stream_switch = 32; | |||
| StreamActiveDef stream_active = 33; | |||
| bytes private_def = 34; | |||
| uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future | |||
| StreamSwitchNDef stream_switch_n = 36; | |||
| LabelSetDef label_set = 37; | |||
| LabelGotoExDef label_goto_ex = 38; | |||
| LabelSwitchByIndexDef label_switch_by_index = 39; | |||
| KernelDefWithHandle kernel_with_handle = 40; | |||
| } | |||
| message KernelDef { | |||
| KernelContext context = 1; | |||
| string stub_func = 10; | |||
| uint32 block_dim = 11; | |||
| uint32 args_size = 12; | |||
| bytes args = 13; | |||
| bytes sm_desc = 14; | |||
| bytes flowtable = 15; | |||
| string so_name = 16; | |||
| string kernel_name = 17; | |||
| bytes kernel_ext_info = 18; | |||
| uint32 kernel_ext_info_size = 19; | |||
| } | |||
| message KernelDefWithHandle { | |||
| KernelContext context = 1; | |||
| uint64 handle = 10; | |||
| string dev_func = 11; | |||
| uint32 block_dim = 12; | |||
| uint32 args_size = 13; | |||
| bytes args = 14; | |||
| bytes sm_desc = 15; | |||
| string original_kernel_key = 16; | |||
| string node_info = 17; | |||
| } | |||
| message KernelContext { | |||
| uint32 kernel_type = 1; | |||
| uint32 op_id = 2; // OP type in CCE | |||
| uint32 kernel_func_id = 3; | |||
| uint32 op_index = 4; // TE/Custom operator | |||
| bool is_flowtable = 5; // Identify whether args is a flowtable structure | |||
| bytes args_offset = 6; // args offset information | |||
| uint32 args_count = 7; // args count | |||
| repeated uint32 origin_op_index = 8; | |||
| } | |||
| message KernelExDef { | |||
| uint32 flags = 1; | |||
| uint32 op_index = 4; | |||
| uint32 args_size = 12; | |||
| bytes args = 13; | |||
| bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput | |||
| uint32 task_info_size = 15; | |||
| bytes kernel_ext_info = 16; | |||
| uint32 kernel_ext_info_size = 17; | |||
| } | |||
| message KernelHcclDef { | |||
| uint32 op_index = 8; | |||
| string hccl_type = 9; | |||
| } | |||
| message EventExDef { | |||
| uint32 op_index = 1; | |||
| uint32 event_type = 2; | |||
| } | |||
| message LogTimeStampDef { | |||
| uint64 logid = 1; | |||
| bool notify = 2; | |||
| uint32 flat = 3; | |||
| } | |||
| message MemcpyAsyncDef { | |||
| uint64 dst = 1; | |||
| uint64 dst_max = 2; | |||
| uint64 src = 3; | |||
| uint64 count = 4; | |||
| uint32 kind = 5; | |||
| uint32 op_index = 6; | |||
| } | |||
| message StreamSwitchDef { | |||
| uint32 op_index = 1; | |||
| uint32 true_stream_id = 2; | |||
| int64 value = 3; | |||
| uint64 value_ptr = 4; | |||
| uint32 data_type = 5; | |||
| } | |||
| message StreamActiveDef { | |||
| uint32 op_index = 1; | |||
| uint32 active_stream_id = 2; | |||
| } | |||
| message StreamSwitchNDef { | |||
| uint32 op_index = 1; | |||
| uint32 size = 2; | |||
| repeated int64 target_value = 3; | |||
| repeated uint32 true_stream_id = 4; | |||
| uint32 element_size = 5; | |||
| uint32 data_type = 6; | |||
| } | |||
| message LabelSetDef { | |||
| uint32 op_index = 1; | |||
| uint32 label_id = 2; | |||
| uint32 model_id = 3; | |||
| } | |||
| message LabelGotoExDef { | |||
| uint32 op_index = 1; | |||
| uint32 label_id = 2; | |||
| uint32 model_id = 3; | |||
| } | |||
| message LabelSwitchByIndexDef { | |||
| uint32 op_index = 1; | |||
| uint32 label_max = 2; | |||
| } | |||
| @@ -1,62 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "AttrValueProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "tensor.proto"; | |||
| import "tensor_shape.proto"; | |||
| import "types.proto"; | |||
| // Protocol buffer representing the value for an attr used to configure an Op. | |||
| // Comment indicates the corresponding attr type. Only the field matching the | |||
| // attr type may be filled. | |||
| message AttrValue { | |||
| // LINT.IfChange | |||
| message ListValue { | |||
| repeated bytes s = 2; // "list(string)" | |||
| repeated int64 i = 3 [packed = true]; // "list(int)" | |||
| repeated float f = 4 [packed = true]; // "list(float)" | |||
| repeated bool b = 5 [packed = true]; // "list(bool)" | |||
| repeated DataType type = 6 [packed = true]; // "list(type)" | |||
| repeated TensorShapeProto shape = 7; // "list(shape)" | |||
| repeated TensorProto tensor = 8; // "list(tensor)" | |||
| repeated NameAttrList func = 9; // "list(attr)" | |||
| } | |||
| // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.cc) | |||
| oneof value { | |||
| bytes s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| DataType type = 6; // "type" | |||
| TensorShapeProto shape = 7; // "shape" | |||
| TensorProto tensor = 8; // "tensor" | |||
| ListValue list = 1; // any "list(...)" | |||
| // "func" represents a function. func.name is a function's name or | |||
| // a primitive op's name. func.attr.first is the name of an attr | |||
| // defined for that function. func.attr.second is the value for | |||
| // that attr in the instantiation. | |||
| NameAttrList func = 10; | |||
| // This is a placeholder only used in nodes defined inside a | |||
| // function. It indicates the attr value will be supplied when | |||
| // the function is instantiated. For example, let us suppose a | |||
| // node "N" in function "FN". "N" has an attr "A" with value | |||
| // placeholder = "foo". When FN is instantiated with attr "foo" | |||
| // set to "bar", the instantiated node N's attr A will have been | |||
| // given the value "bar". | |||
| string placeholder = 9; | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NameAttrList { | |||
| string name = 1; | |||
| map<string, AttrValue> attr = 2; | |||
| } | |||
| @@ -1,100 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "FunctionProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| import "node_def.proto"; | |||
| import "op_def.proto"; | |||
| // A library is a set of named functions. | |||
| message FunctionDefLibrary { | |||
| repeated FunctionDef function = 1; | |||
| repeated GradientDef gradient = 2; | |||
| } | |||
| // A function can be instantiated when the runtime can bind every attr | |||
| // with a value. When a GraphDef has a call to a function, it must | |||
| // have binding for every attr defined in the signature. | |||
| // * device spec, etc. | |||
| message FunctionDef { | |||
| // The definition of the function's name, arguments, return values, | |||
| // attrs etc. | |||
| OpDef signature = 1; | |||
| // Attributes specific to this function definition. | |||
| map<string, AttrValue> attr = 5; | |||
| // NOTE: field id 2 deleted on Jan 11, 2017, GraphDef version 21. | |||
| reserved 2; | |||
| // In both of the following fields, there is the need to specify an | |||
| // output that is used as either the input to another node (in | |||
| // `node_def`) or as a return value of the function (in `ret`). | |||
| // Unlike the NodeDefs in GraphDef, we need to be able to specify a | |||
| // list in some cases (instead of just single outputs). Also, we | |||
| // need to be able to deal with lists of unknown length (so the | |||
| // output index may not be known at function definition time). So | |||
| // we use the following format instead: | |||
| // * "fun_in" where "fun_in" is the name of a function input arg in | |||
| // the `signature` field above. This represents that input, whether | |||
| // it is a single tensor or a list. | |||
| // * "fun_in:0" gives the first element of a function input arg (a | |||
| // non-list input is considered a list of length 1 for these | |||
| // purposes). | |||
| // * "node:out" where "node" is the name of a node in `node_def` and | |||
| // "out" is the name one of its op's output arguments (the name | |||
| // comes from the OpDef of the node's op). This represents that | |||
| // node's output, whether it is a single tensor or a list. | |||
| // Note: We enforce that an op's output arguments are never | |||
| // renamed in the backwards-compatibility test. | |||
| // * "node:out:0" gives the first element of a node output arg (a | |||
| // non-list output is considered a list of length 1 for these | |||
| // purposes). | |||
| // | |||
| // NOT CURRENTLY SUPPORTED (but may be in the future): | |||
| // * "node:out:-1" gives last element in a node output list | |||
| // * "node:out:1:" gives a list with all but the first element in a | |||
| // node output list | |||
| // * "node:out::-1" gives a list with all but the last element in a | |||
| // node output list | |||
| // The body of the function. Unlike the NodeDefs in a GraphDef, attrs | |||
| // may have values of type `placeholder` and the `input` field uses | |||
| // the "output" format above. | |||
| // By convention, "op" in node_def is resolved by consulting with a | |||
| // user-defined library first. If not resolved, "func" is assumed to | |||
| // be a builtin op. | |||
| repeated NodeDef node_def = 3; | |||
| // A mapping from the output arg names from `signature` to the | |||
| // outputs from `node_def` that should be returned by the function. | |||
| map<string, string> ret = 4; | |||
| } | |||
| // GradientDef defines the gradient function of a function defined in | |||
| // a function library. | |||
| // | |||
| // A gradient function g (specified by gradient_func) for a function f | |||
| // (specified by function_name) must follow the following: | |||
| // | |||
| // The function 'f' must be a numerical function which takes N inputs | |||
| // and produces M outputs. Its gradient function 'g', which is a | |||
| // function taking N + M inputs and produces N outputs. | |||
| // | |||
| // I.e. if we have | |||
| // (y1, y2, ..., y_M) = f(x1, x2, ..., x_N), | |||
| // then, g is | |||
| // (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N, | |||
| // dL/dy1, dL/dy2, ..., dL/dy_M), | |||
| // where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the | |||
| // loss function). dL/dx_i is the partial derivative of L with respect | |||
| // to x_i. | |||
| message GradientDef { | |||
| string function_name = 1; // The function name. | |||
| string gradient_func = 2; // The gradient function's name. | |||
| } | |||
| @@ -1,56 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "GraphProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "node_def.proto"; | |||
| import "function.proto"; | |||
| import "versions.proto"; | |||
| // Represents the graph of operations | |||
| message GraphDef { | |||
| repeated NodeDef node = 1; | |||
| // Compatibility versions of the graph. See core/public/version.h for version | |||
| // history. The GraphDef version is distinct from the TensorFlow version, and | |||
| // each release of TensorFlow will support a range of GraphDef versions. | |||
| VersionDef versions = 4; | |||
| // Deprecated single version field; use versions above instead. Since all | |||
| // GraphDef changes before "versions" was introduced were forward | |||
| // compatible, this field is entirely ignored. | |||
| int32 version = 3 [deprecated = true]; | |||
| // EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET. | |||
| // | |||
| // "library" provides user-defined functions. | |||
| // | |||
| // Naming: | |||
| // * library.function.name are in a flat namespace. | |||
| // NOTE: We may need to change it to be hierarchical to support | |||
| // different orgs. E.g., | |||
| // { "/google/nn", { ... }}, | |||
| // { "/google/vision", { ... }} | |||
| // { "/org_foo/module_bar", { ... }} | |||
| // map<string, FunctionDefLib> named_lib; | |||
| // * If node[i].op is the name of one function in "library", | |||
| // node[i] is deemed as a function call. Otherwise, node[i].op | |||
| // must be a primitive operation supported by the runtime. | |||
| // | |||
| // | |||
| // Function call semantics: | |||
| // | |||
| // * The callee may start execution as soon as some of its inputs | |||
| // are ready. The caller may want to use Tuple() mechanism to | |||
| // ensure all inputs are ready in the same time. | |||
| // | |||
| // * The consumer of return values may start executing as soon as | |||
| // the return values the consumer depends on are ready. The | |||
| // consumer may want to use Tuple() mechanism to ensure the | |||
| // consumer does not start until all return values of the callee | |||
| // function are ready. | |||
| FunctionDefLibrary library = 2; | |||
| }; | |||
| @@ -1,14 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| import "graph.proto"; | |||
| message GeGraphDef { | |||
| string name = 1; | |||
| GraphDef graph = 2; | |||
| } | |||
| message GraphDefLibrary { | |||
| repeated GeGraphDef graph_def = 1; | |||
| }; | |||
| @@ -1,63 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "NodeProto"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| message NodeDef { | |||
| // The name given to this operator. Used for naming inputs, | |||
| // logging, visualization, etc. Unique within a single GraphDef. | |||
| // Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_./]*". | |||
| string name = 1; | |||
| // The operation name. There may be custom parameters in attrs. | |||
| // Op names starting with an underscore are reserved for internal use. | |||
| string op = 2; | |||
| // Each input is "node:src_output" with "node" being a string name and | |||
| // "src_output" indicating which output tensor to use from "node". If | |||
| // "src_output" is 0 the ":0" suffix can be omitted. Regular inputs | |||
| // may optionally be followed by control inputs that have the format | |||
| // "^node". | |||
| repeated string input = 3; | |||
| // A (possibly partial) specification for the device on which this | |||
| // node should be placed. | |||
| // The expected syntax for this string is as follows: | |||
| // | |||
| // DEVICE_SPEC ::= PARTIAL_SPEC | |||
| // | |||
| // PARTIAL_SPEC ::= ("/" CONSTRAINT) * | |||
| // CONSTRAINT ::= ("job:" JOB_NAME) | |||
| // | ("replica:" [1-9][0-9]*) | |||
| // | ("task:" [1-9][0-9]*) | |||
| // | ("device:" [A-Za-z]* ":" ([1-9][0-9]* | "*") ) | |||
| // | |||
| // Valid values for this string include: | |||
| // * "/job:worker/replica:0/task:1/device:GPU:3" (full specification) | |||
| // * "/job:worker/device:GPU:3" (partial specification) | |||
| // * "" (no specification) | |||
| // | |||
| // If the constraints do not resolve to a single device (or if this | |||
| // field is empty or not present), the runtime will attempt to | |||
| // choose a device automatically. | |||
| string device = 4; | |||
| // Operation-specific graph-construction-time configuration. | |||
| // Note that this should include all attrs defined in the | |||
| // corresponding OpDef, including those with a value matching | |||
| // the default -- this allows the default to change and makes | |||
| // NodeDefs easier to interpret on their own. However, if | |||
| // an attr with a default is not specified in this list, the | |||
| // default will be used. | |||
| // The "names" (keys) must match the regexp "[a-z][a-z0-9_]+" (and | |||
| // one of the names from the corresponding OpDef's attr field). | |||
| // The values must have a type matching the corresponding OpDef | |||
| // attr's type field. | |||
| // Add some examples here showing best practices. | |||
| map<string, AttrValue> attr = 5; | |||
| }; | |||
| @@ -1,164 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "OpDefProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| import "types.proto"; | |||
| // Defines an operation. A NodeDef in a GraphDef specifies an Op by | |||
| // using the "op" field which should match the name of a OpDef. | |||
| // LINT.IfChange | |||
| message OpDef { | |||
| // Op names starting with an underscore are reserved for internal use. | |||
| // Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9_]*". | |||
| string name = 1; | |||
| // For describing inputs and outputs. | |||
| message ArgDef { | |||
| // Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*". | |||
| string name = 1; | |||
| // Human readable description. | |||
| string description = 2; | |||
| // Describes the type of one or more tensors that are accepted/produced | |||
| // by this input/output arg. The only legal combinations are: | |||
| // * For a single tensor: either the "type" field is set or the | |||
| // "type_attr" field is set to the name of an attr with type "type". | |||
| // * For a sequence of tensors with the same type: the "number_attr" | |||
| // field will be set to the name of an attr with type "int", and | |||
| // either the "type" or "type_attr" field will be set as for | |||
| // single tensors. | |||
| // * For a sequence of tensors, the "type_list_attr" field will be set | |||
| // to the name of an attr with type "list(type)". | |||
| DataType type = 3; | |||
| string type_attr = 4; // if specified, attr must have type "type" | |||
| string number_attr = 5; // if specified, attr must have type "int" | |||
| // If specified, attr must have type "list(type)", and none of | |||
| // type, type_attr, and number_attr may be specified. | |||
| string type_list_attr = 6; | |||
| // For inputs: if true, the inputs are required to be refs. | |||
| // By default, inputs can be either refs or non-refs. | |||
| // For outputs: if true, outputs are refs, otherwise they are not. | |||
| bool is_ref = 16; | |||
| }; | |||
| // Description of the input(s). | |||
| repeated ArgDef input_arg = 2; | |||
| // Description of the output(s). | |||
| repeated ArgDef output_arg = 3; | |||
| // Description of the graph-construction-time configuration of this | |||
| // Op. That is to say, this describes the attr fields that will | |||
| // be specified in the NodeDef. | |||
| message AttrDef { | |||
| // A descriptive name for the argument. May be used, e.g. by the | |||
| // Python client, as a keyword argument name, and so should match | |||
| // the regexp "[a-z][a-z0-9_]+". | |||
| string name = 1; | |||
| // One of the type names from attr_value.proto ("string", "list(string)", | |||
| // "int", etc.). | |||
| string type = 2; | |||
| // A reasonable default for this attribute if the user does not supply | |||
| // a value. If not specified, the user must supply a value. | |||
| AttrValue default_value = 3; | |||
| // Human-readable description. | |||
| string description = 4; | |||
| // --- Constraints --- | |||
| // These constraints are only in effect if specified. Default is no | |||
| // constraints. | |||
| // For type == "int", this is a minimum value. For "list(___)" | |||
| // types, this is the minimum length. | |||
| bool has_minimum = 5; | |||
| int64 minimum = 6; | |||
| // The set of allowed values. Has type that is the "list" version | |||
| // of the "type" field above (uses the "list" field of AttrValue). | |||
| // If type == "type" or "list(type)" above, then the "type" field | |||
| // of "allowed_values.list" has the set of allowed DataTypes. | |||
| // If type == "string" or "list(string)", then the "s" field of | |||
| // "allowed_values.list" has the set of allowed strings. | |||
| AttrValue allowed_values = 7; | |||
| } | |||
| repeated AttrDef attr = 4; | |||
| // Optional deprecation based on GraphDef versions. | |||
| OpDeprecation deprecation = 8; | |||
| // One-line human-readable description of what the Op does. | |||
| string summary = 5; | |||
| // Additional, longer human-readable description of what the Op does. | |||
| string description = 6; | |||
| // ------------------------------------------------------------------------- | |||
| // Which optimizations this operation can participate in. | |||
| // True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs) | |||
| bool is_commutative = 18; | |||
| // If is_aggregate is true, then this operation accepts N >= 2 | |||
| // inputs and produces 1 output all of the same type. Should be | |||
| // associative and commutative, and produce output with the same | |||
| // shape as the input. The optimizer may replace an aggregate op | |||
| // taking input from multiple devices with a tree of aggregate ops | |||
| // that aggregate locally within each device (and possibly within | |||
| // groups of nearby devices) before communicating. | |||
| bool is_aggregate = 16; // for things like add | |||
| // Other optimizations go here, like | |||
| // can_alias_input, rewrite_when_output_unused, partitioning_strategy, etc. | |||
| // ------------------------------------------------------------------------- | |||
| // Optimization constraints. | |||
| // Ops are marked as stateful if their behavior depends on some state beyond | |||
| // their input tensors (e.g. variable reading op) or if they have | |||
| // a side-effect (e.g. printing or asserting ops). Equivalently, stateless ops | |||
| // must always produce the same output for the same input and have | |||
| // no side-effects. | |||
| // | |||
| // By default Ops may be moved between devices. Stateful ops should | |||
| // either not be moved, or should only be moved if that state can also | |||
| // be moved (e.g. via some sort of save / restore). | |||
| // Stateful ops are guaranteed to never be optimized away by Common | |||
| // Subexpression Elimination (CSE). | |||
| bool is_stateful = 17; // for things like variables, queue | |||
| // ------------------------------------------------------------------------- | |||
| // Non-standard options. | |||
| // By default, all inputs to an Op must be initialized Tensors. Ops | |||
| // that may initialize tensors for the first time should set this | |||
| // field to true, to allow the Op to take an uninitialized Tensor as | |||
| // input. | |||
| bool allows_uninitialized_input = 19; // for Assign, etc. | |||
| }; | |||
| // LINT.ThenChange( | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/op_def_util.cc) | |||
| // Information about version-dependent deprecation of an op | |||
| message OpDeprecation { | |||
| // First GraphDef version at which the op is disallowed. | |||
| int32 version = 1; | |||
| // Explanation of why it was deprecated and what to use instead. | |||
| string explanation = 2; | |||
| }; | |||
| // A collection of OpDefs | |||
| message OpList { | |||
| repeated OpDef op = 1; | |||
| }; | |||
| @@ -1,29 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "ResourceHandle"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // Protocol buffer representing a handle to a tensorflow resource. Handles are | |||
| // not valid across executions, but can be serialized back and forth from within | |||
| // a single run. | |||
| message ResourceHandleProto { | |||
| // Unique name for the device containing the resource. | |||
| string device = 1; | |||
| // Container in which this resource is placed. | |||
| string container = 2; | |||
| // Unique name of this resource. | |||
| string name = 3; | |||
| // Hash code for the type of the resource. Is only valid in the same device | |||
| // and in the same execution. | |||
| uint64 hash_code = 4; | |||
| // For debug-only, the name of the type pointed to by this handle, if | |||
| // available. | |||
| string maybe_type_name = 5; | |||
| }; | |||
| @@ -1,94 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TensorProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "resource_handle.proto"; | |||
| import "tensor_shape.proto"; | |||
| import "types.proto"; | |||
| // Protocol buffer representing a tensor. | |||
| message TensorProto { | |||
| DataType dtype = 1; | |||
| // Shape of the tensor. | |||
| TensorShapeProto tensor_shape = 2; | |||
| // Only one of the representations below is set, one of "tensor_contents" and | |||
| // the "xxx_val" attributes. We are not using oneof because as oneofs cannot | |||
| // contain repeated fields it would require another extra set of messages. | |||
| // Version number. | |||
| // | |||
| // In version 0, if the "repeated xxx" representations contain only one | |||
| // element, that element is repeated to fill the shape. This makes it easy | |||
| // to represent a constant Tensor with a single value. | |||
| int32 version_number = 3; | |||
| // Serialized raw tensor content from either Tensor::AsProtoTensorContent or | |||
| // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation | |||
| // can be used for all tensor types. The purpose of this representation is to | |||
| // reduce serialization overhead during RPC call by avoiding serialization of | |||
| // many repeated small items. | |||
| bytes tensor_content = 4; | |||
| // Type specific representations that make it easy to create tensor protos in | |||
| // all languages. Only the representation corresponding to "dtype" can | |||
| // be set. The values hold the flattened representation of the tensor in | |||
| // row major order. | |||
| // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll | |||
| // have some pointless zero padding for each value here. | |||
| repeated int32 half_val = 13 [packed = true]; | |||
| // DT_FLOAT. | |||
| repeated float float_val = 5 [packed = true]; | |||
| // DT_DOUBLE. | |||
| repeated double double_val = 6 [packed = true]; | |||
| // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. | |||
| repeated int32 int_val = 7 [packed = true]; | |||
| // DT_STRING | |||
| repeated bytes string_val = 8; | |||
| // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real | |||
| // and imaginary parts of i-th single precision complex. | |||
| repeated float scomplex_val = 9 [packed = true]; | |||
| // DT_INT64 | |||
| repeated int64 int64_val = 10 [packed = true]; | |||
| // DT_BOOL | |||
| repeated bool bool_val = 11 [packed = true]; | |||
| // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real | |||
| // and imaginary parts of i-th double precision complex. | |||
| repeated double dcomplex_val = 12 [packed = true]; | |||
| // DT_RESOURCE | |||
| repeated ResourceHandleProto resource_handle_val = 14; | |||
| // DT_VARIANT | |||
| repeated VariantTensorDataProto variant_val = 15; | |||
| // DT_UINT32 | |||
| repeated uint32 uint32_val = 16 [packed = true]; | |||
| // DT_UINT64 | |||
| repeated uint64 uint64_val = 17 [packed = true]; | |||
| }; | |||
| // Protocol buffer representing the serialization format of DT_VARIANT tensors. | |||
| message VariantTensorDataProto { | |||
| // Name of the type of objects being serialized. | |||
| string type_name = 1; | |||
| // Portions of the object that are not Tensors. | |||
| bytes metadata = 2; | |||
| // Tensors contained within objects being serialized. | |||
| repeated TensorProto tensors = 3; | |||
| } | |||
| @@ -1,45 +0,0 @@ | |||
| // Protocol buffer representing the shape of tensors. | |||
| syntax = "proto3"; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TensorShapeProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| package domi.tensorflow; | |||
| // Dimensions of a tensor. | |||
| message TensorShapeProto { | |||
| // One dimension of the tensor. | |||
| message Dim { | |||
| // Size of the tensor in that dimension. | |||
| // This value must be >= -1, but values of -1 are reserved for "unknown" | |||
| // shapes (values of -1 mean "unknown" dimension). Certain wrappers | |||
| // that work with TensorShapeProto may fail at runtime when deserializing | |||
| // a TensorShapeProto containing a dim value of -1. | |||
| int64 size = 1; | |||
| // Optional name of the tensor dimension. | |||
| string name = 2; | |||
| }; | |||
| // Dimensions of the tensor, such as {"input", 30}, {"output", 40} | |||
| // for a 30 x 40 2D tensor. If an entry has size -1, this | |||
| // corresponds to a dimension of unknown size. The names are | |||
| // optional. | |||
| // | |||
| // The order of entries in "dim" matters: It indicates the layout of the | |||
| // values in the tensor in-memory representation. | |||
| // | |||
| // The first entry in "dim" is the outermost dimension used to layout the | |||
| // values, the last entry is the innermost dimension. This matches the | |||
| // in-memory layout of RowMajor Eigen tensors. | |||
| // | |||
| // If "dim.size()" > 0, "unknown_rank" must be false. | |||
| repeated Dim dim = 2; | |||
| // If true, the number of dimensions in the shape is unknown. | |||
| // | |||
| // If true, "dim.size()" must be 0. | |||
| bool unknown_rank = 3; | |||
| }; | |||
| @@ -1,74 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TypesProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // LINT.IfChange | |||
| enum DataType { | |||
| // Not a legal value for DataType. Used to indicate a DataType field | |||
| // has not been set. | |||
| DT_INVALID = 0; | |||
| // Data types that all computation devices are expected to be | |||
| // capable to support. | |||
| DT_FLOAT = 1; | |||
| DT_DOUBLE = 2; | |||
| DT_INT32 = 3; | |||
| DT_UINT8 = 4; | |||
| DT_INT16 = 5; | |||
| DT_INT8 = 6; | |||
| DT_STRING = 7; | |||
| DT_COMPLEX64 = 8; // Single-precision complex | |||
| DT_INT64 = 9; | |||
| DT_BOOL = 10; | |||
| DT_QINT8 = 11; // Quantized int8 | |||
| DT_QUINT8 = 12; // Quantized uint8 | |||
| DT_QINT32 = 13; // Quantized int32 | |||
| DT_BFLOAT16 = 14; // Float32 truncated to 16 bits. Only for cast ops. | |||
| DT_QINT16 = 15; // Quantized int16 | |||
| DT_QUINT16 = 16; // Quantized uint16 | |||
| DT_UINT16 = 17; | |||
| DT_COMPLEX128 = 18; // Double-precision complex | |||
| DT_HALF = 19; | |||
| DT_RESOURCE = 20; | |||
| DT_VARIANT = 21; // Arbitrary C++ data types | |||
| DT_UINT32 = 22; | |||
| DT_UINT64 = 23; | |||
| // Do not use! These are only for parameters. Every enum above | |||
| // should have a corresponding value below (verified by types_test). | |||
| DT_FLOAT_REF = 101; | |||
| DT_DOUBLE_REF = 102; | |||
| DT_INT32_REF = 103; | |||
| DT_UINT8_REF = 104; | |||
| DT_INT16_REF = 105; | |||
| DT_INT8_REF = 106; | |||
| DT_STRING_REF = 107; | |||
| DT_COMPLEX64_REF = 108; | |||
| DT_INT64_REF = 109; | |||
| DT_BOOL_REF = 110; | |||
| DT_QINT8_REF = 111; | |||
| DT_QUINT8_REF = 112; | |||
| DT_QINT32_REF = 113; | |||
| DT_BFLOAT16_REF = 114; | |||
| DT_QINT16_REF = 115; | |||
| DT_QUINT16_REF = 116; | |||
| DT_UINT16_REF = 117; | |||
| DT_COMPLEX128_REF = 118; | |||
| DT_HALF_REF = 119; | |||
| DT_RESOURCE_REF = 120; | |||
| DT_VARIANT_REF = 121; | |||
| DT_UINT32_REF = 122; | |||
| DT_UINT64_REF = 123; | |||
| } | |||
| // LINT.ThenChange( | |||
| // https://www.tensorflow.org/code/tensorflow/c/c_api.h, | |||
| // https://www.tensorflow.org/code/tensorflow/go/tensor.go, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/types.h, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/types.cc, | |||
| // https://www.tensorflow.org/code/tensorflow/python/framework/dtypes.py, | |||
| // https://www.tensorflow.org/code/tensorflow/python/framework/function.py) | |||
| @@ -1,31 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "VersionsProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // Version information for a piece of serialized data | |||
| // | |||
| // There are different types of versions for each type of data | |||
| // (GraphDef, etc.), but they all have the same common shape | |||
| // described here. | |||
| // | |||
| // Each consumer has "consumer" and "min_producer" versions (specified | |||
| // elsewhere). A consumer is allowed to consume this data if | |||
| // | |||
| // producer >= min_producer | |||
| // consumer >= min_consumer | |||
| // consumer not in bad_consumers | |||
| // | |||
| message VersionDef { | |||
| // The version of the code that produced this data. | |||
| int32 producer = 1; | |||
| // Any consumer below this version is not allowed to consume this data. | |||
| int32 min_consumer = 2; | |||
| // Specific consumer versions which are disallowed (e.g. due to bugs). | |||
| repeated int32 bad_consumers = 3; | |||
| }; | |||
| @@ -1,193 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package ge.proto; | |||
| enum DataType | |||
| { | |||
| DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set. | |||
| DT_FLOAT = 1; // float type | |||
| DT_FLOAT16 = 2; // fp16 type | |||
| DT_INT8 = 3; // int8 type | |||
| DT_UINT8 = 4; // uint8 type | |||
| DT_INT16 = 5; // int16 type | |||
| DT_UINT16 = 6; // uint16 type | |||
| DT_INT32 = 7; // | |||
| DT_INT64 = 8; // int64 type | |||
| DT_UINT32 = 9; // unsigned int32 | |||
| DT_UINT64 = 10; // unsigned int64 | |||
| DT_BOOL = 11; // bool type | |||
| DT_DOUBLE = 12; // double type | |||
| DT_STRING = 13; // string type | |||
| DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */ | |||
| DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */ | |||
| DT_COMPLEX64 = 16; // complex64 type | |||
| DT_COMPLEX128 = 17; // complex128 type | |||
| DT_QINT8 = 18; // qint8 type | |||
| DT_QINT16 = 19; // qint16 type | |||
| DT_QINT32 = 20; // qint32 type | |||
| DT_QUINT8 = 21; // quint8 type | |||
| DT_QUINT16 = 22; // quint16 type | |||
| DT_RESOURCE = 23; // resource type | |||
| DT_STRING_REF = 24; // string_ref type | |||
| DT_DUAL = 25; /**< dual output type */ | |||
| DT_VARIANT = 26; // variant type | |||
| DT_BF16 = 27; // bf16 type | |||
| DT_INT4 = 28; // int4 type | |||
| } | |||
| message AttrDef | |||
| { | |||
| message ListValue | |||
| { | |||
| enum ListValueType{ | |||
| VT_LIST_NONE = 0; | |||
| VT_LIST_STRING = 1; | |||
| VT_LIST_INT = 2; | |||
| VT_LIST_FLOAT = 3; | |||
| VT_LIST_BOOL = 4; | |||
| VT_LIST_BYTES = 5; | |||
| VT_LIST_TENSOR_DESC = 6; | |||
| VT_LIST_TENSOR = 7; | |||
| VT_LIST_GRAPH = 8; | |||
| VT_LIST_NAMED_ATTRS = 9; | |||
| VT_LIST_DATA_TYPE = 10; | |||
| } | |||
| repeated bytes s = 2; // "list(string)" | |||
| repeated int64 i = 3; // "list(int)" | |||
| repeated float f = 4; // "list(float)" | |||
| repeated bool b = 5; // "list(bool)" | |||
| repeated bytes bt = 7; | |||
| repeated TensorDescriptor td = 8; | |||
| repeated TensorDef t = 9; | |||
| repeated GraphDef g = 10; | |||
| repeated NamedAttrs na = 11; | |||
| repeated int64 dt = 12; // list ge::DataType | |||
| ListValueType val_type = 20; | |||
| } | |||
| message ListListInt{ | |||
| message ListInt{ | |||
| repeated int64 list_i = 1; // list int | |||
| } | |||
| repeated ListInt list_list_i = 1; // list list int | |||
| } | |||
| oneof value | |||
| { | |||
| bytes s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| bytes bt = 7; | |||
| ListValue list = 1; // any "list(...)" | |||
| NamedAttrs func = 10; // Used to support attr nesting | |||
| TensorDescriptor td = 11; // GeTensorDesc type | |||
| TensorDef t = 12; // GeTensor type | |||
| GraphDef g = 13; // Graph type | |||
| ListListInt list_list_int = 14; // List List Int type | |||
| int64 dt = 15; // ge::DataType | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NamedAttrs | |||
| { | |||
| string name = 1; | |||
| map<string, AttrDef> attr = 2; | |||
| } | |||
| // Shape / dimension description, using row-major order | |||
| message ShapeDef | |||
| { | |||
| repeated int64 dim = 1; // Size of each dimension | |||
| } | |||
| // Multidimensional data description | |||
| message TensorDescriptor | |||
| { | |||
| string name = 1; // Optional parameter, tensor name | |||
| DataType dtype = 2; // tensor datatype | |||
| ShapeDef shape = 3; // Shape / dimension | |||
| string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND" | |||
| bool has_out_attr = 9; | |||
| int64 size = 10; | |||
| int64 weight_size = 11; | |||
| bool reuse_input = 12; | |||
| bool output_tensor = 13; | |||
| string device_type = 14; | |||
| bool input_tensor =15; | |||
| int64 real_dim_cnt = 16; | |||
| int64 reuse_input_index = 17; | |||
| int64 data_offset = 18; | |||
| int64 cmps_size = 19; | |||
| string cmps_tab = 20; | |||
| int64 cmps_tab_offset = 21; | |||
| map<string, AttrDef> attr = 5; // Set of extra parameter fields | |||
| } | |||
| // GeTensor definition | |||
| message TensorDef | |||
| { | |||
| TensorDescriptor desc = 1; // Tensor description | |||
| bytes data = 2; // Tensor data | |||
| } | |||
| // Operator description | |||
| message OpDef | |||
| { | |||
| string name = 1; // name | |||
| string type = 2; // type | |||
| repeated string input = 5; // input original op name + outgoing index. op_name:index | |||
| map<string, AttrDef> attr = 10; // Set of operator parameter fields | |||
| bool has_out_attr = 20; | |||
| int64 id = 21; | |||
| int64 stream_id =22; | |||
| repeated string input_name = 23; | |||
| repeated string src_name = 24; | |||
| repeated int64 src_index = 25; | |||
| repeated string dst_name = 26; | |||
| repeated int64 dst_index = 27; | |||
| repeated int64 input_i = 28; | |||
| repeated int64 output_i = 29; | |||
| repeated int64 workspace = 30; | |||
| repeated int64 workspace_bytes = 31; | |||
| repeated bool is_input_const = 32; | |||
| repeated TensorDescriptor input_desc = 33; | |||
| repeated TensorDescriptor output_desc = 34; | |||
| repeated string subgraph_name = 35; | |||
| } | |||
| // Graph definition | |||
| message GraphDef | |||
| { | |||
| string name = 1; // name | |||
| repeated string input = 4; // Graph input | |||
| repeated string output = 5; // Graph output | |||
| repeated OpDef op = 6; // List of operators | |||
| map<string, AttrDef> attr = 11; // Extended field | |||
| } | |||
| // model definition | |||
| message ModelDef | |||
| { | |||
| string name = 1; // name | |||
| uint32 version = 2; // IR Proto verion | |||
| string custom_version = 3; // User model version number, passed in by user | |||
| repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef | |||
| map<string, AttrDef> attr = 11; // Extended field | |||
| } | |||
| @@ -1,140 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| message InsertNewOps { | |||
| repeated AippOpParams aipp_op = 1; | |||
| repeated MultiShapeOpParams multi_shape_op = 2; | |||
| } | |||
| message AippOpParams { | |||
| enum InputFormat { | |||
| UNDEFINED = 0; | |||
| YUV420SP_U8 = 1; | |||
| XRGB8888_U8 = 2; | |||
| RGB888_U8 = 3; | |||
| YUV400_U8 = 4; | |||
| NC1HWC0DI_FP16 = 5; | |||
| NC1HWC0DI_S8 = 6; | |||
| ARGB8888_U8 = 7; | |||
| YUYV_U8 = 8; | |||
| YUV422SP_U8 = 9; | |||
| AYUV444_U8 = 10; | |||
| RAW10 = 11; | |||
| RAW12 = 12; | |||
| RAW16 = 13; | |||
| RAW24 = 14; | |||
| RGB16 = 15; | |||
| RGB20 = 16; | |||
| RGB24 = 17; | |||
| RGB8_IR = 18; | |||
| RGB16_IR = 19; | |||
| RGB24_IR = 20; | |||
| } | |||
| enum AippMode { | |||
| undefined = 0; | |||
| static = 1; | |||
| dynamic = 2; | |||
| } | |||
| // AIPP模式,区分静态AIPP和动态AIPP | |||
| AippMode aipp_mode = 1; | |||
| // related_input_rank参数为必填,类型为整型,配置范围>=0, <=输入Data算子的个数,默认值为0。 | |||
| // 标识对模型的第几个输入做AIPP处理,例如模型有两个输入,需要对第2个输入做AIPP,则配置related_input_rank为1。 | |||
| uint32 related_input_rank = 2; | |||
| // related_input_name is optional and the top name of data node which inserts aipp | |||
| string related_input_name = 6; | |||
| // input_edge_idx参数为可选,类型为整型,配置范围为>=0。 | |||
| // 配置该参数的作用,在于对Data算子不同的输出做不同的AIPP处理,如果该参数没有配置,默认对related_input_rank指定的模型输入的所有输出边做AIPP。 | |||
| // 配置值 <= Data算子输出边的个数。 | |||
| repeated uint32 input_edge_idx = 3; | |||
| // [Begin] 动态AIPP参数,配置静态AIPP时无效 | |||
| uint32 max_src_image_size = 4; | |||
| // 是否支持旋转。默认不支持,开启支持旋转时,会有额外的空间和性能损失 | |||
| bool support_rotation = 5; | |||
| // [End] 动态AIPP参数 | |||
| // [Begin] 静态AIPP参数,配置动态AIPP时无效 | |||
| InputFormat input_format = 51; | |||
| bool csc_switch = 52; | |||
| float cpadding_value = 53; | |||
| bool rbuv_swap_switch = 54; | |||
| bool ax_swap_switch = 55; | |||
| bool single_line_mode = 56; | |||
| int32 src_image_size_w = 57; | |||
| int32 src_image_size_h = 58; | |||
| bool crop = 59; | |||
| int32 load_start_pos_w = 60; | |||
| int32 load_start_pos_h = 61; | |||
| int32 crop_size_w = 62; | |||
| int32 crop_size_h = 63; | |||
| bool resize = 64; | |||
| int32 resize_output_w = 65; | |||
| int32 resize_output_h = 66; | |||
| bool padding = 67; | |||
| int32 left_padding_size = 68; | |||
| int32 right_padding_size = 69; | |||
| int32 top_padding_size = 70; | |||
| int32 bottom_padding_size = 71; | |||
| float padding_value = 72; | |||
| int32 mean_chn_0 = 10; | |||
| int32 mean_chn_1 = 11; | |||
| int32 mean_chn_2 = 12; | |||
| int32 mean_chn_3 = 19; | |||
| float min_chn_0 = 13; | |||
| float min_chn_1 = 14; | |||
| float min_chn_2 = 15; | |||
| float min_chn_3 = 20; | |||
| repeated float var_reci_chn_0 = 16; | |||
| repeated float var_reci_chn_1 = 17; | |||
| repeated float var_reci_chn_2 = 18; | |||
| repeated float var_reci_chn_3 = 21; | |||
| repeated int32 matrix_r0c0 = 30; | |||
| repeated int32 matrix_r0c1 = 31; | |||
| repeated int32 matrix_r0c2 = 32; | |||
| repeated int32 matrix_r1c0 = 33; | |||
| repeated int32 matrix_r1c1 = 34; | |||
| repeated int32 matrix_r1c2 = 35; | |||
| repeated int32 matrix_r2c0 = 36; | |||
| repeated int32 matrix_r2c1 = 37; | |||
| repeated int32 matrix_r2c2 = 38; | |||
| repeated int32 output_bias_0 = 39; | |||
| repeated int32 output_bias_1 = 40; | |||
| repeated int32 output_bias_2 = 41; | |||
| repeated int32 input_bias_0 = 42; | |||
| repeated int32 input_bias_1 = 43; | |||
| repeated int32 input_bias_2 = 44; | |||
| // [End] 静态AIPP参数 | |||
| // The n number that is used for raw/rgbir data into f16 transformation. | |||
| // The transformation equation is x/(2^n). If set to 0, no transform is performed. | |||
| uint32 raw_rgbir_to_f16_n = 45; | |||
| } | |||
| message MultiShapeOpParams { | |||
| enum MultiShapeMode { | |||
| batch = 0; //动态batch | |||
| resolution = 1; //动态分辨率,扩展用 | |||
| } | |||
| MultiShapeMode mode = 1; //算子模式 | |||
| uint32 related_input_rank = 2; //新增算子插入到哪个输入 | |||
| repeated uint32 batch_list = 11; //batch_list值,batch_list的个数是2到8之间 | |||
| } | |||
| @@ -1,396 +0,0 @@ | |||
| /* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * Apache License for more details at | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| */ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| enum TargetType | |||
| { | |||
| MINI = 0; | |||
| TINY = 1; | |||
| LITE = 2; | |||
| } | |||
| // offline model | |||
| message ModelDef { | |||
| string name = 1; | |||
| uint32 version = 2; | |||
| uint64 memory_size = 10; | |||
| uint32 stream_num = 11; | |||
| uint32 event_num = 12; | |||
| uint64 weight_size = 13; | |||
| uint32 label_num = 15; | |||
| repeated OpDef op = 20; | |||
| TargetType target_type = 23; | |||
| map<string, AttrDef> attr = 30; | |||
| }; | |||
| // operator define | |||
| message OpDef { | |||
| string name = 1; | |||
| string type = 2; | |||
| uint32 id = 3; | |||
| uint32 stream_id = 4; | |||
| repeated string input_name = 5; | |||
| repeated string src_name = 8; | |||
| repeated int32 src_index = 9; | |||
| repeated int64 input = 10; | |||
| repeated int64 output = 11; | |||
| repeated TensorDescriptor input_desc = 12; | |||
| repeated TensorDescriptor output_desc = 13; | |||
| repeated WeightDef weights = 14; | |||
| repeated string dst_name = 15; | |||
| repeated int32 dst_index = 16; | |||
| repeated int64 workspace = 20; | |||
| repeated uint32 workspace_bytes = 21; | |||
| repeated string weight_name = 22; | |||
| repeated bool is_input_const = 23; | |||
| map<string, AttrDef> attr = 30; | |||
| QuantizeFactorParams quantize_factor = 31; | |||
| oneof op_params { | |||
| // start at 100 here | |||
| SendOpParams sender_param = 100; | |||
| RecvOpParams receiver_param = 200; | |||
| ConvolutionOpParams convolution_param = 300; | |||
| PoolingOpParams pooling_param = 400; | |||
| EltwiseOpParams eltwise_param = 500; | |||
| BatchNormOpParams batchnorm_param = 600; | |||
| ScaleOpParams scale_param = 700; | |||
| FullConnectionOpParams full_connection_param = 800; | |||
| SoftmaxOpParams softmax_param = 900; | |||
| ActivationOpParams activation_param = 1000; | |||
| ReshapeOpParams reshape_param = 1100; | |||
| } | |||
| }; | |||
| message SendOpParams { | |||
| uint32 event_id = 1; | |||
| }; | |||
| message RecvOpParams { | |||
| uint32 event_id = 1; | |||
| }; | |||
| enum QuantizeScaleType | |||
| { | |||
| VECTOR_SCALE = 0; | |||
| SCALAR_SCALE = 1; | |||
| } | |||
| enum QuantizeScaleMode | |||
| { | |||
| NORMAL_MODE = 0; | |||
| SQRT_MODE = 1; | |||
| } | |||
| enum QuantizeAlgorithm | |||
| { | |||
| NON_OFFSET_ALGO = 0; | |||
| HALF_OFFSET_ALGO = 1; | |||
| ALL_OFFSET_ALGO = 2; | |||
| } | |||
| message QuantizeFactor | |||
| { | |||
| QuantizeScaleMode scale_mode = 1; | |||
| bytes scale_value = 2; | |||
| int64 scale_offset = 3; | |||
| bytes offset_data_value = 4; | |||
| int64 offset_data_offset = 5; | |||
| bytes offset_weight_value = 6; | |||
| int64 offset_weight_offset = 7; | |||
| bytes offset_pad_value = 8; | |||
| int64 offset_pad_offset = 9; | |||
| }; | |||
| message QuantizeCalcFactor | |||
| { | |||
| bytes offsetw = 1; | |||
| int64 offsetw_offset = 2; | |||
| bytes offsetd = 3; | |||
| int64 offsetd_offset = 4; | |||
| bytes scalereq = 5; | |||
| int64 scaledreq_offset = 6; | |||
| bytes offsetdnext = 7; | |||
| int64 offsetdnext_offset = 8; | |||
| } | |||
| message QuantizeFactorParams | |||
| { | |||
| QuantizeAlgorithm quantize_algo = 1; | |||
| QuantizeScaleType scale_type = 2; | |||
| QuantizeFactor quantize_param = 3; | |||
| QuantizeFactor dequantize_param = 4; | |||
| QuantizeFactor requantize_param = 5; | |||
| QuantizeCalcFactor quantizecalc_param = 6; | |||
| }; | |||
| message ConvolutionOpParams { | |||
| int32 mode = 1; | |||
| int32 algo = 2; | |||
| int32 pad_mode = 3; | |||
| uint32 group = 4; | |||
| uint32 num_output = 5; | |||
| repeated uint32 pad = 10; | |||
| repeated uint32 stride = 11; | |||
| repeated uint32 dilation = 12; | |||
| repeated uint32 kernel = 13; | |||
| float alpha = 20; | |||
| float beta = 21; | |||
| WeightDef filter = 40; | |||
| WeightDef bias = 41; | |||
| bool relu_flag = 62; | |||
| repeated uint32 adj = 70; | |||
| repeated uint32 target_shape = 71; | |||
| repeated uint32 before_pad = 72; | |||
| }; | |||
| message PoolingOpParams { | |||
| int32 mode = 1; | |||
| int32 nan_opt = 2; | |||
| int32 pad_mode = 3; | |||
| bool global_pooling = 4; | |||
| repeated uint32 window = 10; | |||
| repeated uint32 pad = 11; | |||
| repeated uint32 stride = 12; | |||
| bool ceil_mode = 13; | |||
| int32 data_mode = 14; | |||
| float alpha = 20; | |||
| float beta = 21; | |||
| repeated uint32 before_pad = 22; | |||
| }; | |||
| message EltwiseOpParams { | |||
| int32 mode = 1; | |||
| repeated float coeff = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| repeated WeightDef weight = 5; | |||
| bool relu_flag = 6; | |||
| }; | |||
| message ActivationOpParams { | |||
| int32 mode = 1; | |||
| float coef = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| }; | |||
| message BatchNormOpParams { | |||
| int32 mode = 1; | |||
| float alpha = 2; | |||
| float beta = 3; | |||
| double epsilon = 4;//optinal,[default = 1e-5] | |||
| bool use_global_stats = 5; //optinal,by default true,testing mode | |||
| float moving_average_fraction = 6; //optinal,[default = .999]; | |||
| WeightDef estimated_mean = 7; | |||
| WeightDef estimated_variance = 8; | |||
| WeightDef scale = 9; | |||
| WeightDef bias = 10; | |||
| }; | |||
| message ScaleOpParams { | |||
| WeightDef scale = 1; | |||
| WeightDef bias = 2; | |||
| }; | |||
| message ReshapeOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| ShapeDef shape = 3; | |||
| int32 axis = 4; | |||
| int32 num_axes = 5; | |||
| int32 format = 6; | |||
| }; | |||
| message SoftmaxOpParams { | |||
| int32 algo = 1; | |||
| int32 mode = 2; | |||
| float alpha = 3; | |||
| float beta = 4; | |||
| }; | |||
| message FullConnectionOpParams { | |||
| WeightDef filter = 1; | |||
| WeightDef bias = 2; | |||
| uint32 num_output = 3; | |||
| bool relu_flag = 12; | |||
| }; | |||
| message FlattenOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 start_axis = 3; | |||
| int32 end_axis = 4; | |||
| } | |||
| message AddLimitedOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 axis = 3; | |||
| bool broadcast = 4; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message MulLimitedOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| int32 axis = 3; | |||
| bool broadcast = 4; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message AddOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message MulOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message SubOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| repeated WeightDef weight = 10; | |||
| }; | |||
| message BiasAddOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| WeightDef bias = 10; | |||
| }; | |||
| message MatMulOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| bool transposeX = 3; | |||
| bool transposeW = 4; | |||
| WeightDef filter = 10; | |||
| WeightDef bias = 12; | |||
| }; | |||
| message RsqrtOpParams { | |||
| float alpha = 1; | |||
| float beta = 2; | |||
| }; | |||
| message WeightDef { | |||
| int32 format = 1; | |||
| int32 data_type = 2; | |||
| ShapeDef shape = 3; | |||
| bytes data = 4; | |||
| int64 data_offset = 5; | |||
| uint32 cmps_size = 6; | |||
| bytes cmps_tab = 7; | |||
| int64 cmps_tab_offset = 10; | |||
| CompressInfo cmps_info = 8; | |||
| AllOffsetQuantizeInfo alloffset_quantize_info = 11; | |||
| } | |||
| message ShapeDef { | |||
| repeated int64 dim = 1; | |||
| } | |||
| enum DeviceType { | |||
| NPU = 0; // In default, we will use NPU. | |||
| CPU = 1; // CPU | |||
| } | |||
| message AllOffsetQuantizeInfo { | |||
| float scale = 1; | |||
| int32 offset = 2; | |||
| } | |||
| message TensorDescriptor { | |||
| int32 format = 1; | |||
| int32 data_type = 2; | |||
| repeated int64 dim = 3; | |||
| uint32 size = 4; | |||
| bool reuse_input = 5; | |||
| bool output_tensor = 7; | |||
| DeviceType device_type = 8; | |||
| bool input_tensor = 9; | |||
| uint32 real_dim_cnt = 10; | |||
| uint32 reuse_input_index = 11; | |||
| AllOffsetQuantizeInfo alloffset_quantize_info = 12; | |||
| } | |||
| message CompressInfo { | |||
| int32 blockRow = 1; // block row | |||
| int32 blockCol = 2; // block col | |||
| int32 fractalK = 3; // fractal K | |||
| int32 fractalN = 4; // fractal N | |||
| int32 lastFractalK = 5; // K of last fractal | |||
| int32 lastFractalN = 6; // N of last fractal | |||
| int32 cubeSize = 7; // cube's length | |||
| int32 loadDir = 8; // data load directtiono 0:col load 1:row load | |||
| } | |||
| message AttrDef { | |||
| message ListValue { | |||
| repeated string s = 2; // "list(string)" | |||
| repeated int64 i = 3 [packed = true]; // "list(int)" | |||
| repeated float f = 4 [packed = true]; // "list(float)" | |||
| repeated bool b = 5 [packed = true]; // "list(bool)" | |||
| repeated uint32 u = 6 [packed = true]; // "list(uint)" | |||
| repeated bytes bt = 7; | |||
| } | |||
| oneof value { | |||
| string s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| uint32 u = 6; // "uint32" | |||
| bytes bt = 7; | |||
| ListValue list = 1; // any "list(...)" | |||
| NamedAttrs func = 10; | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NamedAttrs { | |||
| string name = 1; | |||
| map<string, AttrDef> attr = 2; | |||
| } | |||
| @@ -1,179 +0,0 @@ | |||
| /* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * Apache License for more details at | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| */ | |||
| syntax = "proto3"; | |||
| package domi; | |||
| message ModelTaskDef { | |||
| string version = 1; | |||
| map<string, string> attr = 9; // Extended field | |||
| repeated TaskDef task = 10; | |||
| uint64 memory_size = 11; | |||
| uint32 stream_num = 12; | |||
| uint32 event_num = 13; | |||
| uint64 weight_size = 14; | |||
| repeated bytes op = 15; // input/output opdef in bytes | |||
| uint64 base_addr = 16; // base addr | |||
| uint64 weight_addr = 17; // weight addr | |||
| uint32 batch_num = 18; | |||
| } | |||
| message TaskDef { | |||
| uint32 id = 1; | |||
| uint32 type = 2; | |||
| uint32 stream_id = 10; | |||
| uint32 event_id = 11; | |||
| KernelDef kernel = 20; | |||
| KernelExDef kernel_ex = 21; | |||
| KernelHcclDef kernel_hccl = 25; | |||
| EventExDef event_ex = 26; | |||
| LogTimeStampDef log_timestamp = 28; | |||
| uint32 label_id = 30; | |||
| MemcpyAsyncDef memcpy_async = 31; | |||
| StreamSwitchDef stream_switch = 32; | |||
| StreamActiveDef stream_active = 33; | |||
| bytes private_def = 34; | |||
| uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future | |||
| StreamSwitchNDef stream_switch_n = 36; | |||
| LabelSetDef label_set = 37; | |||
| LabelGotoExDef label_goto_ex = 38; | |||
| LabelSwitchByIndexDef label_switch_by_index = 39; | |||
| KernelDefWithHandle kernel_with_handle = 40; | |||
| } | |||
| message KernelDef { | |||
| KernelContext context = 1; | |||
| string stub_func = 10; | |||
| uint32 block_dim = 11; | |||
| uint32 args_size = 12; | |||
| bytes args = 13; | |||
| bytes sm_desc = 14; | |||
| bytes flowtable = 15; | |||
| string so_name = 16; | |||
| string kernel_name = 17; | |||
| bytes kernel_ext_info = 18; | |||
| uint32 kernel_ext_info_size = 19; | |||
| } | |||
| message KernelDefWithHandle { | |||
| KernelContext context = 1; | |||
| uint64 handle = 10; | |||
| string dev_func = 11; | |||
| uint32 block_dim = 12; | |||
| uint32 args_size = 13; | |||
| bytes args = 14; | |||
| bytes sm_desc = 15; | |||
| string original_kernel_key = 16; | |||
| string node_info = 17; | |||
| } | |||
| message KernelContext { | |||
| uint32 kernel_type = 1; | |||
| uint32 op_id = 2; // OP type in CCE | |||
| uint32 kernel_func_id = 3; | |||
| uint32 op_index = 4; // TE/Custom operator | |||
| bool is_flowtable = 5; // Identify whether args is a flowtable structure | |||
| bytes args_offset = 6; // args offset information | |||
| uint32 args_count = 7; // args count | |||
| repeated uint32 origin_op_index = 8; | |||
| } | |||
| message KernelExDef { | |||
| uint32 flags = 1; | |||
| uint32 op_index = 4; | |||
| uint32 args_size = 12; | |||
| bytes args = 13; | |||
| bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput | |||
| uint32 task_info_size = 15; | |||
| bytes kernel_ext_info = 16; | |||
| uint32 kernel_ext_info_size = 17; | |||
| } | |||
| message KernelHcclDef { | |||
| uint32 op_index = 8; | |||
| string hccl_type = 9; | |||
| } | |||
| message EventExDef { | |||
| uint32 op_index = 1; | |||
| uint32 event_type = 2; | |||
| } | |||
| message LogTimeStampDef { | |||
| uint64 logid = 1; | |||
| bool notify = 2; | |||
| uint32 flat = 3; | |||
| } | |||
| message MemcpyAsyncDef { | |||
| uint64 dst = 1; | |||
| uint64 dst_max = 2; | |||
| uint64 src = 3; | |||
| uint64 count = 4; | |||
| uint32 kind = 5; | |||
| uint32 op_index = 6; | |||
| } | |||
| message StreamSwitchDef { | |||
| uint32 op_index = 1; | |||
| uint32 true_stream_id = 2; | |||
| int64 value = 3; | |||
| uint64 value_ptr = 4; | |||
| uint32 data_type = 5; | |||
| } | |||
| message StreamActiveDef { | |||
| uint32 op_index = 1; | |||
| uint32 active_stream_id = 2; | |||
| } | |||
| message StreamSwitchNDef { | |||
| uint32 op_index = 1; | |||
| uint32 size = 2; | |||
| repeated int64 target_value = 3; | |||
| repeated uint32 true_stream_id = 4; | |||
| uint32 element_size = 5; | |||
| uint32 data_type = 6; | |||
| } | |||
| message LabelSetDef { | |||
| uint32 op_index = 1; | |||
| uint32 label_id = 2; | |||
| uint32 model_id = 3; | |||
| } | |||
| message LabelGotoExDef { | |||
| uint32 op_index = 1; | |||
| uint32 label_id = 2; | |||
| uint32 model_id = 3; | |||
| } | |||
| message LabelSwitchByIndexDef { | |||
| uint32 op_index = 1; | |||
| uint32 label_max = 2; | |||
| } | |||
| @@ -1,62 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "AttrValueProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "tensor.proto"; | |||
| import "tensor_shape.proto"; | |||
| import "types.proto"; | |||
| // Protocol buffer representing the value for an attr used to configure an Op. | |||
| // Comment indicates the corresponding attr type. Only the field matching the | |||
| // attr type may be filled. | |||
| message AttrValue { | |||
| // LINT.IfChange | |||
| message ListValue { | |||
| repeated bytes s = 2; // "list(string)" | |||
| repeated int64 i = 3 [packed = true]; // "list(int)" | |||
| repeated float f = 4 [packed = true]; // "list(float)" | |||
| repeated bool b = 5 [packed = true]; // "list(bool)" | |||
| repeated DataType type = 6 [packed = true]; // "list(type)" | |||
| repeated TensorShapeProto shape = 7; // "list(shape)" | |||
| repeated TensorProto tensor = 8; // "list(tensor)" | |||
| repeated NameAttrList func = 9; // "list(attr)" | |||
| } | |||
| // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.cc) | |||
| oneof value { | |||
| bytes s = 2; // "string" | |||
| int64 i = 3; // "int" | |||
| float f = 4; // "float" | |||
| bool b = 5; // "bool" | |||
| DataType type = 6; // "type" | |||
| TensorShapeProto shape = 7; // "shape" | |||
| TensorProto tensor = 8; // "tensor" | |||
| ListValue list = 1; // any "list(...)" | |||
| // "func" represents a function. func.name is a function's name or | |||
| // a primitive op's name. func.attr.first is the name of an attr | |||
| // defined for that function. func.attr.second is the value for | |||
| // that attr in the instantiation. | |||
| NameAttrList func = 10; | |||
| // This is a placeholder only used in nodes defined inside a | |||
| // function. It indicates the attr value will be supplied when | |||
| // the function is instantiated. For example, let us suppose a | |||
| // node "N" in function "FN". "N" has an attr "A" with value | |||
| // placeholder = "foo". When FN is instantiated with attr "foo" | |||
| // set to "bar", the instantiated node N's attr A will have been | |||
| // given the value "bar". | |||
| string placeholder = 9; | |||
| } | |||
| } | |||
| // A list of attr names and their values. The whole list is attached | |||
| // with a string name. E.g., MatMul[T=float]. | |||
| message NameAttrList { | |||
| string name = 1; | |||
| map<string, AttrValue> attr = 2; | |||
| } | |||
| @@ -1,100 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "FunctionProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| import "node_def.proto"; | |||
| import "op_def.proto"; | |||
| // A library is a set of named functions. | |||
| message FunctionDefLibrary { | |||
| repeated FunctionDef function = 1; | |||
| repeated GradientDef gradient = 2; | |||
| } | |||
| // A function can be instantiated when the runtime can bind every attr | |||
| // with a value. When a GraphDef has a call to a function, it must | |||
| // have binding for every attr defined in the signature. | |||
| // * device spec, etc. | |||
| message FunctionDef { | |||
| // The definition of the function's name, arguments, return values, | |||
| // attrs etc. | |||
| OpDef signature = 1; | |||
| // Attributes specific to this function definition. | |||
| map<string, AttrValue> attr = 5; | |||
| // NOTE: field id 2 deleted on Jan 11, 2017, GraphDef version 21. | |||
| reserved 2; | |||
| // In both of the following fields, there is the need to specify an | |||
| // output that is used as either the input to another node (in | |||
| // `node_def`) or as a return value of the function (in `ret`). | |||
| // Unlike the NodeDefs in GraphDef, we need to be able to specify a | |||
| // list in some cases (instead of just single outputs). Also, we | |||
| // need to be able to deal with lists of unknown length (so the | |||
| // output index may not be known at function definition time). So | |||
| // we use the following format instead: | |||
| // * "fun_in" where "fun_in" is the name of a function input arg in | |||
| // the `signature` field above. This represents that input, whether | |||
| // it is a single tensor or a list. | |||
| // * "fun_in:0" gives the first element of a function input arg (a | |||
| // non-list input is considered a list of length 1 for these | |||
| // purposes). | |||
| // * "node:out" where "node" is the name of a node in `node_def` and | |||
| // "out" is the name one of its op's output arguments (the name | |||
| // comes from the OpDef of the node's op). This represents that | |||
| // node's output, whether it is a single tensor or a list. | |||
| // Note: We enforce that an op's output arguments are never | |||
| // renamed in the backwards-compatibility test. | |||
| // * "node:out:0" gives the first element of a node output arg (a | |||
| // non-list output is considered a list of length 1 for these | |||
| // purposes). | |||
| // | |||
| // NOT CURRENTLY SUPPORTED (but may be in the future): | |||
| // * "node:out:-1" gives last element in a node output list | |||
| // * "node:out:1:" gives a list with all but the first element in a | |||
| // node output list | |||
| // * "node:out::-1" gives a list with all but the last element in a | |||
| // node output list | |||
| // The body of the function. Unlike the NodeDefs in a GraphDef, attrs | |||
| // may have values of type `placeholder` and the `input` field uses | |||
| // the "output" format above. | |||
| // By convention, "op" in node_def is resolved by consulting with a | |||
| // user-defined library first. If not resolved, "func" is assumed to | |||
| // be a builtin op. | |||
| repeated NodeDef node_def = 3; | |||
| // A mapping from the output arg names from `signature` to the | |||
| // outputs from `node_def` that should be returned by the function. | |||
| map<string, string> ret = 4; | |||
| } | |||
| // GradientDef defines the gradient function of a function defined in | |||
| // a function library. | |||
| // | |||
| // A gradient function g (specified by gradient_func) for a function f | |||
| // (specified by function_name) must follow the following: | |||
| // | |||
| // The function 'f' must be a numerical function which takes N inputs | |||
| // and produces M outputs. Its gradient function 'g', which is a | |||
| // function taking N + M inputs and produces N outputs. | |||
| // | |||
| // I.e. if we have | |||
| // (y1, y2, ..., y_M) = f(x1, x2, ..., x_N), | |||
| // then, g is | |||
| // (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N, | |||
| // dL/dy1, dL/dy2, ..., dL/dy_M), | |||
| // where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the | |||
| // loss function). dL/dx_i is the partial derivative of L with respect | |||
| // to x_i. | |||
| message GradientDef { | |||
| string function_name = 1; // The function name. | |||
| string gradient_func = 2; // The gradient function's name. | |||
| } | |||
| @@ -1,56 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "GraphProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "node_def.proto"; | |||
| import "function.proto"; | |||
| import "versions.proto"; | |||
| // Represents the graph of operations | |||
| message GraphDef { | |||
| repeated NodeDef node = 1; | |||
| // Compatibility versions of the graph. See core/public/version.h for version | |||
| // history. The GraphDef version is distinct from the TensorFlow version, and | |||
| // each release of TensorFlow will support a range of GraphDef versions. | |||
| VersionDef versions = 4; | |||
| // Deprecated single version field; use versions above instead. Since all | |||
| // GraphDef changes before "versions" was introduced were forward | |||
| // compatible, this field is entirely ignored. | |||
| int32 version = 3 [deprecated = true]; | |||
| // EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET. | |||
| // | |||
| // "library" provides user-defined functions. | |||
| // | |||
| // Naming: | |||
| // * library.function.name are in a flat namespace. | |||
| // NOTE: We may need to change it to be hierarchical to support | |||
| // different orgs. E.g., | |||
| // { "/google/nn", { ... }}, | |||
| // { "/google/vision", { ... }} | |||
| // { "/org_foo/module_bar", { ... }} | |||
| // map<string, FunctionDefLib> named_lib; | |||
| // * If node[i].op is the name of one function in "library", | |||
| // node[i] is deemed as a function call. Otherwise, node[i].op | |||
| // must be a primitive operation supported by the runtime. | |||
| // | |||
| // | |||
| // Function call semantics: | |||
| // | |||
| // * The callee may start execution as soon as some of its inputs | |||
| // are ready. The caller may want to use Tuple() mechanism to | |||
| // ensure all inputs are ready in the same time. | |||
| // | |||
| // * The consumer of return values may start executing as soon as | |||
| // the return values the consumer depends on are ready. The | |||
| // consumer may want to use Tuple() mechanism to ensure the | |||
| // consumer does not start until all return values of the callee | |||
| // function are ready. | |||
| FunctionDefLibrary library = 2; | |||
| }; | |||
| @@ -1,14 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| import "graph.proto"; | |||
| message GeGraphDef { | |||
| string name = 1; | |||
| GraphDef graph = 2; | |||
| } | |||
| message GraphDefLibrary { | |||
| repeated GeGraphDef graph_def = 1; | |||
| }; | |||
| @@ -1,63 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "NodeProto"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| message NodeDef { | |||
| // The name given to this operator. Used for naming inputs, | |||
| // logging, visualization, etc. Unique within a single GraphDef. | |||
| // Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_./]*". | |||
| string name = 1; | |||
| // The operation name. There may be custom parameters in attrs. | |||
| // Op names starting with an underscore are reserved for internal use. | |||
| string op = 2; | |||
| // Each input is "node:src_output" with "node" being a string name and | |||
| // "src_output" indicating which output tensor to use from "node". If | |||
| // "src_output" is 0 the ":0" suffix can be omitted. Regular inputs | |||
| // may optionally be followed by control inputs that have the format | |||
| // "^node". | |||
| repeated string input = 3; | |||
| // A (possibly partial) specification for the device on which this | |||
| // node should be placed. | |||
| // The expected syntax for this string is as follows: | |||
| // | |||
| // DEVICE_SPEC ::= PARTIAL_SPEC | |||
| // | |||
| // PARTIAL_SPEC ::= ("/" CONSTRAINT) * | |||
| // CONSTRAINT ::= ("job:" JOB_NAME) | |||
| // | ("replica:" [1-9][0-9]*) | |||
| // | ("task:" [1-9][0-9]*) | |||
| // | ("device:" [A-Za-z]* ":" ([1-9][0-9]* | "*") ) | |||
| // | |||
| // Valid values for this string include: | |||
| // * "/job:worker/replica:0/task:1/device:GPU:3" (full specification) | |||
| // * "/job:worker/device:GPU:3" (partial specification) | |||
| // * "" (no specification) | |||
| // | |||
| // If the constraints do not resolve to a single device (or if this | |||
| // field is empty or not present), the runtime will attempt to | |||
| // choose a device automatically. | |||
| string device = 4; | |||
| // Operation-specific graph-construction-time configuration. | |||
| // Note that this should include all attrs defined in the | |||
| // corresponding OpDef, including those with a value matching | |||
| // the default -- this allows the default to change and makes | |||
| // NodeDefs easier to interpret on their own. However, if | |||
| // an attr with a default is not specified in this list, the | |||
| // default will be used. | |||
| // The "names" (keys) must match the regexp "[a-z][a-z0-9_]+" (and | |||
| // one of the names from the corresponding OpDef's attr field). | |||
| // The values must have a type matching the corresponding OpDef | |||
| // attr's type field. | |||
| // Add some examples here showing best practices. | |||
| map<string, AttrValue> attr = 5; | |||
| }; | |||
| @@ -1,164 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "OpDefProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "attr_value.proto"; | |||
| import "types.proto"; | |||
| // Defines an operation. A NodeDef in a GraphDef specifies an Op by | |||
| // using the "op" field which should match the name of a OpDef. | |||
| // LINT.IfChange | |||
| message OpDef { | |||
| // Op names starting with an underscore are reserved for internal use. | |||
| // Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9_]*". | |||
| string name = 1; | |||
| // For describing inputs and outputs. | |||
| message ArgDef { | |||
| // Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*". | |||
| string name = 1; | |||
| // Human readable description. | |||
| string description = 2; | |||
| // Describes the type of one or more tensors that are accepted/produced | |||
| // by this input/output arg. The only legal combinations are: | |||
| // * For a single tensor: either the "type" field is set or the | |||
| // "type_attr" field is set to the name of an attr with type "type". | |||
| // * For a sequence of tensors with the same type: the "number_attr" | |||
| // field will be set to the name of an attr with type "int", and | |||
| // either the "type" or "type_attr" field will be set as for | |||
| // single tensors. | |||
| // * For a sequence of tensors, the "type_list_attr" field will be set | |||
| // to the name of an attr with type "list(type)". | |||
| DataType type = 3; | |||
| string type_attr = 4; // if specified, attr must have type "type" | |||
| string number_attr = 5; // if specified, attr must have type "int" | |||
| // If specified, attr must have type "list(type)", and none of | |||
| // type, type_attr, and number_attr may be specified. | |||
| string type_list_attr = 6; | |||
| // For inputs: if true, the inputs are required to be refs. | |||
| // By default, inputs can be either refs or non-refs. | |||
| // For outputs: if true, outputs are refs, otherwise they are not. | |||
| bool is_ref = 16; | |||
| }; | |||
| // Description of the input(s). | |||
| repeated ArgDef input_arg = 2; | |||
| // Description of the output(s). | |||
| repeated ArgDef output_arg = 3; | |||
| // Description of the graph-construction-time configuration of this | |||
| // Op. That is to say, this describes the attr fields that will | |||
| // be specified in the NodeDef. | |||
| message AttrDef { | |||
| // A descriptive name for the argument. May be used, e.g. by the | |||
| // Python client, as a keyword argument name, and so should match | |||
| // the regexp "[a-z][a-z0-9_]+". | |||
| string name = 1; | |||
| // One of the type names from attr_value.proto ("string", "list(string)", | |||
| // "int", etc.). | |||
| string type = 2; | |||
| // A reasonable default for this attribute if the user does not supply | |||
| // a value. If not specified, the user must supply a value. | |||
| AttrValue default_value = 3; | |||
| // Human-readable description. | |||
| string description = 4; | |||
| // --- Constraints --- | |||
| // These constraints are only in effect if specified. Default is no | |||
| // constraints. | |||
| // For type == "int", this is a minimum value. For "list(___)" | |||
| // types, this is the minimum length. | |||
| bool has_minimum = 5; | |||
| int64 minimum = 6; | |||
| // The set of allowed values. Has type that is the "list" version | |||
| // of the "type" field above (uses the "list" field of AttrValue). | |||
| // If type == "type" or "list(type)" above, then the "type" field | |||
| // of "allowed_values.list" has the set of allowed DataTypes. | |||
| // If type == "string" or "list(string)", then the "s" field of | |||
| // "allowed_values.list" has the set of allowed strings. | |||
| AttrValue allowed_values = 7; | |||
| } | |||
| repeated AttrDef attr = 4; | |||
| // Optional deprecation based on GraphDef versions. | |||
| OpDeprecation deprecation = 8; | |||
| // One-line human-readable description of what the Op does. | |||
| string summary = 5; | |||
| // Additional, longer human-readable description of what the Op does. | |||
| string description = 6; | |||
| // ------------------------------------------------------------------------- | |||
| // Which optimizations this operation can participate in. | |||
| // True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs) | |||
| bool is_commutative = 18; | |||
| // If is_aggregate is true, then this operation accepts N >= 2 | |||
| // inputs and produces 1 output all of the same type. Should be | |||
| // associative and commutative, and produce output with the same | |||
| // shape as the input. The optimizer may replace an aggregate op | |||
| // taking input from multiple devices with a tree of aggregate ops | |||
| // that aggregate locally within each device (and possibly within | |||
| // groups of nearby devices) before communicating. | |||
| bool is_aggregate = 16; // for things like add | |||
| // Other optimizations go here, like | |||
| // can_alias_input, rewrite_when_output_unused, partitioning_strategy, etc. | |||
| // ------------------------------------------------------------------------- | |||
| // Optimization constraints. | |||
| // Ops are marked as stateful if their behavior depends on some state beyond | |||
| // their input tensors (e.g. variable reading op) or if they have | |||
| // a side-effect (e.g. printing or asserting ops). Equivalently, stateless ops | |||
| // must always produce the same output for the same input and have | |||
| // no side-effects. | |||
| // | |||
| // By default Ops may be moved between devices. Stateful ops should | |||
| // either not be moved, or should only be moved if that state can also | |||
| // be moved (e.g. via some sort of save / restore). | |||
| // Stateful ops are guaranteed to never be optimized away by Common | |||
| // Subexpression Elimination (CSE). | |||
| bool is_stateful = 17; // for things like variables, queue | |||
| // ------------------------------------------------------------------------- | |||
| // Non-standard options. | |||
| // By default, all inputs to an Op must be initialized Tensors. Ops | |||
| // that may initialize tensors for the first time should set this | |||
| // field to true, to allow the Op to take an uninitialized Tensor as | |||
| // input. | |||
| bool allows_uninitialized_input = 19; // for Assign, etc. | |||
| }; | |||
| // LINT.ThenChange( | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/op_def_util.cc) | |||
| // Information about version-dependent deprecation of an op | |||
| message OpDeprecation { | |||
| // First GraphDef version at which the op is disallowed. | |||
| int32 version = 1; | |||
| // Explanation of why it was deprecated and what to use instead. | |||
| string explanation = 2; | |||
| }; | |||
| // A collection of OpDefs | |||
| message OpList { | |||
| repeated OpDef op = 1; | |||
| }; | |||
| @@ -1,29 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "ResourceHandle"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // Protocol buffer representing a handle to a tensorflow resource. Handles are | |||
| // not valid across executions, but can be serialized back and forth from within | |||
| // a single run. | |||
| message ResourceHandleProto { | |||
| // Unique name for the device containing the resource. | |||
| string device = 1; | |||
| // Container in which this resource is placed. | |||
| string container = 2; | |||
| // Unique name of this resource. | |||
| string name = 3; | |||
| // Hash code for the type of the resource. Is only valid in the same device | |||
| // and in the same execution. | |||
| uint64 hash_code = 4; | |||
| // For debug-only, the name of the type pointed to by this handle, if | |||
| // available. | |||
| string maybe_type_name = 5; | |||
| }; | |||
| @@ -1,94 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TensorProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| import "resource_handle.proto"; | |||
| import "tensor_shape.proto"; | |||
| import "types.proto"; | |||
| // Protocol buffer representing a tensor. | |||
| message TensorProto { | |||
| DataType dtype = 1; | |||
| // Shape of the tensor. | |||
| TensorShapeProto tensor_shape = 2; | |||
| // Only one of the representations below is set, one of "tensor_contents" and | |||
| // the "xxx_val" attributes. We are not using oneof because as oneofs cannot | |||
| // contain repeated fields it would require another extra set of messages. | |||
| // Version number. | |||
| // | |||
| // In version 0, if the "repeated xxx" representations contain only one | |||
| // element, that element is repeated to fill the shape. This makes it easy | |||
| // to represent a constant Tensor with a single value. | |||
| int32 version_number = 3; | |||
| // Serialized raw tensor content from either Tensor::AsProtoTensorContent or | |||
| // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation | |||
| // can be used for all tensor types. The purpose of this representation is to | |||
| // reduce serialization overhead during RPC call by avoiding serialization of | |||
| // many repeated small items. | |||
| bytes tensor_content = 4; | |||
| // Type specific representations that make it easy to create tensor protos in | |||
| // all languages. Only the representation corresponding to "dtype" can | |||
| // be set. The values hold the flattened representation of the tensor in | |||
| // row major order. | |||
| // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll | |||
| // have some pointless zero padding for each value here. | |||
| repeated int32 half_val = 13 [packed = true]; | |||
| // DT_FLOAT. | |||
| repeated float float_val = 5 [packed = true]; | |||
| // DT_DOUBLE. | |||
| repeated double double_val = 6 [packed = true]; | |||
| // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. | |||
| repeated int32 int_val = 7 [packed = true]; | |||
| // DT_STRING | |||
| repeated bytes string_val = 8; | |||
| // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real | |||
| // and imaginary parts of i-th single precision complex. | |||
| repeated float scomplex_val = 9 [packed = true]; | |||
| // DT_INT64 | |||
| repeated int64 int64_val = 10 [packed = true]; | |||
| // DT_BOOL | |||
| repeated bool bool_val = 11 [packed = true]; | |||
| // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real | |||
| // and imaginary parts of i-th double precision complex. | |||
| repeated double dcomplex_val = 12 [packed = true]; | |||
| // DT_RESOURCE | |||
| repeated ResourceHandleProto resource_handle_val = 14; | |||
| // DT_VARIANT | |||
| repeated VariantTensorDataProto variant_val = 15; | |||
| // DT_UINT32 | |||
| repeated uint32 uint32_val = 16 [packed = true]; | |||
| // DT_UINT64 | |||
| repeated uint64 uint64_val = 17 [packed = true]; | |||
| }; | |||
| // Protocol buffer representing the serialization format of DT_VARIANT tensors. | |||
| message VariantTensorDataProto { | |||
| // Name of the type of objects being serialized. | |||
| string type_name = 1; | |||
| // Portions of the object that are not Tensors. | |||
| bytes metadata = 2; | |||
| // Tensors contained within objects being serialized. | |||
| repeated TensorProto tensors = 3; | |||
| } | |||
| @@ -1,45 +0,0 @@ | |||
| // Protocol buffer representing the shape of tensors. | |||
| syntax = "proto3"; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TensorShapeProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| package domi.tensorflow; | |||
| // Dimensions of a tensor. | |||
| message TensorShapeProto { | |||
| // One dimension of the tensor. | |||
| message Dim { | |||
| // Size of the tensor in that dimension. | |||
| // This value must be >= -1, but values of -1 are reserved for "unknown" | |||
| // shapes (values of -1 mean "unknown" dimension). Certain wrappers | |||
| // that work with TensorShapeProto may fail at runtime when deserializing | |||
| // a TensorShapeProto containing a dim value of -1. | |||
| int64 size = 1; | |||
| // Optional name of the tensor dimension. | |||
| string name = 2; | |||
| }; | |||
| // Dimensions of the tensor, such as {"input", 30}, {"output", 40} | |||
| // for a 30 x 40 2D tensor. If an entry has size -1, this | |||
| // corresponds to a dimension of unknown size. The names are | |||
| // optional. | |||
| // | |||
| // The order of entries in "dim" matters: It indicates the layout of the | |||
| // values in the tensor in-memory representation. | |||
| // | |||
| // The first entry in "dim" is the outermost dimension used to layout the | |||
| // values, the last entry is the innermost dimension. This matches the | |||
| // in-memory layout of RowMajor Eigen tensors. | |||
| // | |||
| // If "dim.size()" > 0, "unknown_rank" must be false. | |||
| repeated Dim dim = 2; | |||
| // If true, the number of dimensions in the shape is unknown. | |||
| // | |||
| // If true, "dim.size()" must be 0. | |||
| bool unknown_rank = 3; | |||
| }; | |||
| @@ -1,74 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "TypesProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // LINT.IfChange | |||
| enum DataType { | |||
| // Not a legal value for DataType. Used to indicate a DataType field | |||
| // has not been set. | |||
| DT_INVALID = 0; | |||
| // Data types that all computation devices are expected to be | |||
| // capable to support. | |||
| DT_FLOAT = 1; | |||
| DT_DOUBLE = 2; | |||
| DT_INT32 = 3; | |||
| DT_UINT8 = 4; | |||
| DT_INT16 = 5; | |||
| DT_INT8 = 6; | |||
| DT_STRING = 7; | |||
| DT_COMPLEX64 = 8; // Single-precision complex | |||
| DT_INT64 = 9; | |||
| DT_BOOL = 10; | |||
| DT_QINT8 = 11; // Quantized int8 | |||
| DT_QUINT8 = 12; // Quantized uint8 | |||
| DT_QINT32 = 13; // Quantized int32 | |||
| DT_BFLOAT16 = 14; // Float32 truncated to 16 bits. Only for cast ops. | |||
| DT_QINT16 = 15; // Quantized int16 | |||
| DT_QUINT16 = 16; // Quantized uint16 | |||
| DT_UINT16 = 17; | |||
| DT_COMPLEX128 = 18; // Double-precision complex | |||
| DT_HALF = 19; | |||
| DT_RESOURCE = 20; | |||
| DT_VARIANT = 21; // Arbitrary C++ data types | |||
| DT_UINT32 = 22; | |||
| DT_UINT64 = 23; | |||
| // Do not use! These are only for parameters. Every enum above | |||
| // should have a corresponding value below (verified by types_test). | |||
| DT_FLOAT_REF = 101; | |||
| DT_DOUBLE_REF = 102; | |||
| DT_INT32_REF = 103; | |||
| DT_UINT8_REF = 104; | |||
| DT_INT16_REF = 105; | |||
| DT_INT8_REF = 106; | |||
| DT_STRING_REF = 107; | |||
| DT_COMPLEX64_REF = 108; | |||
| DT_INT64_REF = 109; | |||
| DT_BOOL_REF = 110; | |||
| DT_QINT8_REF = 111; | |||
| DT_QUINT8_REF = 112; | |||
| DT_QINT32_REF = 113; | |||
| DT_BFLOAT16_REF = 114; | |||
| DT_QINT16_REF = 115; | |||
| DT_QUINT16_REF = 116; | |||
| DT_UINT16_REF = 117; | |||
| DT_COMPLEX128_REF = 118; | |||
| DT_HALF_REF = 119; | |||
| DT_RESOURCE_REF = 120; | |||
| DT_VARIANT_REF = 121; | |||
| DT_UINT32_REF = 122; | |||
| DT_UINT64_REF = 123; | |||
| } | |||
| // LINT.ThenChange( | |||
| // https://www.tensorflow.org/code/tensorflow/c/c_api.h, | |||
| // https://www.tensorflow.org/code/tensorflow/go/tensor.go, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/types.h, | |||
| // https://www.tensorflow.org/code/tensorflow/core/framework/types.cc, | |||
| // https://www.tensorflow.org/code/tensorflow/python/framework/dtypes.py, | |||
| // https://www.tensorflow.org/code/tensorflow/python/framework/function.py) | |||
| @@ -1,31 +0,0 @@ | |||
| syntax = "proto3"; | |||
| package domi.tensorflow; | |||
| option cc_enable_arenas = true; | |||
| option java_outer_classname = "VersionsProtos"; | |||
| option java_multiple_files = true; | |||
| option java_package = "org.tensorflow.framework"; | |||
| // Version information for a piece of serialized data | |||
| // | |||
| // There are different types of versions for each type of data | |||
| // (GraphDef, etc.), but they all have the same common shape | |||
| // described here. | |||
| // | |||
| // Each consumer has "consumer" and "min_producer" versions (specified | |||
| // elsewhere). A consumer is allowed to consume this data if | |||
| // | |||
| // producer >= min_producer | |||
| // consumer >= min_consumer | |||
| // consumer not in bad_consumers | |||
| // | |||
| message VersionDef { | |||
| // The version of the code that produced this data. | |||
| int32 producer = 1; | |||
| // Any consumer below this version is not allowed to consume this data. | |||
| int32 min_consumer = 2; | |||
| // Specific consumer versions which are disallowed (e.g. due to bugs). | |||
| repeated int32 bad_consumers = 3; | |||
| }; | |||