fix type promotion TypeError in tensor_utils.py (#3883)

pull/3890/head
Wang Xin 1 month ago committed by GitHub
parent ebf04b452d
commit 4fdb0647f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -177,8 +177,9 @@ def th_accuracy(pad_outputs: paddle.Tensor,
Returns:
float: Accuracy value (0.0 - 1.0).
"""
pad_pred = pad_outputs.view(pad_targets.shape[0], pad_targets.shape[1],
pad_outputs.shape[1]).argmax(2)
pad_pred = pad_outputs.reshape(
[pad_targets.shape[0], pad_targets.shape[1],
pad_outputs.shape[1]]).argmax(2)
mask = pad_targets != ignore_label
#TODO(Hui Zhang): sum not support bool type
# numerator = paddle.sum(

Loading…
Cancel
Save