Some minor note

16 views
Skip to first unread message

Zoran Sevarac

unread,
Jan 18, 2021, 5:02:16 AM1/18/21
to j...@tensorflow.org
Hi,

I was going through codebase and I've noticed few things so I have some questions and suggestions.

What is the difference between methods output() and asOutput()? It seems there is none so can we have only one, or it's something that's not finished?

public Output<T> output() {
return output;
}
@Override
public Output<T> asOutput() {
return output;
}

Best,
Zoran
--
Zoran Sevarac, PhD, Associate Professor
University of Belgrade, Faculty of Organisational Sciences, Department for Software Engineering
Java Champion | Oracle Groundbreaker Ambassador | Deep Netts Co-founder & CEO

Ryan Nett

unread,
Jan 18, 2021, 4:39:58 PM1/18/21
to SIG JVM, sev...@gmail.com
output() is the auto generated named accessor for one of the outputs (of course, there's only one), like Add.z.  It's based on the tensorflow api_def proto.  The main use is there's a few ops that have multiple outputs and thus don't extend Operand, like RequantizationRangePerChannel, and they need some way to access the outputs.

asOutput() converts the Operand to an Output (which is the op name and output index) so it can be used as input to another op.  It's generated (w/ the Operand superinterface) for ops with one output.

The Operand ops probably don't need the output accessors too, but since it's generated it was probably easier to just leave them in there.  Plus that way it matches the proto.

Zoran Sevarac

unread,
Jan 18, 2021, 6:56:43 PM1/18/21
to Ryan Nett, SIG JVM
Thanks for explaining that. I'll keep investigating the points you outlined above for a possible solution.
Intuitively I would expect to have just one getOutput() method

Best
Reply all
Reply to author
Forward
0 new messages