santi-pdp/segan

AttributeError: 'dict_values' object has no attribute 'op'

maoxin7676 opened this issue · 1 comments

When i run “d_grads = d_opt.compute_gradients(self.d_losses[-1],
var_list=self.d_vars)” in model.py
it occurs this problem “ AttributeError: 'dict_values' object has no attribute 'op' ”
How to solve this problem?
Best regards!

def get_vars(self):
t_vars = tf.trainable_variables()
self.d_vars_dict = {}
self.g_vars_dict = {}
for var in t_vars:
if var.name.startswith('d_'):
self.d_vars_dict[var.name] = var
if var.name.startswith('g_'):
self.g_vars_dict[var.name] = var
self.d_vars = self.d_vars_dict.values()
self.g_vars = self.g_vars_dict.values()
change to this:
def get_vars(self):
t_vars = tf.trainable_variables()
self.d_vars = [var for var in t_vars if 'd_' in var.name]
self.g_vars = [var for var in t_vars if 'g_' in var.name]

this way can solve the problem(model.py)