Skip to content

NnOps topK not allowing variadic args for TopK.Options #615

@zz-x404

Description

@zz-x404

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

Describe the current behavior
In talking with @karllessard, we saw

/**
* Finds values and indices of the {@code k} largest elements for the last dimension.
* If the input is a vector (rank-1), finds the {@code k} largest entries in the vector
* and outputs their values and indices as vectors. Thus {@code values[j]} is the
* {@code j}-th largest entry in {@code input}, and its index is {@code indices[j]}.
* <p>For matrices (resp. higher rank input), computes the top {@code k} entries in each
* row (resp. vector along the last dimension). Thus,
* <pre>
* values.shape = indices.shape = input.shape[:-1] + [k]
* </pre>
* <p>If two elements are equal, the lower-index element appears first.
*
* @param input 1-D or higher with last dimension at least {@code k}.
* @param k 0-D. Number of top elements to look for along the last dimension (along each
* row for matrices).
* @param options carries optional attribute values
* @param <T> data type for {@code TopKV2} output and operands
* @return a new instance of TopK, with default output types
*/
public <T extends TNumber> TopK<T, TInt32> topK(Operand<T> input, Operand<? extends TNumber> k,
TopK.Options[] options) {
return TopK.create(scope, input, k, options);
}
that it currently accepts TopK.Options[] options

Describe the expected behavior
It should accept variadic argument TopK.Options... options just like its variant

public <T extends TNumber, V extends TNumber> TopK<T, V> topK(Operand<T> input,
Operand<? extends TNumber> k, Class<V> indexType, TopK.Options... options) {
return TopK.create(scope, input, k, indexType, options);
}

Code to reproduce the issue
Calling tf.nn.topK(input, k) would be a method not found

Other info / logs

Method topK(org.tensorflow.op.core.Placeholder,org.tensorflow.op.core.Constant) cannot be found on type org.tensorflow.op.NnOps

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions