更新时间:2023-12-02 08:33:10
to_categorical
通常在具有列表格式标签且需要执行one-hot
编码以将其转换为正确形状时使用在训练期间将其输入模型.
to_categorical
is usually used when you have the label in the list format and you need to perform one-hot
encoding in order to transform it to the correct shape to feed it to models during training.
但是在您的情况下,标签的形状已经与模型中定义的形状相同,因此不需要one-hot
编码.
But in your case, your label is already of the same shape as you defined in your model, so the one-hot
encoding is not necessary.
您可以将None
视作batch_size
,这将使您更清楚地了解数据是如何从输入转换为输出的.
You can view the None
as batch_size
and this will give you a clearer picture of how the data are transformed from the input to the output.
谢谢!