Transform a subgraph view. For convenience, a transform operation returns a subgraph view of the transformed graph. Args: info: Temporary information for this transorfm call. sgv: the subgraph to be transformed. Returns: The transformed subgraph.
(self, info, sgv)
| 514 | reroute.add_control_inputs(op_, control_inputs_) |
| 515 | |
| 516 | def _transform_sgv(self, info, sgv): |
| 517 | """Transform a subgraph view. |
| 518 | |
| 519 | For convenience, a transform operation returns a subgraph view of the |
| 520 | transformed graph. |
| 521 | |
| 522 | Args: |
| 523 | info: Temporary information for this transorfm call. |
| 524 | sgv: the subgraph to be transformed. |
| 525 | Returns: |
| 526 | The transformed subgraph. |
| 527 | """ |
| 528 | ops_ = [op_ for _, op_ in iteritems(info.transformed_ops)] |
| 529 | sgv_ = subgraph.SubGraphView(ops_) |
| 530 | sgv_inputs_ = sgv_.inputs |
| 531 | sgv_outputs_ = sgv_.outputs |
| 532 | |
| 533 | # re-order inputs |
| 534 | input_map_ = [] |
| 535 | for input_t in sgv.inputs: |
| 536 | if input_t not in info.transformed_ts: |
| 537 | continue |
| 538 | input_t_ = info.transformed_ts[input_t] |
| 539 | if input_t_ not in sgv_inputs_: |
| 540 | continue |
| 541 | input_t_index_ = sgv_.input_index(input_t_) |
| 542 | input_map_.append(input_t_index_) |
| 543 | |
| 544 | # re-order outputs |
| 545 | output_map_ = [] |
| 546 | for output_t in sgv.outputs: |
| 547 | if output_t not in info.transformed_ts: |
| 548 | continue |
| 549 | output_t_ = info.transformed_ts[output_t] |
| 550 | if output_t_ not in sgv_outputs_: |
| 551 | continue |
| 552 | output_t_index_ = sgv_.output_index(output_t_) |
| 553 | output_map_.append(output_t_index_) |
| 554 | |
| 555 | return sgv_.remap(input_map_, output_map_) |
| 556 | |
| 557 | def _transformed_t(self, info, t, consumer_op): |
| 558 | """Return tre transformed tensor of `t`.""" |
no test coverage detected