diff options
author | Chunseok Lee <chunseok.lee@samsung.com> | 2020-10-29 13:12:50 +0900 |
---|---|---|
committer | Chunseok Lee <chunseok.lee@samsung.com> | 2020-10-29 13:12:50 +0900 |
commit | d6b371e095d737922187a518b8faba1ef6f3a2b1 (patch) | |
tree | 9d90c09c887b5111389dbedf924f59206411cd5a /res/TensorFlowPythonExamples/examples/while_3 | |
parent | c55f8a6db48cda9d3a78048338b7f18c4cca62b8 (diff) | |
download | nnfw-d6b371e095d737922187a518b8faba1ef6f3a2b1.tar.gz nnfw-d6b371e095d737922187a518b8faba1ef6f3a2b1.tar.bz2 nnfw-d6b371e095d737922187a518b8faba1ef6f3a2b1.zip |
Imported Upstream version 0.4upstream/0.4
Diffstat (limited to 'res/TensorFlowPythonExamples/examples/while_3')
-rw-r--r-- | res/TensorFlowPythonExamples/examples/while_3/__init__.py | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/res/TensorFlowPythonExamples/examples/while_3/__init__.py b/res/TensorFlowPythonExamples/examples/while_3/__init__.py deleted file mode 100644 index 840846e7e..000000000 --- a/res/TensorFlowPythonExamples/examples/while_3/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -import tensorflow as tf - -x = tf.compat.v1.placeholder(shape=[1, None], dtype=tf.int32, name='Hole') -i = tf.compat.v1.placeholder(shape=[1, None], dtype=tf.int32, name='Hole_2') - - -def c(ii): - rs = tf.compat.v1.shape(ii) - r1 = rs[1] - return tf.compat.v1.less(r1, 10) - - -def b(ii): - return tf.concat([ii, x], axis=1) - - -# this loop changes i's shape from [1, 0] -> [1, 1] -> [1, 2] -> ... -> [1, 10] -r = tf.compat.v1.while_loop( - c, b, [i], name="While", shape_invariants=[tf.TensorShape([1, None])]) - -output = tf.compat.v1.identity(r, name="Output") - -# by adding the following code, [[123 1 2 3 1 2 3 1 2 3]] and (1, 10) will be printed -# -''' -import numpy as np -i_val = np.array([[123]], dtype=np.int32) -x_val = np.array([[1, 2, 3]], dtype=np.int32) -with tf.compat.v1.Session() as sess: - result = sess.run(r, feed_dict={x:x_val, i:i_val}) - print(result) - print(result.shape) -''' |