please I have a “targets” and “outputs” tensor which have a size [batch-size,slate_length]. “targets” contains values: True or False and “outputs” contains values in [0; 1]
when I execute these lines:
outputs_order = torch.argsort(outputs, descending=True, dim=-1)
targets_sorted_by_outputs = torch.gather(targets, dim=-1, index=outputs_order)
hits_score = torch.sum(targets_sorted_by_outputs[:,:k], dim=1) / torch.sum(targets, dim=1)
I get this error message
13 outputs_order = torch.argsort(outputs, descending=True, dim=-1)
14 targets_sorted_by_outputs = torch.gather(targets, dim=-1, index=outputs_order)
---> 15 hits_score = torch.sum(targets_sorted_by_outputs[:,:k], dim=1) / torch.sum(targets[:,:k], dim=1)
IndexError: too many indices for tensor of dimension 1
how i can solve this problem? and thank you