diff --git a/ppocr/losses/table_att_loss.py b/ppocr/losses/table_att_loss.py index 5f0e7806ee..c2adcf434f 100644 --- a/ppocr/losses/table_att_loss.py +++ b/ppocr/losses/table_att_loss.py @@ -69,7 +69,7 @@ def __init__(self, structure_weight, loc_weight, loc_loss="mse", **kwargs): def forward(self, predicts, batch): structure_probs = predicts["structure_probs"] structure_targets = batch[1].astype("int64") - max_len = batch[-2].max() + max_len = batch[-2].max().astype("int32") structure_targets = structure_targets[:, 1 : max_len + 2] structure_loss = self.loss_func(structure_probs, structure_targets) diff --git a/ppocr/modeling/heads/table_att_head.py b/ppocr/modeling/heads/table_att_head.py index 50a26e8117..6500f969a9 100644 --- a/ppocr/modeling/heads/table_att_head.py +++ b/ppocr/modeling/heads/table_att_head.py @@ -357,7 +357,7 @@ def forward(self, inputs, targets=None): if self.training and targets is not None: structure = targets[0] - max_len = targets[-2].max() + max_len = targets[-2].max().astype("int32") for i in range(max_len + 1): hidden, structure_step, loc_step = self._decode( structure[:, i], fea, hidden