Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: concat() got multiple values for argument 'axis'

This is my convolution neural net:

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

where

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

are the used placeholder.

I am making a self driving car in GTA San Andreas. What I want to do is concatenate frame and controls_at_each_frame into a single layer which will be then sent to an fully connected layer. When I run I get an error TypeError: concat() got multiple values for argument 'axis' at

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

Could you explain why this happening?

like image 878
ParmuTownley Avatar asked Jul 18 '17 19:07

ParmuTownley


1 Answers

Try

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

Note I'm putting the two frames that you want to concatenate within parentheses, as specified here.

like image 197
hausdork Avatar answered Nov 07 '22 13:11

hausdork