Q:

Putting sess.run output into a list

So my code has the line in it and it works:
    _, loss_value0, loss_value1, loss_value2, loss_value3 = sess.run([train_op, loss0, loss1, loss2, loss3])

I wanted to make this a list of losses so I ran:
    loss_value_list = []
    _, loss_value_list = sess.run([train_op] + loss_list)

But that doesn't work. Probably I can't assign a list like that? Is there someway to do that?
Thanks for any help!

A:

No need to pre define the loss_value_list; Use * operator to unpack the result into a list variable instead:
lst = ['a', 1, 2, 3, 4]
_, *loss_value_list = lst

loss_value_list
# [1, 2, 3, 4]

