Tensor objects are only iterable when eager execution is enabled. To iterate over this tensor use tf.map_fn.