训练时候的bug----ValueError: slice index 2 of dimension 0 out of bounds

电玩女神 2022-10-02 07:46 88阅读 0赞

出现问题:

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来的,都是四个,所以才生成四个长度。如若你在更改的时候,这数字不匹配,就会出现这种问题。

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NvbXdheV9MaQ_size_16_color_FFFFFF_t_70

发表评论

表情:
评论列表 (有 0 条评论,88人围观)

还没有评论,来说两句吧...

相关阅读