【问题标题】:AxisError: axis 1 is out of bounds for array of dimension 1AxisError:轴 1 超出维度 1 数组的范围
【发布时间】:2019-10-06 10:35:23
【问题描述】:

enter image description here

这是我的代码:

config = Config(mode='conv')

    if config.mode == 'conv':
        X, y = build_rand_feat()
        y_flat = np.argmax(y, axis=1)
        model=get_conv_model()

    elif config.mode == 'time':
        X, y = build_rand_feat()
        y_flat = np.argmax(y,axis=1)
        input_shape = (X.shape[1], X.shape[2])
        model = get_recurrent_model()

请帮我解决这个问题。

【问题讨论】:

  • 错误很明显,你不能对一维数据执行axis=1。你可以做axis=0,但我们不知道数据是什么或你期望发生什么,所以我不能确定这是否是你需要的

标签: python arrays artificial-intelligence


【解决方案1】:

只需更改为轴 0,因为只有一维。祝你好运!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-31
    • 2022-07-03
    • 2020-10-30
    • 1970-01-01
    • 2018-07-07
    • 1970-01-01
    • 2018-05-22
    相关资源
    最近更新 更多