You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

op_def.proto 6.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /**
  2. * This file is part of Open Source Software TensorFlow, version 1.15.0 https://github.com/tensorflow/tensorflow
  3. *
  4. * This file is included by GraphEngine so as to support model format conversion from tensorflow model to GraphEngine model.
  5. * This file in this distribution may have been modified by Huawei Technologies Co., Ltd ("Huawei Modifications").
  6. * All Huawei Modifications are Copyright 2019-2020 Huawei Technologies Co., Ltd.
  7. */
  8. syntax = "proto3";
  9. package domi.tensorflow;
  10. option cc_enable_arenas = true;
  11. option java_outer_classname = "OpDefProtos";
  12. option java_multiple_files = true;
  13. option java_package = "org.tensorflow.framework";
  14. import "attr_value.proto";
  15. import "types.proto";
  16. // Defines an operation. A NodeDef in a GraphDef specifies an Op by
  17. // using the "op" field which should match the name of a OpDef.
  18. // LINT.IfChange
  19. message OpDef {
  20. // Op names starting with an underscore are reserved for internal use.
  21. // Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9_]*".
  22. string name = 1;
  23. // For describing inputs and outputs.
  24. message ArgDef {
  25. // Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*".
  26. string name = 1;
  27. // Human readable description.
  28. string description = 2;
  29. // Describes the type of one or more tensors that are accepted/produced
  30. // by this input/output arg. The only legal combinations are:
  31. // * For a single tensor: either the "type" field is set or the
  32. // "type_attr" field is set to the name of an attr with type "type".
  33. // * For a sequence of tensors with the same type: the "number_attr"
  34. // field will be set to the name of an attr with type "int", and
  35. // either the "type" or "type_attr" field will be set as for
  36. // single tensors.
  37. // * For a sequence of tensors, the "type_list_attr" field will be set
  38. // to the name of an attr with type "list(type)".
  39. DataType type = 3;
  40. string type_attr = 4; // if specified, attr must have type "type"
  41. string number_attr = 5; // if specified, attr must have type "int"
  42. // If specified, attr must have type "list(type)", and none of
  43. // type, type_attr, and number_attr may be specified.
  44. string type_list_attr = 6;
  45. // For inputs: if true, the inputs are required to be refs.
  46. // By default, inputs can be either refs or non-refs.
  47. // For outputs: if true, outputs are refs, otherwise they are not.
  48. bool is_ref = 16;
  49. };
  50. // Description of the input(s).
  51. repeated ArgDef input_arg = 2;
  52. // Description of the output(s).
  53. repeated ArgDef output_arg = 3;
  54. // Description of the graph-construction-time configuration of this
  55. // Op. That is to say, this describes the attr fields that will
  56. // be specified in the NodeDef.
  57. message AttrDef {
  58. // A descriptive name for the argument. May be used, e.g. by the
  59. // Python client, as a keyword argument name, and so should match
  60. // the regexp "[a-z][a-z0-9_]+".
  61. string name = 1;
  62. // One of the type names from attr_value.proto ("string", "list(string)",
  63. // "int", etc.).
  64. string type = 2;
  65. // A reasonable default for this attribute if the user does not supply
  66. // a value. If not specified, the user must supply a value.
  67. AttrValue default_value = 3;
  68. // Human-readable description.
  69. string description = 4;
  70. // --- Constraints ---
  71. // These constraints are only in effect if specified. Default is no
  72. // constraints.
  73. // For type == "int", this is a minimum value. For "list(___)"
  74. // types, this is the minimum length.
  75. bool has_minimum = 5;
  76. int64 minimum = 6;
  77. // The set of allowed values. Has type that is the "list" version
  78. // of the "type" field above (uses the "list" field of AttrValue).
  79. // If type == "type" or "list(type)" above, then the "type" field
  80. // of "allowed_values.list" has the set of allowed DataTypes.
  81. // If type == "string" or "list(string)", then the "s" field of
  82. // "allowed_values.list" has the set of allowed strings.
  83. AttrValue allowed_values = 7;
  84. }
  85. repeated AttrDef attr = 4;
  86. // Optional deprecation based on GraphDef versions.
  87. OpDeprecation deprecation = 8;
  88. // One-line human-readable description of what the Op does.
  89. string summary = 5;
  90. // Additional, longer human-readable description of what the Op does.
  91. string description = 6;
  92. // -------------------------------------------------------------------------
  93. // Which optimizations this operation can participate in.
  94. // True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs)
  95. bool is_commutative = 18;
  96. // If is_aggregate is true, then this operation accepts N >= 2
  97. // inputs and produces 1 output all of the same type. Should be
  98. // associative and commutative, and produce output with the same
  99. // shape as the input. The optimizer may replace an aggregate op
  100. // taking input from multiple devices with a tree of aggregate ops
  101. // that aggregate locally within each device (and possibly within
  102. // groups of nearby devices) before communicating.
  103. bool is_aggregate = 16; // for things like add
  104. // Other optimizations go here, like
  105. // can_alias_input, rewrite_when_output_unused, partitioning_strategy, etc.
  106. // -------------------------------------------------------------------------
  107. // Optimization constraints.
  108. // Ops are marked as stateful if their behavior depends on some state beyond
  109. // their input tensors (e.g. variable reading op) or if they have
  110. // a side-effect (e.g. printing or asserting ops). Equivalently, stateless ops
  111. // must always produce the same output for the same input and have
  112. // no side-effects.
  113. //
  114. // By default Ops may be moved between devices. Stateful ops should
  115. // either not be moved, or should only be moved if that state can also
  116. // be moved (e.g. via some sort of save / restore).
  117. // Stateful ops are guaranteed to never be optimized away by Common
  118. // Subexpression Elimination (CSE).
  119. bool is_stateful = 17; // for things like variables, queue
  120. // -------------------------------------------------------------------------
  121. // Non-standard options.
  122. // By default, all inputs to an Op must be initialized Tensors. Ops
  123. // that may initialize tensors for the first time should set this
  124. // field to true, to allow the Op to take an uninitialized Tensor as
  125. // input.
  126. bool allows_uninitialized_input = 19; // for Assign, etc.
  127. };
  128. // LINT.ThenChange(
  129. // https://www.tensorflow.org/code/tensorflow/core/framework/op_def_util.cc)
  130. // Information about version-dependent deprecation of an op
  131. message OpDeprecation {
  132. // First GraphDef version at which the op is disallowed.
  133. int32 version = 1;
  134. // Explanation of why it was deprecated and what to use instead.
  135. string explanation = 2;
  136. };
  137. // A collection of OpDefs
  138. message OpList {
  139. repeated OpDef op = 1;
  140. };

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示