在运行代码时,出现报错TypeError: only integer tensors of a single element can be converted to an index
相关代码:
rotation_ab_pred = torch.eye(3, device=src.device, dtype=torch.float32).view(1, 3, 3).repeat(batch_size, 1, 1)
translation_ab_pred = torch.zeros(3, device=src.device, dtype=torch.float32).view(1, 3).repeat(batch_size, 1)
for i in range(n_iters): #此处报错
rotation_ab_pred_i, translation_ab_pred_i, rotation_ba_pred_i, translation_ba_pred_i, _ = self.forward(src, tgt)
rotation_ab_pred = torch.matmul(rotation_ab_pred_i, rotation_ab_pred)
translation_ab_pred = torch.matmul(rotation_ab_pred_i, translation_ab_pred.unsqueeze(2)).squeeze(2) + translation_ab_pred_i
src = transform_point_cloud(src, rotation_ab_pred_i, translation_ab_pred_i)
请问怎么处理呢