Skip to content

Commit

Permalink
[fbsync] Fix f-string in color error message (#8639)
Browse files Browse the repository at this point in the history
Reviewed By: vmoens

Differential Revision: D62581689

fbshipit-source-id: 4caa36834e9928751e6a54e8cde394b972fe62f6
  • Loading branch information
NicolasHug authored and facebook-github-bot committed Sep 13, 2024
1 parent 0dcd180 commit fe6948c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torchvision/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,9 @@ def _parse_colors(
f"Number of colors must be equal or larger than the number of objects, but got {len(colors)} < {num_objects}."
)
elif not isinstance(colors, (tuple, str)):
raise ValueError("`colors` must be a tuple or a string, or a list thereof, but got {colors}.")
raise ValueError(f"`colors` must be a tuple or a string, or a list thereof, but got {colors}.")
elif isinstance(colors, tuple) and len(colors) != 3:
raise ValueError("If passed as tuple, colors should be an RGB triplet, but got {colors}.")
raise ValueError(f"If passed as tuple, colors should be an RGB triplet, but got {colors}.")
else: # colors specifies a single color for all objects
colors = [colors] * num_objects

Expand Down

0 comments on commit fe6948c

Please sign in to comment.