TypeError:concat()为参数'axis'获得了多个值 [英] TypeError: concat() got multiple values for argument 'axis'

查看:89
本文介绍了TypeError:concat()为参数'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

其中

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

是使用的占位符.

我正在GTA圣安地列斯制造一辆自动驾驶汽车.我想做的是将 frame controls_at_each_frame 连接到一个单独的层中,然后将其发送到一个完全连接的层.当我运行时,出现错误 TypeError:concat()在

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?

推荐答案

尝试

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.

这篇关于TypeError:concat()为参数'axis'获得了多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆