Closed zjuzxd94 closed 5 years ago
In tf.layers.dense
, This uses the weight name as the kernel
.
But I have tried with code like this:
import tensorflow as tf
with tf.variable_scope('scope', reuse=tf.AUTO_REUSE):
x = tf.get_variable('x', shape=[6,10])
y = tf.layers.dense(x, units=1)
w = tf.get_variable('kernel', shape=[10, 1])
for item in tf.trainable_variables():
print(item)
The result is:
<tf.Variable 'scope/x:0' shape=(6, 10) dtype=float32_ref> <tf.Variable 'scope/dense/kernel:0' shape=(10, 1) dtype=float32_ref> <tf.Variable 'scope/dense/bias:0' shape=(1,) dtype=float32_ref> <tf.Variable 'scope/kernel:0' shape=(10, 1) dtype=float32_ref>
Obviously, there are two kernel
variables: 'scope/dense/kernel:0' and 'scope/kernel:0'
In cleaning up the code, we changed it to high-level API. We've now modified it to the code of the paper. Thank you for the information.
In function fully_connected_with_w(), if parameter 'sn' is False, the else branch will get a variable 'w' with code
w = tf.get_variable('kernel', shape=[channels, 1])
. Is the purpose of this to get the weights in above dense layer? If so, shouldn't it be coded asw = tf.get_variable('dense/kernel', shape=[channels, 1])
? https://github.com/taki0112/UGATIT/blob/master/ops.py#L74