Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extra function caused by additional summary entries for tensor generators #46

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

tatianacv
Copy link
Member

@tatianacv tatianacv commented Jun 30, 2023

This PR fixes the XML summaries so that the FQN imports (ex. from tensorflow.python.ops.variables import Variable) and traditional imports (ex. import tensorflow as tf, import tensorflow) when using the same API count as the same class. Therefore, there was a change in the expectedNumberOfTensorVariables because in

import tensorflow as tf
from tensorflow.python.ops.variables import Variable
def add(a, b):
return a + b
c = add(tf.Variable([1., 2.]), Variable([2., 2.]))
we don't count the two APIs as different, but one which is why in this PR we see a change from 4 to 3 in test such as the one above.

I also added a test that only included the FQN import to ensure we were processing that API. I added one test for the only level 2 API and one test for one of the level 1 API.

For example, tf2b.cpy and tf2c.py are essentially the same except having different ways of importing the same thing:

import tensorflow as tf
from tensorflow.python.ops.array_ops import ones
def add(a, b):
return a + b
c = add(tf.ones([1, 2]), ones([2, 2])) # [[2., 2.], [2., 2.]]

import tensorflow
def add(a, b):
return a + b
c = add(tensorflow.ones([1, 2]), tensorflow.ones([2, 2])) # [[2., 2.], [2., 2.]]

Yet, there are differences in the number of tensor variables identified (3 and 4, respectively).:

testTf2("tf2b.py", "add", 2, 3, 2, 3);
testTf2("tf2c.py", "add", 2, 4, 2, 3);

Now, we have (in this PR) 3 and 3 tensor variables, respectively (they are now the same despite the different ways of importing the same thing):

https://github.com/ponder-lab/ML/pull/46/files#diff-5b16d15bb6e50c03555d3801c21e05c34697088581cfc1c721a3b999355b5ffdL68-L69

Now, the XML summaries are structured more hierarchically.

@khatchad khatchad changed the title Creating a more compact XML summaries Fix extra function caused by additional summary entries for tensor generators Jun 30, 2023
@khatchad khatchad merged commit 3f2c4b7 into master Jun 30, 2023
@khatchad khatchad deleted the compact_summaries branch June 30, 2023 17:12
@khatchad
Copy link
Member

@tatianacv Please send this bug fix upstream. Thanks.

@khatchad khatchad added the bug Something isn't working label Jun 30, 2023
@tatianacv
Copy link
Member Author

@tatianacv Please send this bug fix upstream. Thanks.

The PR is issued in wala#80

@khatchad
Copy link
Member

Good work! Good find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants