小编mna*_*nal的帖子

使用 None 为批量大小重塑张量

基本上这个问题TensorFlow: Is there a way to convert a list with None type to a Tensor?

答案说明了为什么这是不可能的,但没有解决方法

我正在尝试制作一个自动编码器,它具有一些卷积层,这些层被展平为一些完全连接的层并重新扩展到原始维度。但是,当我尝试将展平层的输出扩展为张量时,我遇到了问题Tried to convert 'shape' to a tensor and failed. Error: Cannot convert a partially known TensorShape to a Tensor: (?, 14, 32, 128)

这基本上就是网络的样子

X=tf.placeholder(tf.float32,shape=[None, height, width, channel])
conv = Conv2D(32, (3, 3), activation='relu', padding='same')(X)
h1=actf(tf.matmul(conv,w)+b) 
output = Conv2D(32, (3, 3), activation='relu', padding='same')(tf.reshape(h1, conv.shape))
Run Code Online (Sandbox Code Playgroud)

如何在不指定批量大小的情况下重塑中间层的输出?

我也试过

output = Conv2D(32, (3, 3), activation='relu', padding='same')(tf.reshape(h1, [None, 14, 32, 128]))
Run Code Online (Sandbox Code Playgroud)

这给出了以下错误 Failed to convert object …

python tensorflow tensor

0
推荐指数
1
解决办法
3055
查看次数

标签 统计

python ×1

tensor ×1

tensorflow ×1