other_class_penalty = -1 * torch.mean(torch.tensor([
torch.sqrt(
torch.sum(
torch.tensor([
(original_classifications[i, j] - current_classifications[i, j])**2
for j in other_indices
])
)
) for i in range(original_classifications.shape[0])
])) * penalty_weight
# Take the mean of the current classifications for the target feature
target_score = torch.mean(current_classifications[ : , target_indices])
I am having trouble in this function. Though the tests corresponding to this function are passing, but when I am running the next block of code, I am getting an error as follows:
ValueError: only one element tensors can be converted to Python scalars