I was trying to train custom dataset with YOLOv7 with Gaudi1 Synapse 1.14.
I found some error when computing loss.
gain = torch.ones(7, device=targets.device).long() # normalized to gridspace gain
gain[2:6] = torch.tensor(p[i].shape)[[3, 2, 3, 2]] # xyxy gain
p[i].shape would be like:
torch.size([12, 3, 80, 80, 7])
and gain output shape is:
tensor([ 1, 1, 80, 0, 80, 0, 1], device='hpu:0')
which should be:
tensor([ 1, 1, 80, 80, 80, 80, 1], device='hpu:0')
Reproduce:
import torch
import habana_frameworks.torch.core as htcore
gain = torch.ones(7, device = "hpu", dtype = torch.int64)
a =torch.tensor([[[10, 22,32,234],[10, 22,32,234],[10, 22,32,234]], [[10, 22,32,234],[10, 22,32,234],[10, 22,32,234]]], dtype = torch.int64)
gain[2:6] = torch.tensor(a.shape, dtype = torch.int64)[[2, 1, 2, 1]]
print(gain)
if modified int64 to int32
output is normal