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

Get up-to-date #132

Merged
merged 38 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e99c8f3
Investigate decorator issue on tutorial code (#68)
khatchad Jan 3, 2024
d0aa2fa
Fix comment.
khatchad Jan 3, 2024
7eed945
Add interprocedural dataset support (#69)
khatchad Jan 4, 2024
fe1ac0b
Change log from warning to info.
khatchad Jan 5, 2024
d58df6e
Add support for non-scalar datasets (#70)
khatchad Jan 5, 2024
8e29e0f
Use interprocedural analysis for property read case.
khatchad Jan 8, 2024
24557ce
Add logging.
khatchad Jan 8, 2024
39ed0e4
Fix non-scalar determination.
khatchad Jan 8, 2024
00de323
Add logger.
khatchad Jan 10, 2024
4519a81
Fix logger.
khatchad Jan 10, 2024
46a3f50
Add logging around callable workaround.
khatchad Jan 10, 2024
48af48e
Handle callables with lexical scoping.
khatchad Jan 17, 2024
bba0048
Formatting.
khatchad Jan 17, 2024
2a42f4d
Handle possible null receivers in callable lookup.
khatchad Jan 17, 2024
1e3a201
Change log message.
khatchad Jan 18, 2024
1b49431
Add log.
khatchad Jan 18, 2024
8efb6fc
Add the ability to process datasets coming out of enumerate() (#71)
khatchad Jan 18, 2024
7feaca3
Fix tests for input files with multiple functions.
khatchad Jan 19, 2024
693d79c
Enhance TF2 tests (#73)
khatchad Jan 19, 2024
8b211dd
Separate tests by calling context (#74)
khatchad Jan 19, 2024
90640bb
Add tf.keras.layers.Dense.
khatchad Jan 19, 2024
6654b46
Move comment.
khatchad Jan 19, 2024
c0bbea3
Additional check.
khatchad Jan 19, 2024
d4a9347
New API.
khatchad Jan 23, 2024
414c4cf
Add autoencoder test.
khatchad Jan 23, 2024
deeef90
Move the value number check outside the context loop.
khatchad Jan 23, 2024
47ed5a0
More the sigmoid function to math.
khatchad Jan 23, 2024
fe91ad3
Format.
khatchad Jan 23, 2024
e4c3eb5
Add API tf.add().
khatchad Jan 23, 2024
7b2fb43
Check the context/funciton PK mappings. (#77)
khatchad Jan 23, 2024
5c95d6c
Add URL.
khatchad Jan 26, 2024
bce2d75
Add dataset generator and test.
khatchad Jan 26, 2024
03f209c
tf.nn.softmax isn't a tensor generator.
khatchad Jan 19, 2024
b9bbdfb
Add URL.
khatchad Jan 19, 2024
ee0b83b
Apply spotless.
khatchad Jan 29, 2024
13e039c
Let's make the two tests only diff in the invocation.
khatchad Nov 22, 2023
417d041
Prevent infinite recursion when processing instructions when finding …
khatchad Jan 29, 2024
f7b110a
Merge pull request #79 from ponder-lab/contrib_fix_recursion
khatchad Jan 29, 2024
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

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions com.ibm.wala.cast.python.ml/data/tensorflow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<putfield class="LRoot" field="distribute" fieldType="LRoot" ref="x" value="distribute" />
<new def="nn" class="Lobject" />
<putfield class="LRoot" field="nn" fieldType="LRoot" ref="x" value="nn" />
<new def="math" class="Lobject" />
<putfield class="LRoot" field="math" fieldType="LRoot" ref="x" value="math" />
<new def="random" class="Lobject" />
<putfield class="LRoot" field="random" fieldType="LRoot" ref="x" value="random" />
<new def="sparse" class="Lobject" />
Expand Down Expand Up @@ -59,6 +61,8 @@
<putfield class="LRoot" field="numpy_input_fn" fieldType="LRoot" ref="inputs" value="numpy_input_fn" />
<new def="from_tensor_slices" class="Ltensorflow/data/Dataset/from_tensor_slices" />
<putfield class="LRoot" field="from_tensor_slices" fieldType="LRoot" ref="Dataset" value="from_tensor_slices" />
<new def="from_generator" class="Ltensorflow/data/Dataset/from_generator" />
<putfield class="LRoot" field="from_generator" fieldType="LRoot" ref="Dataset" value="from_generator" />
<new def="reshape" class="Ltensorflow/functions/reshape" />
<putfield class="LRoot" field="reshape" fieldType="LRoot" ref="x" value="reshape" />
<new def="conv2d" class="Ltensorflow/functions/conv2d" />
Expand All @@ -67,6 +71,14 @@
<putfield class="LRoot" field="conv2d" fieldType="LRoot" ref="layers" value="conv2d" />
<new def="conv3d" class="Ltensorflow/functions/conv3d" />
<putfield class="LRoot" field="conv3d" fieldType="LRoot" ref="nn" value="conv3d" />
<new def="softmax" class="Ltensorflow/functions/softmax" />
<putfield class="LRoot" field="softmax" fieldType="LRoot" ref="nn" value="softmax" />
<new def="sigmoid" class="Ltensorflow/math/sigmoid" />
<putfield class="LRoot" field="sigmoid" fieldType="LRoot" ref="nn" value="sigmoid" />
<putfield class="LRoot" field="sigmoid" fieldType="LRoot" ref="math" value="sigmoid" />
<new def="add" class="Ltensorflow/math/add" />
<putfield class="LRoot" field="add" fieldType="LRoot" ref="x" value="add" />
<putfield class="LRoot" field="add" fieldType="LRoot" ref="math" value="add" />
<new def="placeholder" class="Ltensorflow/functions/placeholder" />
<putfield class="LRoot" field="placeholder" fieldType="LRoot" ref="x" value="placeholder" />
<new def="examples" class="Lobject" />
Expand Down Expand Up @@ -120,6 +132,8 @@
<new def="Input" class="Ltensorflow/functions/Input" />
<putfield class="LRoot" field="Input" fieldType="LRoot" ref="keras" value="Input" />
<putfield class="LRoot" field="Input" fieldType="LRoot" ref="layers" value="Input" />
<new def="Dense" class="Ltensorflow/keras/layers/Dense" />
<putfield class="LRoot" field="Dense" fieldType="LRoot" ref="layers" value="Dense" />
<new def="Variable" class="Ltensorflow/functions/Variable" />
<putfield class="LRoot" field="Variable" fieldType="LRoot" ref="x" value="Variable" />
<putfield class="LRoot" field="Variable" fieldType="LRoot" ref="variables" value="Variable" />
Expand Down Expand Up @@ -247,6 +261,26 @@
<package name="keras/objects">
<class name="feature" allocatable="true" />
</package>
<package name="tensorflow/math">
<class name="sigmoid" allocatable="true">
<!-- https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/nn/sigmoid -->
<method name="do" descriptor="()LRoot;" numArgs="3" paramNames="self x name">
<return value="x" />
</method>
</class>
<class name="add" allocatable="true">
<!-- https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/add -->
<method name="read_data" descriptor="()LRoot;">
<new def="x" class="Ltensorflow/math/add" />
<return value="x" />
</method>
<method name="do" descriptor="()LRoot;" numArgs="4" paramNames="self x y name">
<!-- Even though tf.add() isn't a tensor "generator," it can convert its non-tensor arguments to tensors. -->
<call class="LRoot" name="read_data" descriptor="()LRoot;" type="virtual" arg0="arg0" def="xx" />
<return value="xx" />
</method>
</class>
</package>
<package name="tensorflow/functions">
<class name="AdamOptimizer" allocatable="true">
<method name="do" descriptor="()LRoot;">
Expand Down Expand Up @@ -631,6 +665,12 @@
<return value="x" />
</method>
</class>
<class name="softmax" allocatable="true">
<!-- https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/nn/softmax -->
<method name="do" descriptor="()LRoot;" numArgs="4" paramNames="self logits axis name">
<return value="logits" />
</method>
</class>
</package>
<package name="tensorflow/estimator">
<class name="Estimator" allocatable="true">
Expand All @@ -650,6 +690,32 @@
</method>
</class>
</package>
<package name="tensorflow/keras/layers">
<class name="Dense" allocatable="true">
<!-- https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/keras/layers/Dense -->
<method name="do" descriptor="()LRoot;" numArgs="11" paramNames="self units activation use_bias kernel_initializer bias_initializer kernel_regularizer bias_regularizer activity_regularizer kernel_constraint bias_constraint">
<new def="__call__" class="Ltensorflow/keras/layers/__call__" />
<putfield class="LRoot" field="__call__" fieldType="LRoot" ref="arg0" value="__call__" />
<new def="call" class="Ltensorflow/keras/layers/call" />
<putfield class="LRoot" field="call" fieldType="LRoot" ref="arg0" value="call" />
<return value="arg0" />
</method>
</class>
<!-- FIXME: These methods must be called explicitly. The implicit cases blocked on https://github.com/wala/ML/issues/127. -->
<class name="__call__" allocatable="true">
<!-- https://github.com/keras-team/keras/blob/07e13740fd181fc3ddec7d9a594d8a08666645f6/keras/layers/core/dense.py#L166-L240 -->
<method name="do" descriptor="()LRoot;" numArgs="2" paramNames="self inputs">
<return value="inputs" />
</method>
</class>
<!-- FIXME: Workaround for https://github.com/wala/ML/issues/106. -->
<class name="call" allocatable="true">
<!-- https://github.com/keras-team/keras/blob/07e13740fd181fc3ddec7d9a594d8a08666645f6/keras/layers/core/dense.py#L166-L240 -->
<method name="do" descriptor="()LRoot;" numArgs="2" paramNames="self inputs">
<return value="inputs" />
</method>
</class>
</package>
<package name="tensorflow/data">
<class name="Dataset" allocatable="true">
<!-- "read_dataset" means that this function reads a tensor iterable. -->
Expand All @@ -658,6 +724,12 @@
<putfield class="LRoot" field="shuffle" fieldType="LRoot" ref="arg0" value="shuffle" />
<new def="batch" class="Ltensorflow/data/batch" />
<putfield class="LRoot" field="batch" fieldType="LRoot" ref="arg0" value="batch" />
<new def="repeat" class="Ltensorflow/data/repeat" />
<putfield class="LRoot" field="repeat" fieldType="LRoot" ref="arg0" value="repeat" />
<new def="prefetch" class="Ltensorflow/data/prefetch" />
<putfield class="LRoot" field="prefetch" fieldType="LRoot" ref="arg0" value="prefetch" />
<new def="take" class="Ltensorflow/data/take" />
<putfield class="LRoot" field="take" fieldType="LRoot" ref="arg0" value="take" />
<return value="arg0" />
</method>
<method name="do" descriptor="()LRoot;" numArgs="2" paramNames="self variant_tensor">
Expand All @@ -683,15 +755,51 @@
<return value="xx" />
</method>
</class>
<class name="repeat" allocatable="true">
<!-- https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/data/Dataset#repeat -->
<method name="do" descriptor="()LRoot;" numArgs="6" paramNames="self count name">
<!-- FIXME: Workaround for https://github.com/wala/ML/issues/127. -->
<new def="x" class="Ltensorflow/data/Dataset" />
<call class="Ltensorflow/data/Dataset" name="read_dataset" descriptor="()LRoot;" type="virtual" arg0="x" def="xx" />
<return value="xx" />
</method>
</class>
<class name="prefetch" allocatable="true">
<!-- https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/data/Dataset#prefetch -->
<method name="do" descriptor="()LRoot;" numArgs="3" paramNames="self buffer_size name">
<!-- FIXME: Workaround for https://github.com/wala/ML/issues/127. -->
<new def="x" class="Ltensorflow/data/Dataset" />
<call class="Ltensorflow/data/Dataset" name="read_dataset" descriptor="()LRoot;" type="virtual" arg0="x" def="xx" />
<return value="xx" />
</method>
</class>
<class name="take" allocatable="true">
<!-- https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/data/Dataset#take -->
<method name="do" descriptor="()LRoot;" numArgs="3" paramNames="self count name">
<!-- FIXME: Workaround for https://github.com/wala/ML/issues/127. -->
<new def="x" class="Ltensorflow/data/Dataset" />
<call class="Ltensorflow/data/Dataset" name="read_dataset" descriptor="()LRoot;" type="virtual" arg0="x" def="xx" />
<return value="xx" />
</method>
</class>
</package>
<package name="tensorflow/data/Dataset">
<class name="from_tensor_slices" allocatable="true">
<!-- https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/data/Dataset#from_tensor_slices -->
<method name="do" descriptor="()LRoot;" numArgs="2" paramNames="tensors name">
<new def="x" class="Ltensorflow/data/Dataset" />
<call class="Ltensorflow/data/Dataset" name="read_dataset" descriptor="()LRoot;" type="virtual" arg0="x" def="xx" />
<return value="xx" />
</method>
</class>
<class name="from_generator" allocatable="true">
<!-- https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/data/Dataset#from_generator -->
<method name="do" descriptor="()LRoot;" numArgs="6" paramNames="generator output_types output_shapes args output_signature name">
<new def="x" class="Ltensorflow/data/Dataset" />
<call class="Ltensorflow/data/Dataset" name="read_dataset" descriptor="()LRoot;" type="virtual" arg0="x" def="xx" />
<return value="xx" />
</method>
</class>
</package>
<package name="tensorflow/estimator/train">
<class name="train" allocatable="true">
Expand Down
Loading
Loading