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 "third level" (i.e.,
tf.x.y.z
) APIs (#85)
- Adding third level APIs - Adding more tests for experimental.numpy.ndarray Co-authored-by: Tatiana Castro-Vélez <[email protected]>
- Loading branch information
Showing
12 changed files
with
165 additions
and
5 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
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,7 @@ | ||
import tensorflow as tf | ||
|
||
def add(a, b): | ||
return a + b | ||
|
||
|
||
c = add(tf.keras.layers.Input(shape=(32,)), tf.keras.layers.Input(shape=(32,))) |
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,7 @@ | ||
import tensorflow | ||
|
||
def add(a, b): | ||
return a + b | ||
|
||
|
||
c = add(tensorflow.keras.layers.Input(shape=(32,)), tensorflow.keras.layers.Input(shape=(32,))) |
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,13 @@ | ||
import tensorflow as tf | ||
|
||
def value_index(a,b): | ||
return a.value_index + b.value_index | ||
|
||
# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/Graph#using_graphs_directly_deprecated | ||
g = tf.Graph() | ||
with g.as_default(): | ||
# Defines operation and tensor in graph | ||
c = tf.constant(30.0) | ||
assert c.graph is g | ||
|
||
result = value_index(tf.experimental.numpy.ndarray(g.get_operations()[0], 0, tf.float32), tf.experimental.numpy.ndarray(g.get_operations()[0], 0, tf.float32)) |
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 @@ | ||
from tensorflow.experimental import numpy | ||
import tensorflow as tf | ||
|
||
def value_index(a,b): | ||
return a.value_index + b.value_index | ||
|
||
# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/Graph#using_graphs_directly_deprecated | ||
g = tf.Graph() | ||
with g.as_default(): | ||
# Defines operation and tensor in graph | ||
c = tf.constant(30.0) | ||
assert c.graph is g | ||
|
||
result = value_index(numpy.ndarray(g.get_operations()[0], 0, tf.float32), numpy.ndarray(g.get_operations()[0], 0, tf.float32)) |
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 @@ | ||
from tensorflow.experimental.numpy import ndarray | ||
import tensorflow as tf | ||
|
||
def value_index(a,b): | ||
return a.value_index + b.value_index | ||
|
||
# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/Graph#using_graphs_directly_deprecated | ||
g = tf.Graph() | ||
with g.as_default(): | ||
# Defines operation and tensor in graph | ||
c = tf.constant(30.0) | ||
assert c.graph is g | ||
|
||
result = value_index(ndarray(g.get_operations()[0], 0, tf.float32), ndarray(g.get_operations()[0], 0, tf.float32)) |
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 @@ | ||
from tensorflow import experimental | ||
import tensorflow as tf | ||
|
||
def value_index(a,b): | ||
return a.value_index + b.value_index | ||
|
||
# From https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/Graph#using_graphs_directly_deprecated | ||
g = tf.Graph() | ||
with g.as_default(): | ||
# Defines operation and tensor in graph | ||
c = tf.constant(30.0) | ||
assert c.graph is g | ||
|
||
result = value_index(experimental.numpy.ndarray(g.get_operations()[0], 0, tf.float32), experimental.numpy.ndarray(g.get_operations()[0], 0, tf.float32)) |
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 func2(t): | ||
pass | ||
|
||
@tf.function | ||
def func(): | ||
a = tf.constant([[1.0, 2.0], [3.0, 4.0]]) | ||
b = tf.constant([[1.0, 1.0], [0.0, 1.0]]) | ||
c = tf.matmul(a, b) | ||
tensor = tf.experimental.numpy.ndarray(c.op, 0, tf.float32) | ||
func2(tensor) | ||
|
||
func() |
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 @@ | ||
from tensorflow import experimental | ||
import tensorflow as tf | ||
|
||
def func2(t): | ||
pass | ||
|
||
@tf.function | ||
def func(): | ||
a = tf.constant([[1.0, 2.0], [3.0, 4.0]]) | ||
b = tf.constant([[1.0, 1.0], [0.0, 1.0]]) | ||
c = tf.matmul(a, b) | ||
tensor = experimental.numpy.ndarray(c.op, 0, tf.float32) | ||
func2(tensor) | ||
|
||
func() |
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 @@ | ||
from tensorflow.experimental import numpy | ||
import tensorflow as tf | ||
|
||
def func2(t): | ||
pass | ||
|
||
@tf.function | ||
def func(): | ||
a = tf.constant([[1.0, 2.0], [3.0, 4.0]]) | ||
b = tf.constant([[1.0, 1.0], [0.0, 1.0]]) | ||
c = tf.matmul(a, b) | ||
tensor = numpy.ndarray(c.op, 0, tf.float32) | ||
func2(tensor) | ||
|
||
func() |
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 @@ | ||
from tensorflow.experimental.numpy import ndarray | ||
import tensorflow as tf | ||
|
||
def func2(t): | ||
pass | ||
|
||
@tf.function | ||
def func(): | ||
a = tf.constant([[1.0, 2.0], [3.0, 4.0]]) | ||
b = tf.constant([[1.0, 1.0], [0.0, 1.0]]) | ||
c = tf.matmul(a, b) | ||
tensor = ndarray(c.op, 0, tf.float32) | ||
func2(tensor) | ||
|
||
func() |