| 219 | } |
| 220 | |
| 221 | Operation* GetDefiningOpForInput(const Operation* op, uint32_t index) { |
| 222 | PADDLE_ENFORCE_EQ( |
| 223 | index < op->num_operands() && op->operand_source(index), |
| 224 | true, |
| 225 | common::errors::InvalidArgument("Input operand's index must be valid.")); |
| 226 | return op->operand_source(index).defining_op(); |
| 227 | } |
| 228 | |
| 229 | std::vector<std::pair<Operation*, int32_t>> GetUseOpsForOutput( |
| 230 | const Operation* op, uint32_t index) { |