diff --git a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java index 121484ede..dbc4a4fac 100644 --- a/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java +++ b/edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java @@ -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; @@ -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"; diff --git a/edu.cuny.hunter.hybridize.tests/test cases/edu/cuny/hunter/hybridize/tests/HybridizeFunctionRefactoringTest.java b/edu.cuny.hunter.hybridize.tests/test cases/edu/cuny/hunter/hybridize/tests/HybridizeFunctionRefactoringTest.java index 4f6f3ba50..0a241fdb1 100644 --- a/edu.cuny.hunter.hybridize.tests/test cases/edu/cuny/hunter/hybridize/tests/HybridizeFunctionRefactoringTest.java +++ b/edu.cuny.hunter.hybridize.tests/test cases/edu/cuny/hunter/hybridize/tests/HybridizeFunctionRefactoringTest.java @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); } @@ -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()); }