0
私はテンソルのいくつかの整形を必要とするいくつかのテンソル・フローのコードを持っている:Tensorflow:リシェイプで使用するためget_shape()()
# sigma has shape (15000,20,2)
sigma_shape = sigma.get_shape()
# We want to reshape it to (300000,2)
sigma = tf.reshape(sigma, [-1, sigma_shape[-1]]) # (300000,2)
# Because we have to do this operation
Sigma = matrix_with_upper_values(rho) + tf.matrix_diag(tf.square(sigma))
# Reshape back, Sigma is (300000,2,2), we want it to be (15000,20,2,2)
Sigma = tf.reshape(Sigma, sigma_shape.append(sigma_shape[-1]))
は、これは、私はそれが何をしたいです。しかし:
sigma_shape
はテンソル形状オブジェクトとこのようにtf.reshapeに使用することができなかったsigma_shape[2]
Dimension(2)
あります。sigma_shape
.append(sigma_shape[-1]
)これも機能しません。これを行う別の方法がありますか?