Represents a node in the computation graph.
| 35 | |
| 36 | /// Represents a node in the computation graph. |
| 37 | class Operation { |
| 38 | public: |
| 39 | Operation() : node_(nullptr) {} |
| 40 | explicit Operation(Node* n); |
| 41 | |
| 42 | int32 num_inputs() const { return node_->num_inputs(); } |
| 43 | DataType input_type(int32 o) const { return node_->input_type(o); } |
| 44 | Output input(int32 i) const; |
| 45 | |
| 46 | int32 num_outputs() const { return node_->num_outputs(); } |
| 47 | DataType output_type(int32 o) const { return node_->output_type(o); } |
| 48 | Output output(int32 i) const; |
| 49 | |
| 50 | Node* node() const { return node_; } |
| 51 | |
| 52 | uint64 hash(int32 index) const; |
| 53 | |
| 54 | bool operator==(const Operation& other) const { return node_ == other.node_; } |
| 55 | |
| 56 | private: |
| 57 | typedef std::vector<std::pair<Node*, int32>> Inputs; |
| 58 | static Inputs GetInputs(Node* node); |
| 59 | |
| 60 | Inputs inputs_; |
| 61 | Node* node_; |
| 62 | }; |
| 63 | |
| 64 | /// Represents a tensor value produced by an Operation. |
| 65 | class Output { |
no outgoing calls