Both tf.reshape(w, [-1])
and tf.squeeze(w)
are "cheap" in that they operate only on the metadata (i.e. the shape) of the given tensor, and don't modify the data itself. Of the two tf.reshape()
has slightly simpler logic internally, but the performance of the two should be indistinguishable.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…