2017-12-12 4 views
0
import tensorflow as tf 
import numpy as tf 
if __name__ == '__main__': 
    with tf.Graph().as_default(): 
     inputs = np.zeros([5,10,10,10,3]) 
     print(inputs) 
     outputs = tf.nn.conv3d(
      input=inputs, 
      filter=[5, 5, 5, 3, 8], # filter:[filter_depth, filter_height, file_width, in_channels, out_channels] 
      strides=[1, 4, 4, 4, 1], 
      padding='SAME' 
     ) 
     # outputs = get_model(inputs, True) 
     print(outputs) 

のためのランク5であってもよいが、ランク1である必要があります。Tensorflow:形状は、私がpycharmでプレーンなコードを実行すると、それはエラー情報を返す「conv3D」

ValueError: shape must be rank 5 but is rank 1 for 'conv3D'(op: 'Conv3D') with input shapes: [5,10,10,10,3],[5]. 

答えて

0

リンク参照:https://www.tensorflow.org/api_docs/python/tf/nn/conv3dフィルタを特定の変数(訓練可能)になるようにテンソルである必要がありますので、filter=[5, 5, 5, 3, 8]filter=tf.get_variable(shape=[5, 5, 5, 3, 8], dtype=tf.float64, name='filter')に変更して実行してください。

+0

はい、実際はそうです。どうもありがとうございました –

関連する問題