出现问题:
tensorflow.python.framework.errors_impl.InvalidArgumentError: slice index 2 of dimension 0 out of bounds. for 'strided_slice_2' (op: 'StridedSlice') with input shapes: [2], [1], [1], [1] and with computed input tensors: input[1] = <2>, input[2] = <3>, input[3]
ValueError: slice index 2 of dimension 0 out of bounds. for 'strided_slice_2' (op: 'StridedSlice') with input shapes: [2], [1], [1], [1] and with computed input tensors: input[1] = <2>, input[2] = <3>, input[3] = <1>.
解决方案:
会出现这种问题,一般都是参数问题。参数不匹配,一定要检查参数的维度。
1、如导入模型的时候,与训练的时候模型参数不一致
2、可能你生成的参数量长度为2,但是你用这个参数的时候却用了其他的数量。比如我这里的shape=[4]。是根据我的augs来的,都是四个,所以才生成四个长度。如若你在更改的时候,这数字不匹配,就会出现这种问题。

博客指出TensorFlow出现'slice index 2 of dimension 0 out of bounds'错误,包括InvalidArgumentError和ValueError。解决方案强调问题多因参数不匹配,如导入模型时与训练时参数不一致,或生成参数量长度和使用时不匹配,需检查参数维度。

被折叠的 条评论
为什么被折叠?



