InvalidArgumentError: Value for attr ‘TI‘ of float is not in the list of allowed values: uint8, int3

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]
insert image description here

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.
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/qq_43750528/article/details/128446234
Recommended