Skip to content

Add default methods to Operand to get the shape and datatype from asOutput(). #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package org.tensorflow;

import org.tensorflow.ndarray.Shape;
import org.tensorflow.op.Op;
import org.tensorflow.types.family.TType;

Expand Down Expand Up @@ -76,4 +77,18 @@ default Tensor<T> asTensor() {
default T data() {
return asOutput().tensor().data();
}

/**
* Returns the build-time shape of this operand. May be only partially known.
*/
default Shape shape(){
Copy link
Collaborator

@karllessard karllessard Nov 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we want to mark the same methods in Output as overrides now (@Override) and probably inherit the javadoc

return asOutput().shape();
}

/**
* Returns the {@link DataType} of this operand.
*/
default DataType<T> dataType(){
return asOutput().dataType();
}
}