Saturday 6 March 2021

RuntimeError: Operation does not have identity in f-string statement

I am evaluating a pytorch model. It gives results in following manner

results = model(batch)
# results is a list of dictionaries with 'boxes', 'labels' and 'scores' keys and torch tensor values

Then I try to print some of the values to check what is happening

print(
    (
        f"{results[0]['boxes'].shape[0]}\n" # Returns how many boxes there is
        f"{results[0]['scores'].mean()}" # Mean credibility score of the boxes
    )
)

This results in error

Exception has occurred: RuntimeError: operation does not have identity

To make things more confusing, print only fails some of the time. Why does this fail?



from RuntimeError: Operation does not have identity in f-string statement

No comments:

Post a Comment