I try to wrap operation with customized operation.
I solved input of target operation (A in picture) but fail with wrapping output.
Init network operations looks like it.
 C   D
/ \ /
B  A
and assume every operation has 1 output tensor. I want to add operation 'E'
 C   D
/ \ /
B  E
   |
   A
I'm tried with graph editor(API r0.12),
my strategy was that connect A-E and disconnect (C,D)-A and connect (C,D)-E
How can I change?
Thanks
You need to do some subgraph remapping to make sure the signatures of the two subgraphs match. To do so it's helpful to print the subgraph.
tf.reset_default_graph()
a = tf.placeholder(dtype=tf.float32, name="a")
b = tf.placeholder(dtype=tf.float32, name="b")
c = tf.add(a, b, name="c")
d = tf.identity(a, name="d")
e = tf.identity(a, name="e")
print(ge.sgv(e.op))
print(ge.sgv(c.op, d.op).remap_inputs([0]))
ge.connect(ge.sgv(e.op), ge.sgv(c.op, d.op).remap_inputs([0]))
Outputs:
SubGraphView (graphid=241109520):
** ops[1]:
  e
** inputs[1]:
  a:0
** outputs[1]:
  e:0
SubGraphView (graphid=241109520):
** ops[2]:
  c
  d
** inputs[1]:
  a:0
** outputs[2]:
  c:0
  d:0
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With