Skip to content
Open
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
39c7fb5
update
Jan 31, 2023
f21e423
progress
Jan 31, 2023
747d5c5
Progress
Jan 31, 2023
8f8c0b1
Progress
Jan 31, 2023
4ffa27a
Progress
Jan 31, 2023
21a8004
Progress
Jan 31, 2023
89e4dd0
Progress
Feb 1, 2023
b6f4e9c
Progress
Feb 1, 2023
b9c8107
adding more testing
Feb 1, 2023
d6b110c
Fixing trailing whitespace of tests
Feb 1, 2023
26fd8f1
Fix to test
Feb 2, 2023
9a4cb62
adding other params
Feb 2, 2023
d0d0875
Progress
Feb 2, 2023
015965a
Modifying test resource
Feb 2, 2023
6102351
Modifying test resource
Feb 2, 2023
a62af55
Renaming variable
Feb 5, 2023
f7a9373
Formatting
Feb 5, 2023
c9ee308
Adding exceptions
Feb 6, 2023
0ab5892
Add more info to exception
Feb 6, 2023
db5147f
Adding new line to test resource
Feb 6, 2023
b9bd9be
Restructuring exceptions
Feb 6, 2023
9db5396
Adding new line to test resource
Feb 6, 2023
ec84857
Fixing variable name
Feb 6, 2023
74b4bc4
Progress
Feb 7, 2023
e12fb16
Removing unnecessary else
Feb 7, 2023
7aef65b
Progress
Feb 8, 2023
9f49fea
Update
Feb 8, 2023
279089b
Progress
Feb 8, 2023
ef5d5bb
Progress
Feb 8, 2023
64bd2b6
progress
Feb 8, 2023
f53e997
Progress
Feb 8, 2023
1df7219
Cleanup
Feb 8, 2023
1b2ac89
making sure we are only checking literals
Feb 10, 2023
c4184d4
Reorganization
Feb 10, 2023
d2ae4c9
Renaming
Feb 10, 2023
b48960d
Adding documentation
Feb 10, 2023
1eb7274
Adding a test where there should be an exception
Feb 10, 2023
9195db7
Formatting
Feb 10, 2023
eba9736
Test
Feb 10, 2023
dd82611
Revert "Test"
Feb 10, 2023
df97664
Update
Feb 10, 2023
54d78be
Adding new tests
Feb 10, 2023
10cb16b
Removing unnecesary files, and adding new line
Feb 10, 2023
303a117
Adding newline
Feb 10, 2023
fc90f50
Update
Feb 10, 2023
ecffbc5
Adding more tests
Feb 14, 2023
3577a39
Trailing whitespace fix
Feb 14, 2023
0c72e7d
Adding comments
Feb 14, 2023
94733e6
Make sure we are dealing with TensorSpec (input_signature)
Feb 14, 2023
41bfe8d
Revert "Make sure we are dealing with TensorSpec (input_signature)"
Feb 15, 2023
9003639
Revert "Revert "Make sure we are dealing with TensorSpec (input_signa…
Feb 24, 2023
6fd42b2
Fix build
Feb 24, 2023
1682088
Adding comments
Feb 27, 2023
02ef49b
Merge branch 'main' into 136-extract-tffunction-decorator-arguments
Mar 4, 2023
ece2522
Update
Mar 6, 2023
93f4e9c
Restructuring
Mar 9, 2023
af61fe5
Restructure
Mar 9, 2023
247e1d6
Restructure
Mar 9, 2023
9b764d9
Remove redundancy
Mar 9, 2023
bc3ff06
Restructuring
Mar 10, 2023
cb23e2f
Adding more information
Mar 10, 2023
79d0ff3
update
Mar 13, 2023
2c93c3f
Merge branch 'main' into 136-extract-tffunction-decorator-arguments
Mar 16, 2023
e690e4f
Merge branch 'main' into 136-extract-tffunction-decorator-arguments
khatchad Mar 21, 2023
bc534a4
Merge branch 'main' into 136-extract-tffunction-decorator-arguments
Mar 21, 2023
9163368
Fixing asserts
Mar 22, 2023
09d52cb
Merge branch 'main' into 136-extract-tffunction-decorator-arguments
Mar 22, 2023
d845f0a
Progress
Mar 23, 2023
6a13a5e
progress
Mar 23, 2023
4c79a5a
Progress
Mar 23, 2023
720bba7
Merge branch '136-extract-tffunction-decorator-arguments' of https://…
Mar 23, 2023
5d63094
Changing dtype
Mar 23, 2023
0c345f0
fixing comments
Mar 24, 2023
44b8b7b
Merge branch 'main' into 136-extract-tffunction-decorator-arguments
khatchad Mar 28, 2023
c5b576b
Merge branch 'main' into 136-extract-tffunction-decorator-arguments
Mar 31, 2023
f2238cf
Remove unnecessary comments, update comments, change tensorspecs shap…
Mar 31, 2023
45bcfd2
Adding another test
Mar 31, 2023
a8ddc42
remove file
Mar 31, 2023
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.

Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package edu.cuny.hunter.hybridize.core.analysis;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
* A representation of a tf.Tensorspec which describes a tf.Tensor
*/
public class TensorSpec {

public enum Dtype {
float16, float32, float64, int32, int64, uint8, uint16, uint32, uint64, int16, int8, complex64, complex128, string, bool, qint8,
quint8, qint16, quint16, qint32, bfloat16, half, resource, variant
}

/**
* Shape of the tensor being described by {@link TensorSpec}.
*/
private List<Integer> shape;

/**
* Type of the tensor being described by {@link TensorSpec}.
*/
private Dtype dtype;

public TensorSpec() {
// Initialize to empty list
this.shape = new ArrayList<>();
this.dtype = Dtype.float32;
}

public TensorSpec(List<Integer> s, Dtype d) {
this.shape = s;
this.dtype = d;
}

/**
* Shape of {@link TensorSpec}.
*
* @return List of dimensions (null if the shape is unspecified) of this {@link TensorSpec} shape.
*/
public List<Integer> getShape() {
return this.shape;
}

/**
* Dtype of {@link TensorSpec}.
*
* @return Dtype of this {@link TensorSpec} dtype.
*/
public Dtype getDType() {
return this.dtype;
}

/**
* Set shape of {@link TensorSpec}.
*/
public void setShape(List<Integer> s) {
this.shape = s;
}

/**
* Set dtype of {@link TensorSpec}.
*/
public void setDType(Dtype d) {
this.dtype = d;
}

@Override
public int hashCode() {
return Objects.hash(shape, dtype);
}

@Override
public boolean equals(Object tensorObject) {

if (tensorObject == this) {
return true;
}

if (!(tensorObject instanceof TensorSpec)) {
return false;
}

TensorSpec tensor = (TensorSpec) tensorObject;

return shape.equals(tensor.shape) && dtype.equals(tensor.dtype);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are hashCode and equals being overridden for this class? Are you comparing these or putting them into a Set (this is a question)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import tensorflow as tf


@tf.function(input_signature=None)
def func(x):
return x


if __name__ == '__main__':
number = tf.constant([1.0, 1.0])
func(number)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(jit_compile=None)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(reduce_retracing=True)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(reduce_retracing=False)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(experimental_implements="google.matmul_low_rank_matrix")
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(experimental_implements="embedded_matmul")
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(experimental_implements=None)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(experimental_autograph_options=tf.autograph.experimental.Feature.EQUALITY_OPERATORS)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(experimental_autograph_options=tf.autograph.experimental.Feature.ALL)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(experimental_autograph_options=(tf.autograph.experimental.Feature.EQUALITY_OPERATORS, tf.autograph.experimental.Feature.BUILTIN_FUNCTIONS))
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(experimental_autograph_options=None)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(input_signature=(tf.TensorSpec(shape=[None], dtype=tf.float32),))
def func(x):
return x

if __name__ == '__main__':
number = tf.constant([1.0, 1.0])
func(number)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(experimental_follow_type_hints=True)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(experimental_follow_type_hints=False)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function(experimental_follow_type_hints=None)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import tensorflow as tf


@tf.function
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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


if __name__ == '__main__':
number = tf.constant([1.0, 1.0])
func(number)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import custom


@custom.decorator(input_signature=None)
def func(x):
print('Tracing with', x)
return x


if __name__ == '__main__':
func(1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def decorator(input_signature=None):

def decorated(inner_function):

def wrapper(*args, **kwargs):
result = function(*args, **kwargs)
return result

return decorated

return decorator
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import custom
import tensorflow as tf


@custom.decorator(input_signature=None)
@tf.function(autograph=False)
def func():
pass


if __name__ == '__main__':
func()
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def decorator(input_signature=None):

def decorated(inner_function):

def wrapper(*args, **kwargs):
result = function(*args, **kwargs)
return result

return decorated

return decorator
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import tensorflow as tf

var = (tf.TensorSpec(shape=[None], dtype=tf.float32),)


@tf.function(input_signature=var)
def func(x):
return x


if __name__ == '__main__':
number = tf.constant([1.0, 1.0])
func(number)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tensorflow==2.9.3
Loading