ValueError: Can not squeeze dim[1], expected a dimension of 1, got 3 for 'sparse_softmax_cross_entropy_loss

前端 未结 5 682
眼角桃花
眼角桃花 2020-12-09 15:18

I tried to replace the training and validation data with local images. But when running the training code, it came up with the error :

ValueError: Ca

5条回答
  •  -上瘾入骨i
    2020-12-09 15:46

    Changing

    loss='sparse_categorical_crossentropy'
    

    to

    loss='categorical_crossentropy'
    

    worked for me.

提交回复
热议问题