2017-07-18 1 views
2

Dies ist meine Faltung neuronales Netz:Typeerror: concat() bekam mehrere Werte für Argument 'Achse'

def convolutional_neural_network(frame): 
    wts = {'conv1': tf.random_normal([5, 5, 3, 32]), 
      'conv2': tf.random_normal([5, 5, 32, 64]), 
      'fc': tf.random_normal([158*117*64 + 4, 128]), 
      'out': tf.random_normal([128, n_classes]) 
      } 
    biases = {'fc': tf.random_normal([128]), 
       'out': tf.random_normal([n_classes]) 
      } 

    conv1 = conv2d(frame, wts['conv1']) 
    # print(conv1) 
    conv1 = maxpool2d(conv1) 
    # print(conv1) 
    conv2 = conv2d(conv1, wts['conv2']) 
    conv2 = maxpool2d(conv2) 
    # print(conv2) 
    conv2 = tf.reshape(conv2, shape=[-1,158*117*64]) 
    print(conv2) 
    print(controls_at_each_frame) 
    conv2 = tf.concat(conv2, controls_at_each_frame, axis=1) 
    fc = tf.add(tf.matmul(conv2, wts['fc']), biases['fc']) 

    output = tf.nn.relu(tf.add(tf.matmul(fc, wts['out']), biases['out'])) 

    return output 

wo

frame = tf.placeholder('float', [None, 640-10, 465, 3]) 
controls_at_each_frame = tf.placeholder('float', [None, 4]) # [w, a, s, d] (1/0) 

der verwendeten Platzhalter sind.

Ich mache ein selbstfahrendes Auto in GTA San Andreas. Was ich tun möchte, ist frame und controls_at_each_frame in einer einzigen Schicht verketten, die dann zu einer vollständig verbundenen Schicht gesendet werden. Als ich betreibe ich einen Fehler TypeError: concat() got multiple values for argument 'axis' bei

conv2 = tf.concat(conv2, controls_at_each_frame, axis=1) 

Könnten Sie erklären, warum dies geschieht?

Antwort

3

Versuchen

conv2 = tf.concat((conv2, controls_at_each_frame), axis=1).

Hinweis: Ich setze die zwei Rahmen, die Sie verketten möchten, in Klammern, wie angegeben here.

+0

Deshalb liebe ich stackoverflow. Hat die Antwort in nur einer Minute. Vielen Dank. –

+0

Bitte akzeptieren Sie, wenn es für Sie funktioniert! – hausdork

+0

Dachte ich schon getan. –

Verwandte Themen