I’m mostly interested in why that error would happen (more so than if/why my code would be wrong) given that the error implies the 2nd line of the test code is incorrect, but, to my eyes, the error is occurring before my code is implemented.
Well, that line of the test is processing the output of your implementation of get_score. Note that you do not reference target_indices anywhere in your code. Your target_score value includes elements for all the inputs, which I think is not what was intended. At least that’s not how I wrote the code and I did not encounter the error that you show.
The problem is that get_score() should return a single value, not a tensor of multiple values. That’s why you’re seeing an error about a “Boolean value of Tensor with more than one value” being ambiguous. The torch.isclose() function can’t figure out a true or false answer about whether the value is close or not because it is a tensor.
Look carefully at the instructions for the steps to follow for the get_score method, especially step #3, to help make sure your other_class_penalty is a single value and not a tensor of multiple values.