TensorFlow: how can I sum a list of tf.Variables?

Viewed 4054

I've got a 3D array that is of tf.Variable type. tf.reduce_sum only works on individual tensors. I've tried doing:

tf.reduce_sum([tf.reduce_sum(mat) for mat in var_3Dlist])

...but tf.reduce_sum() expects a tensor and not a list. Can I convert it to a tensor somehow, or is there another, better way to do it? I haven't found anything in the API.

1 Answers
Related