运行 VGG16 进行多类别分类时,如何解决“无法将稀疏张量的元素转换为张量”错误?

问题描述 投票:0回答:0

我正在尝试运行 VGG16(二元分类)代码来对多类进行分类。但是我遇到了一个错误。

model.fit(train_x, train_y, epochs = 1, batch_size = 32)

TypeError: Failed to convert elements of SparseTensor(indices=Tensor("DeserializeSparse:0", shape=(None, 2), dtype=int64), values=Tensor("DeserializeSparse:1", shape=(None,), dtype=float32), dense_shape=Tensor("stack:0", shape=(2,), dtype=int64)) 到张量。考虑将元素转换为受支持的类型。见

classification
© www.soinside.com 2019 - 2024. All rights reserved.