A special case of GrapplerItem, constructed from a TensorFlow Function.
| 59 | |
| 60 | // A special case of GrapplerItem, constructed from a TensorFlow Function. |
| 61 | class GrapplerFunctionItem : public GrapplerItem { |
| 62 | public: |
| 63 | GrapplerFunctionItem() = default; |
| 64 | |
| 65 | const string& description() const; |
| 66 | |
| 67 | const std::vector<InputArgInstantiation>& inputs() const; |
| 68 | const InputArgInstantiation& input(int i) const; |
| 69 | const std::size_t input_size() const; |
| 70 | |
| 71 | const std::vector<OutputArgInstantiation>& outputs() const; |
| 72 | const OutputArgInstantiation& output(int i) const; |
| 73 | const std::size_t output_size() const; |
| 74 | |
| 75 | const std::vector<ControlOutput>& control_outputs() const; |
| 76 | const std::size_t control_output_size() const; |
| 77 | |
| 78 | const AttrSlice& func_attr() const; |
| 79 | const GraphDef& function_body() const; |
| 80 | GraphDef& mutable_function_body(); |
| 81 | |
| 82 | bool is_stateful() const; |
| 83 | |
| 84 | GrapplerFunctionItem& SwapFunctionBody(GraphDef&& other); |
| 85 | |
| 86 | private: |
| 87 | friend Status MakeGrapplerFunctionItem(const FunctionDef&, const AttrSlice&, |
| 88 | const FunctionLibraryDefinition&, int, |
| 89 | GrapplerFunctionItem*); |
| 90 | friend Status ReplaceInputWithConst(const NodeDef&, int, |
| 91 | GrapplerFunctionItem*); |
| 92 | friend Status RemoveFunctionOutputs(const absl::flat_hash_set<int>&, |
| 93 | GrapplerFunctionItem*, |
| 94 | std::vector<std::pair<int, int>>*); |
| 95 | |
| 96 | GrapplerFunctionItem(string func_name, string description, |
| 97 | AttrSlice func_attr, |
| 98 | std::vector<InputArgInstantiation> input_args, |
| 99 | std::vector<OutputArgInstantiation> output_args, |
| 100 | std::vector<ControlOutput> control_outputs, |
| 101 | int graph_def_version, bool is_stateful, |
| 102 | GraphDef&& function_body); |
| 103 | |
| 104 | string description_; |
| 105 | AttrSlice func_attr_; // Attributes specific to function definition that |
| 106 | // produced this item (FuncDef.attr field). |
| 107 | |
| 108 | std::vector<InputArgInstantiation> input_args_; |
| 109 | std::vector<OutputArgInstantiation> output_args_; |
| 110 | std::vector<ControlOutput> control_outputs_; |
| 111 | |
| 112 | bool is_stateful_ = false; |
| 113 | }; |
| 114 | |
| 115 | // Check if function input/output types are fully defined only at instantiation |
| 116 | // time (parametrized by its instantiation node). |
no outgoing calls
no test coverage detected