Problem Description:
进行OneHot编码时报错:tensorflow.python.framework.errors_impl.InvalidArgumentError: Value for attr ‘TI’ of float is not in the list of allowed values: uint8, int32, int64
; NodeDef: {
{node OneHot}}; Op<name=OneHot; signature=indices:TI, depth:int32, on_value:T, off_value:T -> output:T; attr=axis:int,default=-1; attr=T:type; attr=TI:type,default=DT_INT64,allowed=[DT_UINT8, DT_INT32, DT_INT64]> [Op:OneHot]
Solution:
It is found that there is a problem with the initialization of y in the code, resulting in a data type error. Just re-modify the parameter type.