Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. import tensorflow as tf
  2. import numpy as np
  3. import tensorflow.contrib.layers as lay
  4.  
  5. X = tf.constant([[1,2],[3,4]],dtype=tf.float32)
  6. with tf.variable_scope("fc1",reuse=tf.AUTO_REUSE) as scope:
  7.     w = tf.get_variable("weights",initializer=tf.constant([[1,1],[1,1]],dtype=tf.float32))
  8.     fc1 = lay.fully_connected(X,2,scope=scope,biases_initializer=tf.initializers.zeros)
  9.  
  10. vars = tf.global_variables("fc1")
  11.  
  12. sess = tf.Session()
  13. sess.run(tf.global_variables_initializer())
  14. print(vars)
  15.  
  16. res = sess.run(fc1)
  17. print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement