Skip to content

Commit e92ff2a

Browse files
committed
fix(generator): ensure variadic options in secondary factory methods
1 parent e28dcc4 commit e92ff2a

File tree

3 files changed

+7
-3
lines changed
  • tensorflow-core

3 files changed

+7
-3
lines changed

tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnOps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3126,7 +3126,7 @@ public <T extends TNumber> SparseSoftmaxCrossEntropyWithLogits<T> sparseSoftmaxC
31263126
* @return a new instance of TopK, with default output types
31273127
*/
31283128
public <T extends TNumber> TopK<T, TInt32> topK(Operand<T> input, Operand<? extends TNumber> k,
3129-
TopK.Options[] options) {
3129+
TopK.Options... options) {
31303130
return TopK.create(scope, input, k, options);
31313131
}
31323132

tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/TopK.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public static <T extends TNumber, V extends TNumber> TopK<T, V> create(Scope sco
118118
describeByClass = true
119119
)
120120
public static <T extends TNumber> TopK<T, TInt32> create(Scope scope, Operand<T> input,
121-
Operand<? extends TNumber> k, Options[] options) {
121+
Operand<? extends TNumber> k, Options... options) {
122122
return create(scope, input, k, TInt32.class, options);
123123
}
124124

tensorflow-core/tensorflow-core-generator/src/main/java/org/tensorflow/generator/op/ClassGenerator.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ enum RenderMode {
105105

106106
/**
107107
* The generated options class, or null if it doesn't have one or {@link #buildOptionsClass()} has
108-
* not been ran.
108+
* not been run.
109109
*/
110110
private TypeSpec optionsClass = null;
111111

@@ -748,6 +748,10 @@ private void buildSecondaryFactory(
748748
body.add("$T.class", defaultTypes.get(attr));
749749
} else {
750750
factoryBuilder.addParameter(param);
751+
// Checking if the parameter being added is the variadic options or not
752+
if (param.name.equals("options")) {
753+
factoryBuilder.varargs();
754+
}
751755
factoryBuilder.addJavadoc("\n@param $L $L", param.name, paramTags.get(param.name));
752756
typeVars.addAll(new ResolvedType(param.type).findGenerics());
753757
body.add("$L", param.name);

0 commit comments

Comments
 (0)