Reputation: 1247
I am following this issue trying to use my own data-set with the code. The owner suggested to modify this line in the source code. I am very new to TF and python. I tried print and tf.Print() to see what is the content of restore_dict
. I admit I do not understand the code line {var.op.name: var for var in tf.global_variables() if var.op.name in restore_vars}
. What are the brackets for? what is var for var in
?
Can anyone help clarify how to debug this?
Upvotes: 1
Views: 65
Reputation: 3930
{}
is for dictionary in python. You can check more about dictionaries in python here.
now lets check this line: {var.op.name: var for var in tf.global_variables() if var.op.name in restore_vars}
What you see is python comprehension , it is popular in python and you can find a detailed explanation here.
It says loop through tf.global_variables()
and check if var.op.name
is present in restore_vars. If it is then create var.op.name:var (key-value) pair in dictionary.
Upvotes: 1