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

问题描述:

进行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 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]
在这里插入图片描述

解决办法:

发现代码中对于y的初始化有问题,导致数据类型错误。重新修改参数类型即可。
InvalidArgumentError: Value for attr ‘TI‘ of float is not in the list of allowed values: uint8, int3_第1张图片
InvalidArgumentError: Value for attr ‘TI‘ of float is not in the list of allowed values: uint8, int3_第2张图片

你可能感兴趣的:(bug笔记,python,tensorflow)