PaddleDetection报错:0D Tensor cannot be used as ‘Tensor.numpy()[0]‘ ...

发布时间:2026/10/3 8:11:36
PaddleDetection报错:0D Tensor cannot be used as ‘Tensor.numpy()[0]‘ ... 我在使用paddledetection进行数据训练时报了下面的错Warning:: 0D Tensor cannot be used as Tensor.numpy()[0] . In order to avoid this problem, 0D Tensor will be changed to 1D numpy currently, but its not correct and will be removed in release 2.6. For Tensor contain only one element, Please modify Tensor.numpy()[0] to float(Tensor) as soon as possible, otherwise Tensor.numpy()[0] will raise error in release 2.6.搜索之后发现这个错误可以忽略不影响训练结果。输入下列命令即可忽略解决方法Linux/Mos:export FLAGS_set_to_1dFalsewindows:set FLAGS_set_to_1dFalse补充如果一次不成功可以多试几次。当然如果一定要解决这个报错可以试试将paddledetection版本降至2.4