Created
August 8, 2018 12:18
-
-
Save yongjun823/fa621432c0986754ea51af4def3de81a to your computer and use it in GitHub Desktop.
tensorflow two session and run run
This file contains hidden or 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
| import tensorflow as tf | |
| import numpy as np | |
| class A: | |
| def __init__(self): | |
| self.X = tf.placeholder(tf.float32, [None, 10]) | |
| self.l1 = tf.layers.dense(self.X, 10) | |
| self.sess = tf.Session() | |
| self.sess.run(tf.global_variables_initializer()) | |
| def run(self): | |
| print(self.sess.run(self.l1, feed_dict={ | |
| self.X: np.ones((3, 10)) | |
| })) | |
| a1 = A() | |
| a2 = A() | |
| for i in range(10): | |
| a1.run() | |
| a2.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment