MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _transformed_t

Method _transformed_t

tensorflow/contrib/graph_editor/transform.py:557–588  ·  view source on GitHub ↗

Return tre transformed tensor of `t`.

(self, info, t, consumer_op)

Source from the content-addressed store, hash-verified

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`."""
559 if t in info.transformed_ts:
560 # If op is in the subgraph, just return its transformed counterpart.
561 return info.transformed_ts[t]
562
563 if t in info.sgv_inputs_set:
564 # `t` is an input of the subgraph.
565 return self.transform_external_input_handler(info, t)
566 elif t.op in info.ops:
567 # `t` is an internal tensor but is not transformed yet because it
568 # belongs to a graph cycle.
569 logging.debug("Cyclic tensor: t.name = %s", t.name)
570 # Try to find an existing tensor we can use for now,
571 # otherwise create one. We'll rewire this later.
572 if consumer_op.type == "Merge":
573 first_input = consumer_op.inputs[0]
574 tmp_t_ = self._transformed_t(info, first_input, consumer_op)
575 elif t.op.type == "Enter":
576 enter_input = t.op.inputs[0]
577 tmp_t_ = self._transformed_t(info, enter_input, consumer_op)
578 else:
579 with info.graph_.as_default():
580 tmp_t_ = util.make_placeholder_from_tensor(t, scope=info.scope_,
581 prefix="geph_tmp")
582 logging.debug("Created temporary placeholder: %s.", tmp_t_.name)
583 # Register as temporary and return.
584 info.tmp_cyclic_ts.append((t, tmp_t_, consumer_op))
585 return tmp_t_
586 else:
587 # `t` is a hidden input of the subgraph.
588 return self.transform_external_hidden_input_handler(info, t)
589
590
591def copy(sgv, dst_graph=None, dst_scope="", src_scope="",

Callers 1

_copy_opsMethod · 0.95

Calls 2

as_defaultMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected