python - While debugging, how to print all variables (which is in list format) who are trainable in Tensorflow? -


while debugging, how print variables (which in list format) trainable in tensorflow?

for instance,

    tvars = tf.trainable_variables() 

i want check variables in tvars (which list type).

i've tried below code returns error,

    myvars = session.run([tvars])     print(myvars) 

since tf.trainable_variables() returns list of tf.variable objects, should able pass result straight session.run():

tvars = tf.trainable_variables() tvars_vals = sess.run(tvars)  var, val in zip(tvars, tvars_vals):     print(var.name, val)  # prints name of variable alongside value. 

Comments