Skip to content
Open
Show file tree
Hide file tree
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 @@ -92,12 +92,15 @@ public class HybridizationParameters {
private boolean inputSignatureParamExists;

/**
* True iff this {@link Function}'s {@link decoratorsType} has parameter jit_compile.
* True iff this {@link Function}'s {@link decoratorsType} has parameter jit_compile and deprecated name experimental_compile. For
* more information, you can see this https://tensorflow.org/versions/r2.9/api_docs/python/tf/function#jit_compile.
*/
private boolean jitCompileParamExists;

/**
* True iff this {@link Function}'s {@link decoratorsType} has parameter reduce_retracing.
* True iff this {@link Function}'s {@link decoratorsType} has parameter reduce_retracing and deprecated name
* experimental_relax_shapes. For more information, you can see this
* https://tensorflow.org/versions/r2.9/api_docs/python/tf/function#reduce_retracing
*/
private boolean reduceRetracingParamExists;

Expand Down Expand Up @@ -240,6 +243,31 @@ public boolean hasJitCompileParam() {
public boolean hasReduceRetracingParam() {
return this.reduceRetracingParamExists;
}

/**
* True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_compile. Since jit_compile and
* experimental_compile (deprecated) have the same functionalities, when we parse these parameters together it is stored into the
* same boolean variable. For more information, you can see this link
* https://tensorflow.org/versions/r2.9/api_docs/python/tf/function#experimental_compile
*
* @return True iff this {@link Function} has parameter experimental_compile.
*/
public boolean hasExperimentalCompileParam() {
return this.jitCompileParamExists;
}

/**
* True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_relax_shapes. Since reduce_retracing and
* experimental_relax_shapes (deprecated) have the same functionalities, when we parse these parameters together it is stored into
* the same boolean variable. For more information, you can see this link
* https://tensorflow.org/versions/r2.9/api_docs/python/tf/function#experimental_relax_shapes
*
* @return True iff this {@link Function} has parameter experimental_relax_shapes.
*/
public boolean hasExperimentalRelaxShapesParam() {
return this.reduceRetracingParamExists;
}

}

private static final String TF_FUNCTION_FQN = "tensorflow.python.eager.def_function.function";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ public void testComputeParameters() throws Exception {

assertTrue(!args.hasFuncParam() && args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam()
&& !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam()
&& !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam()
&& !args.hasExperimentalFollowTypeHintsParam());
}

Expand All @@ -608,6 +609,7 @@ public void testComputeParameters2() throws Exception {

assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam()
&& !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && args.hasExperimentalAutographOptParam()
&& !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam()
&& !args.hasExperimentalFollowTypeHintsParam());
}

Expand All @@ -629,6 +631,7 @@ public void testComputeParameters3() throws Exception {

assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam()
&& !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam()
&& !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam()
&& args.hasExperimentalFollowTypeHintsParam());
}

Expand All @@ -650,6 +653,7 @@ public void testComputeParameters4() throws Exception {

assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam()
&& !args.hasReduceRetracingParam() && args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam()
&& !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam()
&& !args.hasExperimentalFollowTypeHintsParam());
}

Expand All @@ -671,6 +675,7 @@ public void testComputeParameters5() throws Exception {

assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && args.hasJitCompileParam()
&& !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam()
&& !args.hasExperimentalRelaxShapesParam() && args.hasExperimentalCompileParam()
&& !args.hasExperimentalFollowTypeHintsParam());
}

Expand All @@ -690,6 +695,7 @@ public void testComputeParameters6() throws Exception {

assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam()
&& args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam()
&& args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam()
&& !args.hasExperimentalFollowTypeHintsParam());
}

Expand All @@ -711,6 +717,7 @@ public void testComputeParameters7() throws Exception {

assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & args.hasAutoGraphParam() && !args.hasJitCompileParam()
&& !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam()
&& !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam()
&& !args.hasExperimentalFollowTypeHintsParam());
}

Expand All @@ -732,6 +739,7 @@ public void testComputeParameters8() throws Exception {

assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam()
&& !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam()
&& !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam()
&& !args.hasExperimentalFollowTypeHintsParam());
}

Expand All @@ -753,6 +761,7 @@ public void testComputeParameters9() throws Exception {

assertTrue(!args.hasFuncParam() && args.hasInputSignatureParam() & args.hasAutoGraphParam() && !args.hasJitCompileParam()
&& !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam()
&& !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam()
&& !args.hasExperimentalFollowTypeHintsParam());
}

Expand Down Expand Up @@ -800,6 +809,7 @@ public void testComputeParameters11() throws Exception {

assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & args.hasAutoGraphParam() && !args.hasJitCompileParam()
&& !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam()
&& !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam()
&& !args.hasExperimentalFollowTypeHintsParam());

}
Expand All @@ -822,6 +832,7 @@ public void testComputeParameters12() throws Exception {

assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && args.hasJitCompileParam()
&& !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam()
&& !args.hasExperimentalRelaxShapesParam() && args.hasExperimentalCompileParam()
&& !args.hasExperimentalFollowTypeHintsParam());

}
Expand Down