Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/transformers/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,3 +1001,17 @@ def __eq__(self, other):
getattr(other, f.name) for f in fields(self)
)
return NotImplemented

def __or__(self, other) -> "SizeDict":
if isinstance(other, dict | SizeDict):
Comment thread
hmellor marked this conversation as resolved.
merged = dict(self)
merged.update(dict(other))
return SizeDict(**merged)
return NotImplemented

def __ror__(self, other) -> dict:
if isinstance(other, dict):
merged = dict(other)
merged.update(dict(self))
return merged
return NotImplemented
Loading