From 5bfb8310d2c42e0eec5912a398ac55b3847320cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Mon, 23 Jan 2023 23:34:50 -0500 Subject: [PATCH 01/16] adding two missing params --- .../hybridize/core/analysis/Function.java | 41 +++++- .../testComputeParameters10/in/A.py | 14 +- .../in/requirements.txt | 1 + .../testComputeParameters11/in/A.py | 14 +- .../testComputeParameters12/in/A.py | 12 +- .../in/custom.py | 0 .../in/requirements.txt | 1 - .../testComputeParameters13/in/A.py | 13 ++ .../in/custom.py | 0 .../in/requirements.txt | 1 + .../testComputeParameters14/in/A.py | 12 ++ .../in/requirements.txt | 1 + .../testComputeParameters8/in/A.py | 13 +- .../testComputeParameters9/in/A.py | 14 +- .../HybridizeFunctionRefactoringTest.java | 121 +++++++++++++----- 15 files changed, 184 insertions(+), 74 deletions(-) rename edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/{testComputeParameters10 => testComputeParameters12}/in/custom.py (100%) create mode 100644 edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py rename edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/{testComputeParameters11 => testComputeParameters13}/in/custom.py (100%) create mode 100644 edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/requirements.txt create mode 100644 edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py create mode 100644 edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/requirements.txt 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 998901efe..9dfb92bb9 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 @@ -97,6 +97,16 @@ public class HybridizationParameters { * True iff this {@link Function}'s {@link decoratorsType} has parameter reduce_retracing. */ private boolean reduceRetracingParamExists; + + /** + * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_compile. + */ + private boolean experimentalCompileParamExists; + + /** + * True iff this {@link Function}'s {@link decoratorsType} has parameter experminetal_relax_shapes. + */ + private boolean experimentalRelaxShapesParamExists; public HybridizationParameters(IProgressMonitor monitor) throws BadLocationException { FunctionDefinition functionDefinition = Function.this.getFunctionDefinition(); @@ -139,16 +149,13 @@ else if (name.id.equals(INPUT_SIGNATURE)) else if (name.id.equals(AUTOGRAPH)) // Found parameter autograph this.autoGraphParamExists = true; - // The version of the API we are using allows - // parameter names jit_compile and - // deprecated name experimental_compile - else if (name.id.equals(JIT_COMPILE) || name.id.equals(EXPERIMENTAL_COMPILE)) + else if (name.id.equals(JIT_COMPILE)) // Found parameter jit_compile/experimental_compile this.jitCompileParamExists = true; // The version of the API we are using allows // parameter names reduce_retracing // and deprecated name experimental_relax_shapes - else if (name.id.equals(REDUCE_RETRACING) || name.id.equals(EXPERIMENTAL_RELAX_SHAPES)) + else if (name.id.equals(REDUCE_RETRACING)) // Found parameter reduce_retracing // or experimental_relax_shapes this.reduceRetracingParamExists = true; @@ -161,6 +168,12 @@ else if (name.id.equals(EXPERIMENTAL_AUTOGRAPH_OPTIONS)) else if (name.id.equals(EXPERIMENTAL_FOLLOW_TYPE_HINTS)) // Found parameter experimental_follow_type_hints this.experimentaFollowTypeHintsParamExists = true; + else if (name.id.equals(EXPERIMENTAL_COMPILE)) + // Found parameter experimental_compile + this.experimentalCompileParamExists = true; + else if (name.id.equals(EXPERIMENTAL_RELAX_SHAPES)) + // Found parameter experimental_relax_shapes + this.experimentalRelaxShapesParamExists = true; } } } // else, tf.function is used without parameters. @@ -237,6 +250,24 @@ 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() { + return this.experimentalCompileParamExists; + } + + /** + * 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() { + return this.experimentalRelaxShapesParamExists; + } } private static final String TF_FUNCTION_FQN = "tensorflow.python.eager.def_function.function"; diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py index 3de535d5e..2a176ee4c 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py @@ -1,12 +1,12 @@ -import custom +import tensorflow as tf -@custom.decorator(input_signature=None) -def func(x): - print('Tracing with', x) - return x +@tf.function +def test(x): + return x + - if __name__ == '__main__': - func(1) + x = tf.constant(1) + test(x) diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/requirements.txt b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/requirements.txt index e69de29bb..b154f958f 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/requirements.txt +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/requirements.txt @@ -0,0 +1 @@ +tensorflow==2.9.3 diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py index ac38d4cb1..11139cb78 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py @@ -1,13 +1,13 @@ -import custom import tensorflow as tf -@custom.decorator(input_signature=None) -@tf.function(autograph=False) -def func(): - pass +@tf.function(input_signature=(tf.TensorSpec(shape=[None], dtype=tf.float32),), autograph=False) +def func(x): + print('Tracing with', x) + return x if __name__ == '__main__': - func() - + number = tf.constant([1.0, 1.0]) + func(number) + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py index dd415ea3d..3de535d5e 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py @@ -1,12 +1,12 @@ -import tensorflow as tf +import custom -@tf.function(autograph=False) -@tf.function(jit_compile=True) +@custom.decorator(input_signature=None) def func(x): + print('Tracing with', x) return x - + if __name__ == '__main__': - func(tf.constant(1)) - + func(1) + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/custom.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/custom.py similarity index 100% rename from edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/custom.py rename to edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/custom.py diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/requirements.txt b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/requirements.txt index b154f958f..e69de29bb 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/requirements.txt +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/requirements.txt @@ -1 +0,0 @@ -tensorflow==2.9.3 diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py new file mode 100644 index 000000000..ac38d4cb1 --- /dev/null +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py @@ -0,0 +1,13 @@ +import custom +import tensorflow as tf + + +@custom.decorator(input_signature=None) +@tf.function(autograph=False) +def func(): + pass + + +if __name__ == '__main__': + func() + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/custom.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/custom.py similarity index 100% rename from edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/custom.py rename to edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/custom.py diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/requirements.txt b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/requirements.txt new file mode 100644 index 000000000..b154f958f --- /dev/null +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/requirements.txt @@ -0,0 +1 @@ +tensorflow==2.9.3 diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py new file mode 100644 index 000000000..dd415ea3d --- /dev/null +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py @@ -0,0 +1,12 @@ +import tensorflow as tf + + +@tf.function(autograph=False) +@tf.function(jit_compile=True) +def func(x): + return x + + +if __name__ == '__main__': + func(tf.constant(1)) + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/requirements.txt b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/requirements.txt new file mode 100644 index 000000000..b154f958f --- /dev/null +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/requirements.txt @@ -0,0 +1 @@ +tensorflow==2.9.3 diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py index 2a176ee4c..7cbf3f3ac 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py @@ -1,12 +1,11 @@ import tensorflow as tf + +@tf.function(experimental_compile=True) +def func(): + print("Testing") -@tf.function -def test(x): - return x - - + if __name__ == '__main__': - x = tf.constant(1) - test(x) + func() diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py index 11139cb78..c7c7263f0 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py @@ -1,13 +1,11 @@ import tensorflow as tf + +@tf.function(experimental_relax_shapes=True) +def func(): + print("Testing") -@tf.function(input_signature=(tf.TensorSpec(shape=[None], dtype=tf.float32),), autograph=False) -def func(x): - print('Tracing with', x) - return x - - + if __name__ == '__main__': - number = tf.constant([1.0, 1.0]) - func(number) + func() 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 bb66e27cc..a11a66c3f 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 @@ -584,9 +584,10 @@ public void testComputeParameters() throws Exception { Function.HybridizationParameters args = function.getHybridizationParameters(); assertNotNull(args); - assertTrue(args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() + assertTrue(!args.hasFuncParam() && args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() - && !args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); } /** @@ -606,9 +607,10 @@ public void testComputeParameters2() throws Exception { Function.HybridizationParameters args = function.getHybridizationParameters(); assertNotNull(args); - assertTrue(args.hasExperimentalAutographOptParam() && !args.hasAutoGraphParam() && !args.hasJitCompileParam() - && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasInputSignatureParam() - && !args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() + && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && args.hasExperimentalAutographOptParam() + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); } /** @@ -627,9 +629,10 @@ public void testComputeParameters3() throws Exception { Function.HybridizationParameters args = function.getHybridizationParameters(); assertNotNull(args); - assertTrue(!args.hasExperimentalAutographOptParam() && !args.hasAutoGraphParam() && !args.hasJitCompileParam() - && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasInputSignatureParam() - && args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() + && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && args.hasExperimentalFollowTypeHintsParam()); } /** @@ -648,9 +651,10 @@ public void testComputeParameters4() throws Exception { Function.HybridizationParameters args = function.getHybridizationParameters(); assertNotNull(args); - assertTrue(!args.hasExperimentalAutographOptParam() && !args.hasAutoGraphParam() && !args.hasJitCompileParam() - && !args.hasReduceRetracingParam() && args.hasExperimentalImplementsParam() && !args.hasInputSignatureParam() - && !args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() + && !args.hasReduceRetracingParam() && args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); } /** @@ -669,9 +673,10 @@ public void testComputeParameters5() throws Exception { Function.HybridizationParameters args = function.getHybridizationParameters(); assertNotNull(args); - assertTrue(!args.hasExperimentalAutographOptParam() && !args.hasAutoGraphParam() && args.hasJitCompileParam() - && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasInputSignatureParam() - && !args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && args.hasJitCompileParam() + && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); } /** @@ -688,9 +693,10 @@ public void testComputeParameters6() throws Exception { Function.HybridizationParameters args = function.getHybridizationParameters(); assertNotNull(args); - assertTrue(!args.hasExperimentalAutographOptParam() && !args.hasAutoGraphParam() && !args.hasJitCompileParam() - && args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasInputSignatureParam() - && !args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() + && args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); } /** @@ -709,13 +715,14 @@ public void testComputeParameters7() throws Exception { Function.HybridizationParameters args = function.getHybridizationParameters(); assertNotNull(args); - assertTrue(!args.hasExperimentalAutographOptParam() && args.hasAutoGraphParam() && !args.hasJitCompileParam() - && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasInputSignatureParam() - && !args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & args.hasAutoGraphParam() && !args.hasJitCompileParam() + && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); } /** - * Test for #30. This simply tests whether we can identify when there are no tf.function args. + * Test for #30. This simply tests whether we can parse the tf.function argument experimental_compile. */ @Test public void testComputeParameters8() throws Exception { @@ -730,13 +737,14 @@ public void testComputeParameters8() throws Exception { Function.HybridizationParameters args = function.getHybridizationParameters(); assertNotNull(args); - assertTrue(!args.hasInputSignatureParam() && !args.hasAutoGraphParam() && !args.hasJitCompileParam() + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() - && !args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + && !args.hasExperimentalRelaxShapesParam() && args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); } /** - * Test for #30. This simply tests whether we can parse tf.function arguments when we have multiple. + * Test for #30. This simply tests whether we can parse the tf.function argument experimental_relax_shapes. */ @Test public void testComputeParameters9() throws Exception { @@ -751,13 +759,14 @@ public void testComputeParameters9() throws Exception { Function.HybridizationParameters args = function.getHybridizationParameters(); assertNotNull(args); - assertTrue(args.hasInputSignatureParam() && args.hasAutoGraphParam() && !args.hasJitCompileParam() + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() - && !args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + && args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); } /** - * Test for #30. Test custom decorator with the same parameter names as tf.function. + * Test for #30. This simply tests whether we can identify when there are no tf.function args. */ @Test public void testComputeParameters10() throws Exception { @@ -767,6 +776,50 @@ public void testComputeParameters10() throws Exception { Function function = functions.iterator().next(); assertNotNull(function); + assertTrue(function.isHybrid()); + + Function.HybridizationParameters args = function.getHybridizationParameters(); + assertNotNull(args); + + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() + && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); + } + + /** + * Test for #30. This simply tests whether we can parse tf.function arguments when we have multiple. + */ + @Test + public void testComputeParameters11() throws Exception { + Set functions = this.getFunctions(); + assertNotNull(functions); + assertEquals(1, functions.size()); + Function function = functions.iterator().next(); + assertNotNull(function); + + assertTrue(function.isHybrid()); + + Function.HybridizationParameters args = function.getHybridizationParameters(); + assertNotNull(args); + + assertTrue(!args.hasFuncParam() && args.hasInputSignatureParam() & args.hasAutoGraphParam() && !args.hasJitCompileParam() + && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); + } + + /** + * Test for #30. Test custom decorator with the same parameter names as tf.function. + */ + @Test + public void testComputeParameters12() throws Exception { + Set functions = this.getFunctions(); + assertNotNull(functions); + assertEquals(1, functions.size()); + Function function = functions.iterator().next(); + assertNotNull(function); + assertFalse(function.isHybrid()); Function.HybridizationParameters args = function.getHybridizationParameters(); @@ -784,7 +837,7 @@ public void testComputeParameters10() throws Exception { * count the parameters from the tf.function decorator. */ @Test - public void testComputeParameters11() throws Exception { + public void testComputeParameters13() throws Exception { Set functions = this.getFunctions(); assertNotNull(functions); assertEquals(1, functions.size()); @@ -798,9 +851,10 @@ public void testComputeParameters11() throws Exception { // like `tf.function`. But it also has a tf.function decorator, therefore args should not be Null. assertNotNull(args); - assertTrue(!args.hasInputSignatureParam() & args.hasAutoGraphParam() && !args.hasJitCompileParam() + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & args.hasAutoGraphParam() && !args.hasJitCompileParam() && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() - && !args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); } @@ -808,7 +862,7 @@ public void testComputeParameters11() throws Exception { * Test for #30. Tests two different tf.functions. Should only count the parameters of the last one. */ @Test - public void testComputeParameters12() throws Exception { + public void testComputeParameters14() throws Exception { Set functions = this.getFunctions(); assertNotNull(functions); assertEquals(1, functions.size()); @@ -820,9 +874,10 @@ public void testComputeParameters12() throws Exception { Function.HybridizationParameters args = function.getHybridizationParameters(); assertNotNull(args); - assertTrue(!args.hasInputSignatureParam() & !args.hasAutoGraphParam() && args.hasJitCompileParam() + assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && args.hasJitCompileParam() && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() - && !args.hasExperimentalFollowTypeHintsParam() && !args.hasFuncParam()); + && !args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() + && !args.hasExperimentalFollowTypeHintsParam()); } From 0f84bb07723d865357b0718fbd01fa83ebf86194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Mon, 23 Jan 2023 23:46:11 -0500 Subject: [PATCH 02/16] fix trailing whitespace --- .../edu/cuny/hunter/hybridize/core/analysis/Function.java | 8 ++++---- .../HybridizeFunction/testComputeParameters11/in/A.py | 1 - .../HybridizeFunction/testComputeParameters12/in/A.py | 3 +-- .../HybridizeFunction/testComputeParameters13/in/A.py | 1 - .../HybridizeFunction/testComputeParameters14/in/A.py | 3 +-- .../HybridizeFunction/testComputeParameters8/in/A.py | 5 ++--- .../HybridizeFunction/testComputeParameters9/in/A.py | 5 ++--- 7 files changed, 10 insertions(+), 16 deletions(-) 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 9dfb92bb9..40802de41 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 @@ -97,12 +97,12 @@ public class HybridizationParameters { * True iff this {@link Function}'s {@link decoratorsType} has parameter reduce_retracing. */ private boolean reduceRetracingParamExists; - + /** * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_compile. */ private boolean experimentalCompileParamExists; - + /** * True iff this {@link Function}'s {@link decoratorsType} has parameter experminetal_relax_shapes. */ @@ -250,7 +250,7 @@ public boolean hasJitCompileParam() { public boolean hasReduceRetracingParam() { return this.reduceRetracingParamExists; } - + /** * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_compile. * @@ -259,7 +259,7 @@ public boolean hasReduceRetracingParam() { public boolean hasExperimentalCompileParam() { return this.experimentalCompileParamExists; } - + /** * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_relax_shapes. * diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py index 11139cb78..2ea60445d 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py @@ -10,4 +10,3 @@ def func(x): if __name__ == '__main__': number = tf.constant([1.0, 1.0]) func(number) - diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py index 3de535d5e..79ab565ca 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py @@ -6,7 +6,6 @@ def func(x): print('Tracing with', x) return x - + if __name__ == '__main__': func(1) - diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py index ac38d4cb1..2b39f30c1 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py @@ -10,4 +10,3 @@ def func(): if __name__ == '__main__': func() - diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py index dd415ea3d..981dfe88e 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py @@ -6,7 +6,6 @@ def func(x): return x - + if __name__ == '__main__': func(tf.constant(1)) - diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py index 7cbf3f3ac..6ff0f0b5d 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py @@ -1,11 +1,10 @@ import tensorflow as tf - + @tf.function(experimental_compile=True) def func(): print("Testing") - + if __name__ == '__main__': func() - diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py index c7c7263f0..ef0d0c27d 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py @@ -1,11 +1,10 @@ import tensorflow as tf - + @tf.function(experimental_relax_shapes=True) def func(): print("Testing") - + if __name__ == '__main__': func() - From fe4a4f05777e71daeed10e847409d0bc51a4836d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Thu, 26 Jan 2023 15:40:26 -0500 Subject: [PATCH 03/16] Progress --- .../hybridize/core/analysis/Function.java | 28 +++------ .../testComputeParameters10/in/A.py | 13 ++--- .../in/custom.py | 0 .../in/requirements.txt | 1 - .../testComputeParameters11/in/A.py | 12 ++-- .../in/custom.py | 0 .../testComputeParameters12/in/A.py | 8 +-- .../in/requirements.txt | 1 + .../testComputeParameters13/in/A.py | 12 ---- .../in/requirements.txt | 1 - .../testComputeParameters14/in/A.py | 11 ---- .../in/requirements.txt | 1 - .../testComputeParameters8/in/A.py | 10 ++-- .../testComputeParameters9/in/A.py | 10 ++-- .../HybridizeFunctionRefactoringTest.java | 58 +++---------------- 15 files changed, 44 insertions(+), 122 deletions(-) rename edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/{testComputeParameters12 => testComputeParameters10}/in/custom.py (100%) rename edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/{testComputeParameters13 => testComputeParameters11}/in/custom.py (100%) delete mode 100644 edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py delete mode 100644 edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/requirements.txt delete mode 100644 edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py delete mode 100644 edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/requirements.txt 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 40802de41..a6c721367 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 @@ -98,16 +98,6 @@ public class HybridizationParameters { */ private boolean reduceRetracingParamExists; - /** - * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_compile. - */ - private boolean experimentalCompileParamExists; - - /** - * True iff this {@link Function}'s {@link decoratorsType} has parameter experminetal_relax_shapes. - */ - private boolean experimentalRelaxShapesParamExists; - public HybridizationParameters(IProgressMonitor monitor) throws BadLocationException { FunctionDefinition functionDefinition = Function.this.getFunctionDefinition(); decoratorsType[] decoratorArray = functionDefinition.getFunctionDef().decs; @@ -149,13 +139,16 @@ else if (name.id.equals(INPUT_SIGNATURE)) else if (name.id.equals(AUTOGRAPH)) // Found parameter autograph this.autoGraphParamExists = true; - else if (name.id.equals(JIT_COMPILE)) + // The version of the API we are using allows + // parameter names jit_compile and + // deprecated name experimental_compile + else if (name.id.equals(JIT_COMPILE) || name.id.equals(EXPERIMENTAL_COMPILE)) // Found parameter jit_compile/experimental_compile this.jitCompileParamExists = true; // The version of the API we are using allows // parameter names reduce_retracing // and deprecated name experimental_relax_shapes - else if (name.id.equals(REDUCE_RETRACING)) + else if (name.id.equals(REDUCE_RETRACING) || name.id.equals(EXPERIMENTAL_RELAX_SHAPES)) // Found parameter reduce_retracing // or experimental_relax_shapes this.reduceRetracingParamExists = true; @@ -168,12 +161,6 @@ else if (name.id.equals(EXPERIMENTAL_AUTOGRAPH_OPTIONS)) else if (name.id.equals(EXPERIMENTAL_FOLLOW_TYPE_HINTS)) // Found parameter experimental_follow_type_hints this.experimentaFollowTypeHintsParamExists = true; - else if (name.id.equals(EXPERIMENTAL_COMPILE)) - // Found parameter experimental_compile - this.experimentalCompileParamExists = true; - else if (name.id.equals(EXPERIMENTAL_RELAX_SHAPES)) - // Found parameter experimental_relax_shapes - this.experimentalRelaxShapesParamExists = true; } } } // else, tf.function is used without parameters. @@ -257,7 +244,7 @@ public boolean hasReduceRetracingParam() { * @return True iff this {@link Function} has parameter experimental_compile. */ public boolean hasExperimentalCompileParam() { - return this.experimentalCompileParamExists; + return this.jitCompileParamExists; } /** @@ -266,8 +253,9 @@ public boolean hasExperimentalCompileParam() { * @return True iff this {@link Function} has parameter experimental_relax_shapes. */ public boolean hasExperimentalRelaxShapesParam() { - return this.experimentalRelaxShapesParamExists; + return this.reduceRetracingParamExists; } + } private static final String TF_FUNCTION_FQN = "tensorflow.python.eager.def_function.function"; diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py index 2a176ee4c..79ab565ca 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py @@ -1,12 +1,11 @@ -import tensorflow as tf +import custom -@tf.function -def test(x): - return x +@custom.decorator(input_signature=None) +def func(x): + print('Tracing with', x) + return x if __name__ == '__main__': - x = tf.constant(1) - test(x) - + func(1) diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/custom.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/custom.py similarity index 100% rename from edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/custom.py rename to edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/custom.py diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/requirements.txt b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/requirements.txt index b154f958f..e69de29bb 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/requirements.txt +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/requirements.txt @@ -1 +0,0 @@ -tensorflow==2.9.3 diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py index 2ea60445d..2b39f30c1 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py @@ -1,12 +1,12 @@ +import custom import tensorflow as tf -@tf.function(input_signature=(tf.TensorSpec(shape=[None], dtype=tf.float32),), autograph=False) -def func(x): - print('Tracing with', x) - return x +@custom.decorator(input_signature=None) +@tf.function(autograph=False) +def func(): + pass if __name__ == '__main__': - number = tf.constant([1.0, 1.0]) - func(number) + func() diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/custom.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/custom.py similarity index 100% rename from edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/custom.py rename to edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/custom.py diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py index 79ab565ca..981dfe88e 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py @@ -1,11 +1,11 @@ -import custom +import tensorflow as tf -@custom.decorator(input_signature=None) +@tf.function(autograph=False) +@tf.function(jit_compile=True) def func(x): - print('Tracing with', x) return x if __name__ == '__main__': - func(1) + func(tf.constant(1)) diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/requirements.txt b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/requirements.txt index e69de29bb..b154f958f 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/requirements.txt +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/requirements.txt @@ -0,0 +1 @@ +tensorflow==2.9.3 diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py deleted file mode 100644 index 2b39f30c1..000000000 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/A.py +++ /dev/null @@ -1,12 +0,0 @@ -import custom -import tensorflow as tf - - -@custom.decorator(input_signature=None) -@tf.function(autograph=False) -def func(): - pass - - -if __name__ == '__main__': - func() diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/requirements.txt b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/requirements.txt deleted file mode 100644 index b154f958f..000000000 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters13/in/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -tensorflow==2.9.3 diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py deleted file mode 100644 index 981dfe88e..000000000 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/A.py +++ /dev/null @@ -1,11 +0,0 @@ -import tensorflow as tf - - -@tf.function(autograph=False) -@tf.function(jit_compile=True) -def func(x): - return x - - -if __name__ == '__main__': - func(tf.constant(1)) diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/requirements.txt b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/requirements.txt deleted file mode 100644 index b154f958f..000000000 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters14/in/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -tensorflow==2.9.3 diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py index 6ff0f0b5d..2a176ee4c 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters8/in/A.py @@ -1,10 +1,12 @@ import tensorflow as tf -@tf.function(experimental_compile=True) -def func(): - print("Testing") +@tf.function +def test(x): + return x if __name__ == '__main__': - func() + x = tf.constant(1) + test(x) + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py index ef0d0c27d..2ea60445d 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py @@ -1,10 +1,12 @@ import tensorflow as tf -@tf.function(experimental_relax_shapes=True) -def func(): - print("Testing") +@tf.function(input_signature=(tf.TensorSpec(shape=[None], dtype=tf.float32),), autograph=False) +def func(x): + print('Tracing with', x) + return x if __name__ == '__main__': - func() + number = tf.constant([1.0, 1.0]) + func(number) 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 a11a66c3f..3ad22d7e4 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 @@ -675,7 +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.hasExperimentalRelaxShapesParam() && args.hasExperimentalCompileParam() && !args.hasExperimentalFollowTypeHintsParam()); } @@ -695,7 +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.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() && !args.hasExperimentalFollowTypeHintsParam()); } @@ -721,55 +721,11 @@ public void testComputeParameters7() throws Exception { && !args.hasExperimentalFollowTypeHintsParam()); } - /** - * Test for #30. This simply tests whether we can parse the tf.function argument experimental_compile. - */ - @Test - public void testComputeParameters8() throws Exception { - Set functions = this.getFunctions(); - assertNotNull(functions); - assertEquals(1, functions.size()); - Function function = functions.iterator().next(); - assertNotNull(function); - - assertTrue(function.isHybrid()); - - Function.HybridizationParameters args = function.getHybridizationParameters(); - assertNotNull(args); - - assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() - && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() - && !args.hasExperimentalRelaxShapesParam() && args.hasExperimentalCompileParam() - && !args.hasExperimentalFollowTypeHintsParam()); - } - - /** - * Test for #30. This simply tests whether we can parse the tf.function argument experimental_relax_shapes. - */ - @Test - public void testComputeParameters9() throws Exception { - Set functions = this.getFunctions(); - assertNotNull(functions); - assertEquals(1, functions.size()); - Function function = functions.iterator().next(); - assertNotNull(function); - - assertTrue(function.isHybrid()); - - Function.HybridizationParameters args = function.getHybridizationParameters(); - assertNotNull(args); - - assertTrue(!args.hasFuncParam() && !args.hasInputSignatureParam() & !args.hasAutoGraphParam() && !args.hasJitCompileParam() - && !args.hasReduceRetracingParam() && !args.hasExperimentalImplementsParam() && !args.hasExperimentalAutographOptParam() - && args.hasExperimentalRelaxShapesParam() && !args.hasExperimentalCompileParam() - && !args.hasExperimentalFollowTypeHintsParam()); - } - /** * Test for #30. This simply tests whether we can identify when there are no tf.function args. */ @Test - public void testComputeParameters10() throws Exception { + public void testComputeParameters8() throws Exception { Set functions = this.getFunctions(); assertNotNull(functions); assertEquals(1, functions.size()); @@ -791,7 +747,7 @@ public void testComputeParameters10() throws Exception { * Test for #30. This simply tests whether we can parse tf.function arguments when we have multiple. */ @Test - public void testComputeParameters11() throws Exception { + public void testComputeParameters9() throws Exception { Set functions = this.getFunctions(); assertNotNull(functions); assertEquals(1, functions.size()); @@ -813,7 +769,7 @@ public void testComputeParameters11() throws Exception { * Test for #30. Test custom decorator with the same parameter names as tf.function. */ @Test - public void testComputeParameters12() throws Exception { + public void testComputeParameters10() throws Exception { Set functions = this.getFunctions(); assertNotNull(functions); assertEquals(1, functions.size()); @@ -837,7 +793,7 @@ public void testComputeParameters12() throws Exception { * count the parameters from the tf.function decorator. */ @Test - public void testComputeParameters13() throws Exception { + public void testComputeParameters11() throws Exception { Set functions = this.getFunctions(); assertNotNull(functions); assertEquals(1, functions.size()); @@ -862,7 +818,7 @@ public void testComputeParameters13() throws Exception { * Test for #30. Tests two different tf.functions. Should only count the parameters of the last one. */ @Test - public void testComputeParameters14() throws Exception { + public void testComputeParameters12() throws Exception { Set functions = this.getFunctions(); assertNotNull(functions); assertEquals(1, functions.size()); From b13b3d24df83bdf14e5effb9ff64162efd1ebcb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Thu, 26 Jan 2023 15:47:40 -0500 Subject: [PATCH 04/16] Fix --- .../hybridize/tests/HybridizeFunctionRefactoringTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3ad22d7e4..0af78da27 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 @@ -832,7 +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.hasExperimentalRelaxShapesParam() && args.hasExperimentalCompileParam() && !args.hasExperimentalFollowTypeHintsParam()); } From 3ca358f10d97c8ea9eb9ca96e7a5c442ee3e220e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Sun, 26 Feb 2023 17:38:26 -0500 Subject: [PATCH 05/16] Maintaining the same format --- .../HybridizeFunction/testComputeParameters10/in/A.py | 3 ++- .../HybridizeFunction/testComputeParameters11/in/A.py | 1 + .../HybridizeFunction/testComputeParameters12/in/A.py | 3 ++- .../resources/HybridizeFunction/testComputeParameters9/in/A.py | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py index 79ab565ca..3de535d5e 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py @@ -6,6 +6,7 @@ def func(x): print('Tracing with', x) return x - + if __name__ == '__main__': func(1) + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py index 2b39f30c1..ac38d4cb1 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py @@ -10,3 +10,4 @@ def func(): if __name__ == '__main__': func() + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py index 981dfe88e..dd415ea3d 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py @@ -6,6 +6,7 @@ def func(x): return x - + if __name__ == '__main__': func(tf.constant(1)) + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py index 2ea60445d..11139cb78 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py @@ -10,3 +10,4 @@ def func(x): if __name__ == '__main__': number = tf.constant([1.0, 1.0]) func(number) + From e659e9321b353fbebc2e3cd58d80857af569a8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Sun, 26 Feb 2023 17:40:54 -0500 Subject: [PATCH 06/16] Formatting, trailing whitespace --- .../HybridizeFunction/testComputeParameters10/in/A.py | 3 +-- .../HybridizeFunction/testComputeParameters11/in/A.py | 1 - .../HybridizeFunction/testComputeParameters12/in/A.py | 1 - .../resources/HybridizeFunction/testComputeParameters9/in/A.py | 2 +- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py index 3de535d5e..79ab565ca 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py @@ -6,7 +6,6 @@ def func(x): print('Tracing with', x) return x - + if __name__ == '__main__': func(1) - diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py index ac38d4cb1..2b39f30c1 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py @@ -10,4 +10,3 @@ def func(): if __name__ == '__main__': func() - diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py index dd415ea3d..eeab7c3a5 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py @@ -9,4 +9,3 @@ def func(x): if __name__ == '__main__': func(tf.constant(1)) - diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py index 11139cb78..ea262826a 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py @@ -10,4 +10,4 @@ def func(x): if __name__ == '__main__': number = tf.constant([1.0, 1.0]) func(number) - + From 3f284f152448a412f8b077db044b7bdf2db45bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Sun, 26 Feb 2023 17:44:51 -0500 Subject: [PATCH 07/16] Maintaining the same format --- .../HybridizeFunction/testComputeParameters10/in/A.py | 3 ++- .../HybridizeFunction/testComputeParameters11/in/A.py | 1 + .../HybridizeFunction/testComputeParameters12/in/A.py | 1 + .../resources/HybridizeFunction/testComputeParameters9/in/A.py | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py index 79ab565ca..3de535d5e 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters10/in/A.py @@ -6,6 +6,7 @@ def func(x): print('Tracing with', x) return x - + if __name__ == '__main__': func(1) + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py index 2b39f30c1..ac38d4cb1 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters11/in/A.py @@ -10,3 +10,4 @@ def func(): if __name__ == '__main__': func() + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py index eeab7c3a5..dd415ea3d 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters12/in/A.py @@ -9,3 +9,4 @@ def func(x): if __name__ == '__main__': func(tf.constant(1)) + diff --git a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py index ea262826a..11139cb78 100644 --- a/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py +++ b/edu.cuny.hunter.hybridize.tests/resources/HybridizeFunction/testComputeParameters9/in/A.py @@ -10,4 +10,4 @@ def func(x): if __name__ == '__main__': number = tf.constant([1.0, 1.0]) func(number) - + From f587254bc6517c81e4c40ae2cd96374e1ff56739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Sun, 26 Feb 2023 20:27:45 -0500 Subject: [PATCH 08/16] Passing build --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 939927e8a..7d7dbbd8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,9 @@ before_install: - sudo update-alternatives --auto python3 - sudo apt install -y python3.10-distutils - curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 + - export PATH=`echo $PATH | tr ":" "\n" | grep -v "/opt/pyenv/shims" | tr "\n" ":"` + - export PATH=`echo $PATH | tr ":" "\n" | grep -v "/home/travis/.phpenv/shims" | tr "\n" ":"` + - PATH="$PATH:/usr/bin/python3" services: - xvfb install: From fee0cbc9f2d9830fab494d475e0ac6143c58dc60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Mon, 6 Mar 2023 11:15:48 -0500 Subject: [PATCH 09/16] Adding more information --- .../cuny/hunter/hybridize/core/analysis/Function.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 8fba3bb0d..ebfe42fc2 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 @@ -242,7 +242,9 @@ public boolean hasReduceRetracingParam() { } /** - * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_compile. + * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_compile. In our accepted interval versions of + * the API, it allows parameter names jit_compile and deprecated name experimental_compile. If a client is using this, they might + * not know about what is deprecated or not, therefore we need to include all the deprecated arguments to be complete. * * @return True iff this {@link Function} has parameter experimental_compile. */ @@ -251,7 +253,10 @@ public boolean hasExperimentalCompileParam() { } /** - * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_relax_shapes. + * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_relax_shapes. In our accepted interval + * versions of the API, it allows parameter names reduce_retracing and deprecated name experimental_relax_shapes. If a client is + * using this, they might not know about what is deprecated or not, therefore we need to include all the deprecated arguments to be + * complete. * * @return True iff this {@link Function} has parameter experimental_relax_shapes. */ From 8f79e3486851139e9af97d028578b84456a56876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Mon, 6 Mar 2023 11:23:34 -0500 Subject: [PATCH 10/16] Adding more information --- .../hunter/hybridize/core/analysis/Function.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 ebfe42fc2..8a5988f53 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 @@ -242,25 +242,24 @@ public boolean hasReduceRetracingParam() { } /** - * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_compile. In our accepted interval versions of - * the API, it allows parameter names jit_compile and deprecated name experimental_compile. If a client is using this, they might - * not know about what is deprecated or not, therefore we need to include all the deprecated arguments to be complete. + * 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 we put + // look for both strings and store it into this boolean variable. return this.jitCompileParamExists; } /** - * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_relax_shapes. In our accepted interval - * versions of the API, it allows parameter names reduce_retracing and deprecated name experimental_relax_shapes. If a client is - * using this, they might not know about what is deprecated or not, therefore we need to include all the deprecated arguments to be - * complete. + * 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 we put look for both strings and store it into this boolean variable. return this.reduceRetracingParamExists; } From 2215e1f0094bbd81e2ef4613707cd7def0df82b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Tue, 7 Mar 2023 23:06:42 -0500 Subject: [PATCH 11/16] Restructure sentence --- .../edu/cuny/hunter/hybridize/core/analysis/Function.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 8a5988f53..cea5b38ed 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 @@ -247,8 +247,8 @@ public boolean hasReduceRetracingParam() { * @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 we put - // look for both strings and store it into this boolean variable. + // Since jit_compile and experimental_compile (deprecated) have the same functionalities, when we parse these parameters together + // and store it into this boolean variable. return this.jitCompileParamExists; } @@ -259,7 +259,7 @@ public boolean hasExperimentalCompileParam() { */ public boolean hasExperimentalRelaxShapesParam() { // Since reduce_retracing and experimental_relax_shapes (deprecated) have the same functionalities, when we parse these - // parameters we put look for both strings and store it into this boolean variable. + // parameters together and store it into this boolean variable. return this.reduceRetracingParamExists; } From f4047bf32bc929045adf4e2ccae3eea270e2ebd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Tue, 7 Mar 2023 23:07:42 -0500 Subject: [PATCH 12/16] Restructure sentence --- .../src/edu/cuny/hunter/hybridize/core/analysis/Function.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 cea5b38ed..c27678a44 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 @@ -248,7 +248,7 @@ public boolean hasReduceRetracingParam() { */ public boolean hasExperimentalCompileParam() { // Since jit_compile and experimental_compile (deprecated) have the same functionalities, when we parse these parameters together - // and store it into this boolean variable. + // and store it into the same boolean variable. return this.jitCompileParamExists; } @@ -259,7 +259,7 @@ public boolean hasExperimentalCompileParam() { */ 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 this boolean variable. + // parameters together and store it into the same boolean variable. return this.reduceRetracingParamExists; } From cbfd513402766d73feba807738d2a4ad654fd253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Wed, 15 Mar 2023 17:21:10 -0400 Subject: [PATCH 13/16] Adding additional information to field description (link included) --- .../cuny/hunter/hybridize/core/analysis/Function.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 c27678a44..e0e9eee6c 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 URL. */ 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 + * URL. */ private boolean reduceRetracingParamExists; @@ -247,8 +250,8 @@ public boolean hasReduceRetracingParam() { * @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. + // 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; } From 3ffd5a924f140152d63b57df9bab2bc4cb479f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Tue, 21 Mar 2023 22:52:52 -0400 Subject: [PATCH 14/16] Adding specific URLs --- .../hybridize/core/analysis/Function.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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 e0e9eee6c..4127c8685 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 @@ -93,14 +93,15 @@ public class HybridizationParameters { /** * True iff this {@link Function}'s {@link decoratorsType} has parameter jit_compile and deprecated name experimental_compile. For - * more information, you can see this URL. + * more information, you can see this + * URL. */ private boolean jitCompileParamExists; /** * 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 - * URL. + * URL. */ private boolean reduceRetracingParamExists; @@ -245,24 +246,26 @@ public boolean hasReduceRetracingParam() { } /** - * True iff this {@link Function}'s {@link decoratorsType} has parameter experimental_compile. + * 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() { - // 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. + * 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() { - // 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; } From 617cfb570bede1441ea840939a93d18b3a542533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Wed, 22 Mar 2023 09:42:07 -0400 Subject: [PATCH 15/16] removing HTML --- .../edu/cuny/hunter/hybridize/core/analysis/Function.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 4127c8685..d1fe86c16 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 @@ -93,15 +93,14 @@ public class HybridizationParameters { /** * True iff this {@link Function}'s {@link decoratorsType} has parameter jit_compile and deprecated name experimental_compile. For - * more information, you can see this - * URL. + * more information, you can see this https://tensorflow.org/versions/r2.9/api_docs/python/tf/function#experimental_compile. */ private boolean jitCompileParamExists; /** * 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 - * URL. + * https://tensorflow.org/versions/r2.9/api_docs/python/tf/function#experimental_relax_shapes */ private boolean reduceRetracingParamExists; From 0d64c55b3cfc80a6effe75bd48c12aceb4502499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatiana=20Castro-V=C3=A9lez?= Date: Fri, 31 Mar 2023 17:09:48 -0400 Subject: [PATCH 16/16] matching anchor with field name --- .../src/edu/cuny/hunter/hybridize/core/analysis/Function.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 cc3a6c0ed..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 @@ -93,14 +93,14 @@ public class HybridizationParameters { /** * 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#experimental_compile. + * 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 and deprecated name * experimental_relax_shapes. For more information, you can see this - * https://tensorflow.org/versions/r2.9/api_docs/python/tf/function#experimental_relax_shapes + * https://tensorflow.org/versions/r2.9/api_docs/python/tf/function#reduce_retracing */ private boolean reduceRetracingParamExists;