forked from wala/ML
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interprocedural dataset support (#69)
* Warn if we can't find the iterable definition. * Fix comment. * Actually check parameters. * Add interprocedural dataset test. * Fallback to interprocedal analysis for datasets. If the dataset iterable can't be found using intraprodecudral analysis, use interprocedural. * Apply spotless. * Add a hybrid dataset test case. * Actually check the parameter value numbers.
- Loading branch information
Showing
5 changed files
with
87 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
com.ibm.wala.cast.python.ml/source/com/ibm/wala/cast/python/ml/types/TensorFlowTypes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.ibm.wala.cast.python.ml.types; | ||
|
||
import com.ibm.wala.cast.python.types.PythonTypes; | ||
import com.ibm.wala.types.TypeName; | ||
import com.ibm.wala.types.TypeReference; | ||
|
||
/** | ||
* Types found in the TensorFlow library. | ||
* | ||
* @author <a href="mailto:[email protected]">Raffi Khatchadourian</a> | ||
*/ | ||
public class TensorFlowTypes extends PythonTypes { | ||
|
||
public static final TypeReference DATASET = | ||
TypeReference.findOrCreate(pythonLoader, TypeName.findOrCreate("Ltensorflow/data/Dataset")); | ||
|
||
private TensorFlowTypes() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import tensorflow as tf | ||
|
||
|
||
def add(a, b): | ||
return a + b | ||
|
||
|
||
def func(ds): | ||
for element in ds: | ||
c = add(element, element) | ||
|
||
|
||
dataset = tf.data.Dataset.from_tensor_slices([1, 2, 3]).shuffle(3).batch(2) | ||
func(dataset) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import tensorflow as tf | ||
|
||
|
||
@tf.function | ||
def add(a, b): | ||
return a + b | ||
|
||
|
||
def func(ds): | ||
for element in ds: | ||
c = add(element, element) | ||
|
||
|
||
dataset = tf.data.Dataset.from_tensor_slices([1, 2, 3]).shuffle(3).batch(2) | ||
func(dataset) |