Skip to content
Open
Show file tree
Hide file tree
Changes from 18 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 <a href="https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/function">URL</a>.
*/
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
* <a href="https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/function">URL</a>.
Copy link
Member

Choose a reason for hiding this comment

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

Just the URL is fine; we don't need HTML. I still don't see the HTML anchor reference to the specific field.

Copy link
Author

Choose a reason for hiding this comment

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

I have added it.

*/
private boolean reduceRetracingParamExists;

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

/**
* True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_compile.
*
* @return True iff this {@link Function} has parameter experimental_compile.
*/
public boolean hasExperimentalCompileParam() {
// Since jit_compile and experimental_compile (deprecated) have the same functionalities, when we parse these parameters
// together and store it into the same boolean variable.
return this.jitCompileParamExists;
}

/**
* True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_relax_shapes.
*
* @return True iff this {@link Function} has parameter experimental_relax_shapes.
*/
public boolean hasExperimentalRelaxShapesParam() {
// Since reduce_retracing and experimental_relax_shapes (deprecated) have the same functionalities, when we parse these
// parameters together and store it into the same boolean variable.
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