How do I find the output of a tensor and/or op in tensorflow? (or “tensorflow op.outputs only pointing to...












0















First things first - this might be a very basic and dumb question, but I've tried many things and searched all over to no avail, so here I am.
The problem is the following:

I have a tensor, and I'd like to find "where it leads" for various reasons.
The way to theoretically do this would be to just look at my_tensor.op.outputs, as per documentation and such, but this always seems to point back to my_tensor itself!

I've easily gone the other way before, meaning I can get the input tensor by using my_tensor.op.inputs, but for some reason "outputs" isn't doing the expected.

Here's a simple example:



import tensorflow as tf

a = tf.placeholder(tf.uint8, name='a')
b = tf.placeholder(tf.uint8, name='b')
my_sum = tf.identity(a + b, name='my_sum')
graph = tf.get_default_graph()

# I should have 4 ops at this point, as validated by:
print(graph.get_operations())
>> [<tf.Operation 'a' type=Placeholder>, <tf.Operation 'b' type=Placeholder>, <tf.Operation 'add' type=Add>, <tf.Operation 'my_sum' type=Identity>]

# So let's try get the output of 'a':
print(list(a.op.outputs))
>> [<tf.Tensor 'a:0' shape=<unknown> dtype=uint8>]


If you tried the above, you'll see you got back to 'a'...

Again, running my_sum.op.inputs gives the 'add' op, and running even further back get's us to 'a' and 'b' as expected:



input_to_my_sum = list(my_sum.op.inputs)[0]
print(input_to_my_sum)
>> Tensor("add:0", dtype=uint8)

print(list(input_to_my_sum.op.inputs))
>> [<tf.Tensor 'a:0' shape=<unknown> dtype=uint8>, <tf.Tensor 'b:0' shape=<unknown> dtype=uint8>]


But the other way round? No such luck:



print(list(input_to_my_sum.op.outputs))
>> [<tf.Tensor 'add:0' shape=<unknown> dtype=uint8>]

print('This is no fun at all')
>> This is no fun at all


So what am I doing wrong?

I've also tried using the (deprecated) op.values() with no success, and I'm confused because the documentation explicitly states that this should give me the outputs of the op (from https://www.tensorflow.org/api_docs/python/tf/Operation):




outputs

The list of Tensor objects representing the outputs of this op.




(I checked that a.op.__class__ is the right class and that I'm reading the correct documentation).



(Just to wrap things up, the node_def of the ops also shows no signs of an output field...).

Thanks in advance for any advice!





Edit (due to Yuxin's answer):

Just to clarify, taking the output of the output of the etc. stays put on the same tensor. I'm trying to reach the next tensor/op.



P.S: This is my first stackoverflow question, so if I did anything "wrong" let me know and I'll try fix it.










share|improve this question

























  • I am not sure what you are expecting, but do remember that setting up the operations graph and executing operations are different things in tensorflow. If you were expecting to see the actual value of the sum, you will not, you need to run the graph operations in a session first.

    – Mad Wombat
    Nov 21 '18 at 19:46






  • 1





    No, I get that. I wasn't looking for a value of course, nor anything else that requires a session or feeding anything into the tensors or anything similar. See the accepted answer for what I was (unfortunately not) getting at.

    – ShlomiF
    Nov 21 '18 at 19:50
















0















First things first - this might be a very basic and dumb question, but I've tried many things and searched all over to no avail, so here I am.
The problem is the following:

I have a tensor, and I'd like to find "where it leads" for various reasons.
The way to theoretically do this would be to just look at my_tensor.op.outputs, as per documentation and such, but this always seems to point back to my_tensor itself!

I've easily gone the other way before, meaning I can get the input tensor by using my_tensor.op.inputs, but for some reason "outputs" isn't doing the expected.

Here's a simple example:



import tensorflow as tf

a = tf.placeholder(tf.uint8, name='a')
b = tf.placeholder(tf.uint8, name='b')
my_sum = tf.identity(a + b, name='my_sum')
graph = tf.get_default_graph()

# I should have 4 ops at this point, as validated by:
print(graph.get_operations())
>> [<tf.Operation 'a' type=Placeholder>, <tf.Operation 'b' type=Placeholder>, <tf.Operation 'add' type=Add>, <tf.Operation 'my_sum' type=Identity>]

# So let's try get the output of 'a':
print(list(a.op.outputs))
>> [<tf.Tensor 'a:0' shape=<unknown> dtype=uint8>]


If you tried the above, you'll see you got back to 'a'...

Again, running my_sum.op.inputs gives the 'add' op, and running even further back get's us to 'a' and 'b' as expected:



input_to_my_sum = list(my_sum.op.inputs)[0]
print(input_to_my_sum)
>> Tensor("add:0", dtype=uint8)

print(list(input_to_my_sum.op.inputs))
>> [<tf.Tensor 'a:0' shape=<unknown> dtype=uint8>, <tf.Tensor 'b:0' shape=<unknown> dtype=uint8>]


But the other way round? No such luck:



print(list(input_to_my_sum.op.outputs))
>> [<tf.Tensor 'add:0' shape=<unknown> dtype=uint8>]

print('This is no fun at all')
>> This is no fun at all


So what am I doing wrong?

I've also tried using the (deprecated) op.values() with no success, and I'm confused because the documentation explicitly states that this should give me the outputs of the op (from https://www.tensorflow.org/api_docs/python/tf/Operation):




outputs

The list of Tensor objects representing the outputs of this op.




(I checked that a.op.__class__ is the right class and that I'm reading the correct documentation).



(Just to wrap things up, the node_def of the ops also shows no signs of an output field...).

Thanks in advance for any advice!





Edit (due to Yuxin's answer):

Just to clarify, taking the output of the output of the etc. stays put on the same tensor. I'm trying to reach the next tensor/op.



P.S: This is my first stackoverflow question, so if I did anything "wrong" let me know and I'll try fix it.










share|improve this question

























  • I am not sure what you are expecting, but do remember that setting up the operations graph and executing operations are different things in tensorflow. If you were expecting to see the actual value of the sum, you will not, you need to run the graph operations in a session first.

    – Mad Wombat
    Nov 21 '18 at 19:46






  • 1





    No, I get that. I wasn't looking for a value of course, nor anything else that requires a session or feeding anything into the tensors or anything similar. See the accepted answer for what I was (unfortunately not) getting at.

    – ShlomiF
    Nov 21 '18 at 19:50














0












0








0








First things first - this might be a very basic and dumb question, but I've tried many things and searched all over to no avail, so here I am.
The problem is the following:

I have a tensor, and I'd like to find "where it leads" for various reasons.
The way to theoretically do this would be to just look at my_tensor.op.outputs, as per documentation and such, but this always seems to point back to my_tensor itself!

I've easily gone the other way before, meaning I can get the input tensor by using my_tensor.op.inputs, but for some reason "outputs" isn't doing the expected.

Here's a simple example:



import tensorflow as tf

a = tf.placeholder(tf.uint8, name='a')
b = tf.placeholder(tf.uint8, name='b')
my_sum = tf.identity(a + b, name='my_sum')
graph = tf.get_default_graph()

# I should have 4 ops at this point, as validated by:
print(graph.get_operations())
>> [<tf.Operation 'a' type=Placeholder>, <tf.Operation 'b' type=Placeholder>, <tf.Operation 'add' type=Add>, <tf.Operation 'my_sum' type=Identity>]

# So let's try get the output of 'a':
print(list(a.op.outputs))
>> [<tf.Tensor 'a:0' shape=<unknown> dtype=uint8>]


If you tried the above, you'll see you got back to 'a'...

Again, running my_sum.op.inputs gives the 'add' op, and running even further back get's us to 'a' and 'b' as expected:



input_to_my_sum = list(my_sum.op.inputs)[0]
print(input_to_my_sum)
>> Tensor("add:0", dtype=uint8)

print(list(input_to_my_sum.op.inputs))
>> [<tf.Tensor 'a:0' shape=<unknown> dtype=uint8>, <tf.Tensor 'b:0' shape=<unknown> dtype=uint8>]


But the other way round? No such luck:



print(list(input_to_my_sum.op.outputs))
>> [<tf.Tensor 'add:0' shape=<unknown> dtype=uint8>]

print('This is no fun at all')
>> This is no fun at all


So what am I doing wrong?

I've also tried using the (deprecated) op.values() with no success, and I'm confused because the documentation explicitly states that this should give me the outputs of the op (from https://www.tensorflow.org/api_docs/python/tf/Operation):




outputs

The list of Tensor objects representing the outputs of this op.




(I checked that a.op.__class__ is the right class and that I'm reading the correct documentation).



(Just to wrap things up, the node_def of the ops also shows no signs of an output field...).

Thanks in advance for any advice!





Edit (due to Yuxin's answer):

Just to clarify, taking the output of the output of the etc. stays put on the same tensor. I'm trying to reach the next tensor/op.



P.S: This is my first stackoverflow question, so if I did anything "wrong" let me know and I'll try fix it.










share|improve this question
















First things first - this might be a very basic and dumb question, but I've tried many things and searched all over to no avail, so here I am.
The problem is the following:

I have a tensor, and I'd like to find "where it leads" for various reasons.
The way to theoretically do this would be to just look at my_tensor.op.outputs, as per documentation and such, but this always seems to point back to my_tensor itself!

I've easily gone the other way before, meaning I can get the input tensor by using my_tensor.op.inputs, but for some reason "outputs" isn't doing the expected.

Here's a simple example:



import tensorflow as tf

a = tf.placeholder(tf.uint8, name='a')
b = tf.placeholder(tf.uint8, name='b')
my_sum = tf.identity(a + b, name='my_sum')
graph = tf.get_default_graph()

# I should have 4 ops at this point, as validated by:
print(graph.get_operations())
>> [<tf.Operation 'a' type=Placeholder>, <tf.Operation 'b' type=Placeholder>, <tf.Operation 'add' type=Add>, <tf.Operation 'my_sum' type=Identity>]

# So let's try get the output of 'a':
print(list(a.op.outputs))
>> [<tf.Tensor 'a:0' shape=<unknown> dtype=uint8>]


If you tried the above, you'll see you got back to 'a'...

Again, running my_sum.op.inputs gives the 'add' op, and running even further back get's us to 'a' and 'b' as expected:



input_to_my_sum = list(my_sum.op.inputs)[0]
print(input_to_my_sum)
>> Tensor("add:0", dtype=uint8)

print(list(input_to_my_sum.op.inputs))
>> [<tf.Tensor 'a:0' shape=<unknown> dtype=uint8>, <tf.Tensor 'b:0' shape=<unknown> dtype=uint8>]


But the other way round? No such luck:



print(list(input_to_my_sum.op.outputs))
>> [<tf.Tensor 'add:0' shape=<unknown> dtype=uint8>]

print('This is no fun at all')
>> This is no fun at all


So what am I doing wrong?

I've also tried using the (deprecated) op.values() with no success, and I'm confused because the documentation explicitly states that this should give me the outputs of the op (from https://www.tensorflow.org/api_docs/python/tf/Operation):




outputs

The list of Tensor objects representing the outputs of this op.




(I checked that a.op.__class__ is the right class and that I'm reading the correct documentation).



(Just to wrap things up, the node_def of the ops also shows no signs of an output field...).

Thanks in advance for any advice!





Edit (due to Yuxin's answer):

Just to clarify, taking the output of the output of the etc. stays put on the same tensor. I'm trying to reach the next tensor/op.



P.S: This is my first stackoverflow question, so if I did anything "wrong" let me know and I'll try fix it.







python tensorflow tf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 18:41







ShlomiF

















asked Nov 21 '18 at 9:58









ShlomiFShlomiF

854410




854410













  • I am not sure what you are expecting, but do remember that setting up the operations graph and executing operations are different things in tensorflow. If you were expecting to see the actual value of the sum, you will not, you need to run the graph operations in a session first.

    – Mad Wombat
    Nov 21 '18 at 19:46






  • 1





    No, I get that. I wasn't looking for a value of course, nor anything else that requires a session or feeding anything into the tensors or anything similar. See the accepted answer for what I was (unfortunately not) getting at.

    – ShlomiF
    Nov 21 '18 at 19:50



















  • I am not sure what you are expecting, but do remember that setting up the operations graph and executing operations are different things in tensorflow. If you were expecting to see the actual value of the sum, you will not, you need to run the graph operations in a session first.

    – Mad Wombat
    Nov 21 '18 at 19:46






  • 1





    No, I get that. I wasn't looking for a value of course, nor anything else that requires a session or feeding anything into the tensors or anything similar. See the accepted answer for what I was (unfortunately not) getting at.

    – ShlomiF
    Nov 21 '18 at 19:50

















I am not sure what you are expecting, but do remember that setting up the operations graph and executing operations are different things in tensorflow. If you were expecting to see the actual value of the sum, you will not, you need to run the graph operations in a session first.

– Mad Wombat
Nov 21 '18 at 19:46





I am not sure what you are expecting, but do remember that setting up the operations graph and executing operations are different things in tensorflow. If you were expecting to see the actual value of the sum, you will not, you need to run the graph operations in a session first.

– Mad Wombat
Nov 21 '18 at 19:46




1




1





No, I get that. I wasn't looking for a value of course, nor anything else that requires a session or feeding anything into the tensors or anything similar. See the accepted answer for what I was (unfortunately not) getting at.

– ShlomiF
Nov 21 '18 at 19:50





No, I get that. I wasn't looking for a value of course, nor anything else that requires a session or feeding anything into the tensors or anything similar. See the accepted answer for what I was (unfortunately not) getting at.

– ShlomiF
Nov 21 '18 at 19:50












1 Answer
1






active

oldest

votes


















1















and I'm confused because the documentation explicitly states that this should give me the outputs of the op




It does give you the output of the op:



print(list(input_to_my_sum.op.outputs))
>> [<tf.Tensor 'add:0' shape=<unknown> dtype=uint8>]


So I'm not sure what you're confused about or what you're expecting.



Be sure to understand the concept of "Tensor" and "Operation". In a tensorflow graph, an Operation
takes a list of input Tensors and outputs a list of Tensors.
In Python, you can print(x) to see if x is a Tensor or Operation.



Operation has .inputs (which are Tensors) and .outputs (which are Tensors).
Tensor does not have inputs and outputs. Tensor has .op, which is the Operation that produces it as outputs.
Tensor also has .consumers(), which is a list of Operations which take the Tensor as inputs.



input_to_my_sum is a Tensor, the result of the Add.
input_to_my_sum.op is a Operation, the Add Operation that produces the result input_to_my_sum.
Therefore input_to_my_sum.op.outputs contains input_to_my_sum.






share|improve this answer


























  • Well, I suspect that due to 'add' being the input to 'my_sum', then the output of 'add' should be 'my_sum'. No? (Try taking the output of the output of the output of...1000 times. you stay put on the same tensor...)

    – ShlomiF
    Nov 21 '18 at 18:36













  • I think you need to understand "Tensor" vs "Operation". The Tensor my_sum is the output of the operation Identity. The input to the operation Identity is the Tensor called c = a + b. The Tensor c is the output of an operation "add".

    – ppwwyyxx
    Nov 21 '18 at 18:39











  • Ok, I'll read up about that. But how do I get the next node of a tensor or an op if not via the outputs attribute? (Note the asymmetry with the inputs attribute)

    – ShlomiF
    Nov 21 '18 at 18:42













  • list(my_sum.op.outputs)[0] == my_sum returns True. For every tensor I've ever tried. Is outputs that useless??

    – ShlomiF
    Nov 21 '18 at 18:47











  • A Tensor has .consumers() which contains a list of Operations whose .inputs contain the Tensor. An Operation has outputs which contains a list of Tensors whose .op is the Operation. outputs and inputs are not meant to be symmetric like the way you imagine.

    – ppwwyyxx
    Nov 21 '18 at 18:58













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53409455%2fhow-do-i-find-the-output-of-a-tensor-and-or-op-in-tensorflow-or-tensorflow-op%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1















and I'm confused because the documentation explicitly states that this should give me the outputs of the op




It does give you the output of the op:



print(list(input_to_my_sum.op.outputs))
>> [<tf.Tensor 'add:0' shape=<unknown> dtype=uint8>]


So I'm not sure what you're confused about or what you're expecting.



Be sure to understand the concept of "Tensor" and "Operation". In a tensorflow graph, an Operation
takes a list of input Tensors and outputs a list of Tensors.
In Python, you can print(x) to see if x is a Tensor or Operation.



Operation has .inputs (which are Tensors) and .outputs (which are Tensors).
Tensor does not have inputs and outputs. Tensor has .op, which is the Operation that produces it as outputs.
Tensor also has .consumers(), which is a list of Operations which take the Tensor as inputs.



input_to_my_sum is a Tensor, the result of the Add.
input_to_my_sum.op is a Operation, the Add Operation that produces the result input_to_my_sum.
Therefore input_to_my_sum.op.outputs contains input_to_my_sum.






share|improve this answer


























  • Well, I suspect that due to 'add' being the input to 'my_sum', then the output of 'add' should be 'my_sum'. No? (Try taking the output of the output of the output of...1000 times. you stay put on the same tensor...)

    – ShlomiF
    Nov 21 '18 at 18:36













  • I think you need to understand "Tensor" vs "Operation". The Tensor my_sum is the output of the operation Identity. The input to the operation Identity is the Tensor called c = a + b. The Tensor c is the output of an operation "add".

    – ppwwyyxx
    Nov 21 '18 at 18:39











  • Ok, I'll read up about that. But how do I get the next node of a tensor or an op if not via the outputs attribute? (Note the asymmetry with the inputs attribute)

    – ShlomiF
    Nov 21 '18 at 18:42













  • list(my_sum.op.outputs)[0] == my_sum returns True. For every tensor I've ever tried. Is outputs that useless??

    – ShlomiF
    Nov 21 '18 at 18:47











  • A Tensor has .consumers() which contains a list of Operations whose .inputs contain the Tensor. An Operation has outputs which contains a list of Tensors whose .op is the Operation. outputs and inputs are not meant to be symmetric like the way you imagine.

    – ppwwyyxx
    Nov 21 '18 at 18:58


















1















and I'm confused because the documentation explicitly states that this should give me the outputs of the op




It does give you the output of the op:



print(list(input_to_my_sum.op.outputs))
>> [<tf.Tensor 'add:0' shape=<unknown> dtype=uint8>]


So I'm not sure what you're confused about or what you're expecting.



Be sure to understand the concept of "Tensor" and "Operation". In a tensorflow graph, an Operation
takes a list of input Tensors and outputs a list of Tensors.
In Python, you can print(x) to see if x is a Tensor or Operation.



Operation has .inputs (which are Tensors) and .outputs (which are Tensors).
Tensor does not have inputs and outputs. Tensor has .op, which is the Operation that produces it as outputs.
Tensor also has .consumers(), which is a list of Operations which take the Tensor as inputs.



input_to_my_sum is a Tensor, the result of the Add.
input_to_my_sum.op is a Operation, the Add Operation that produces the result input_to_my_sum.
Therefore input_to_my_sum.op.outputs contains input_to_my_sum.






share|improve this answer


























  • Well, I suspect that due to 'add' being the input to 'my_sum', then the output of 'add' should be 'my_sum'. No? (Try taking the output of the output of the output of...1000 times. you stay put on the same tensor...)

    – ShlomiF
    Nov 21 '18 at 18:36













  • I think you need to understand "Tensor" vs "Operation". The Tensor my_sum is the output of the operation Identity. The input to the operation Identity is the Tensor called c = a + b. The Tensor c is the output of an operation "add".

    – ppwwyyxx
    Nov 21 '18 at 18:39











  • Ok, I'll read up about that. But how do I get the next node of a tensor or an op if not via the outputs attribute? (Note the asymmetry with the inputs attribute)

    – ShlomiF
    Nov 21 '18 at 18:42













  • list(my_sum.op.outputs)[0] == my_sum returns True. For every tensor I've ever tried. Is outputs that useless??

    – ShlomiF
    Nov 21 '18 at 18:47











  • A Tensor has .consumers() which contains a list of Operations whose .inputs contain the Tensor. An Operation has outputs which contains a list of Tensors whose .op is the Operation. outputs and inputs are not meant to be symmetric like the way you imagine.

    – ppwwyyxx
    Nov 21 '18 at 18:58
















1












1








1








and I'm confused because the documentation explicitly states that this should give me the outputs of the op




It does give you the output of the op:



print(list(input_to_my_sum.op.outputs))
>> [<tf.Tensor 'add:0' shape=<unknown> dtype=uint8>]


So I'm not sure what you're confused about or what you're expecting.



Be sure to understand the concept of "Tensor" and "Operation". In a tensorflow graph, an Operation
takes a list of input Tensors and outputs a list of Tensors.
In Python, you can print(x) to see if x is a Tensor or Operation.



Operation has .inputs (which are Tensors) and .outputs (which are Tensors).
Tensor does not have inputs and outputs. Tensor has .op, which is the Operation that produces it as outputs.
Tensor also has .consumers(), which is a list of Operations which take the Tensor as inputs.



input_to_my_sum is a Tensor, the result of the Add.
input_to_my_sum.op is a Operation, the Add Operation that produces the result input_to_my_sum.
Therefore input_to_my_sum.op.outputs contains input_to_my_sum.






share|improve this answer
















and I'm confused because the documentation explicitly states that this should give me the outputs of the op




It does give you the output of the op:



print(list(input_to_my_sum.op.outputs))
>> [<tf.Tensor 'add:0' shape=<unknown> dtype=uint8>]


So I'm not sure what you're confused about or what you're expecting.



Be sure to understand the concept of "Tensor" and "Operation". In a tensorflow graph, an Operation
takes a list of input Tensors and outputs a list of Tensors.
In Python, you can print(x) to see if x is a Tensor or Operation.



Operation has .inputs (which are Tensors) and .outputs (which are Tensors).
Tensor does not have inputs and outputs. Tensor has .op, which is the Operation that produces it as outputs.
Tensor also has .consumers(), which is a list of Operations which take the Tensor as inputs.



input_to_my_sum is a Tensor, the result of the Add.
input_to_my_sum.op is a Operation, the Add Operation that produces the result input_to_my_sum.
Therefore input_to_my_sum.op.outputs contains input_to_my_sum.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '18 at 19:34

























answered Nov 21 '18 at 18:34









ppwwyyxxppwwyyxx

41945




41945













  • Well, I suspect that due to 'add' being the input to 'my_sum', then the output of 'add' should be 'my_sum'. No? (Try taking the output of the output of the output of...1000 times. you stay put on the same tensor...)

    – ShlomiF
    Nov 21 '18 at 18:36













  • I think you need to understand "Tensor" vs "Operation". The Tensor my_sum is the output of the operation Identity. The input to the operation Identity is the Tensor called c = a + b. The Tensor c is the output of an operation "add".

    – ppwwyyxx
    Nov 21 '18 at 18:39











  • Ok, I'll read up about that. But how do I get the next node of a tensor or an op if not via the outputs attribute? (Note the asymmetry with the inputs attribute)

    – ShlomiF
    Nov 21 '18 at 18:42













  • list(my_sum.op.outputs)[0] == my_sum returns True. For every tensor I've ever tried. Is outputs that useless??

    – ShlomiF
    Nov 21 '18 at 18:47











  • A Tensor has .consumers() which contains a list of Operations whose .inputs contain the Tensor. An Operation has outputs which contains a list of Tensors whose .op is the Operation. outputs and inputs are not meant to be symmetric like the way you imagine.

    – ppwwyyxx
    Nov 21 '18 at 18:58





















  • Well, I suspect that due to 'add' being the input to 'my_sum', then the output of 'add' should be 'my_sum'. No? (Try taking the output of the output of the output of...1000 times. you stay put on the same tensor...)

    – ShlomiF
    Nov 21 '18 at 18:36













  • I think you need to understand "Tensor" vs "Operation". The Tensor my_sum is the output of the operation Identity. The input to the operation Identity is the Tensor called c = a + b. The Tensor c is the output of an operation "add".

    – ppwwyyxx
    Nov 21 '18 at 18:39











  • Ok, I'll read up about that. But how do I get the next node of a tensor or an op if not via the outputs attribute? (Note the asymmetry with the inputs attribute)

    – ShlomiF
    Nov 21 '18 at 18:42













  • list(my_sum.op.outputs)[0] == my_sum returns True. For every tensor I've ever tried. Is outputs that useless??

    – ShlomiF
    Nov 21 '18 at 18:47











  • A Tensor has .consumers() which contains a list of Operations whose .inputs contain the Tensor. An Operation has outputs which contains a list of Tensors whose .op is the Operation. outputs and inputs are not meant to be symmetric like the way you imagine.

    – ppwwyyxx
    Nov 21 '18 at 18:58



















Well, I suspect that due to 'add' being the input to 'my_sum', then the output of 'add' should be 'my_sum'. No? (Try taking the output of the output of the output of...1000 times. you stay put on the same tensor...)

– ShlomiF
Nov 21 '18 at 18:36







Well, I suspect that due to 'add' being the input to 'my_sum', then the output of 'add' should be 'my_sum'. No? (Try taking the output of the output of the output of...1000 times. you stay put on the same tensor...)

– ShlomiF
Nov 21 '18 at 18:36















I think you need to understand "Tensor" vs "Operation". The Tensor my_sum is the output of the operation Identity. The input to the operation Identity is the Tensor called c = a + b. The Tensor c is the output of an operation "add".

– ppwwyyxx
Nov 21 '18 at 18:39





I think you need to understand "Tensor" vs "Operation". The Tensor my_sum is the output of the operation Identity. The input to the operation Identity is the Tensor called c = a + b. The Tensor c is the output of an operation "add".

– ppwwyyxx
Nov 21 '18 at 18:39













Ok, I'll read up about that. But how do I get the next node of a tensor or an op if not via the outputs attribute? (Note the asymmetry with the inputs attribute)

– ShlomiF
Nov 21 '18 at 18:42







Ok, I'll read up about that. But how do I get the next node of a tensor or an op if not via the outputs attribute? (Note the asymmetry with the inputs attribute)

– ShlomiF
Nov 21 '18 at 18:42















list(my_sum.op.outputs)[0] == my_sum returns True. For every tensor I've ever tried. Is outputs that useless??

– ShlomiF
Nov 21 '18 at 18:47





list(my_sum.op.outputs)[0] == my_sum returns True. For every tensor I've ever tried. Is outputs that useless??

– ShlomiF
Nov 21 '18 at 18:47













A Tensor has .consumers() which contains a list of Operations whose .inputs contain the Tensor. An Operation has outputs which contains a list of Tensors whose .op is the Operation. outputs and inputs are not meant to be symmetric like the way you imagine.

– ppwwyyxx
Nov 21 '18 at 18:58







A Tensor has .consumers() which contains a list of Operations whose .inputs contain the Tensor. An Operation has outputs which contains a list of Tensors whose .op is the Operation. outputs and inputs are not meant to be symmetric like the way you imagine.

– ppwwyyxx
Nov 21 '18 at 18:58






















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53409455%2fhow-do-i-find-the-output-of-a-tensor-and-or-op-in-tensorflow-or-tensorflow-op%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith