Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use torch.amax instead of torch.max #5224

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion detectron2/evaluation/coco_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def evaluate(self, img_ids=None):
if not comm.is_main_process():
return {}
else:
predictions = self._predictions
predictions = copy.deepcopy(self._predictions)

if len(predictions) == 0:
self._logger.warning("[COCOEvaluator] Did not receive valid predictions.")
Expand Down
4 changes: 1 addition & 3 deletions detectron2/layers/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def shapes_to_tensor(x: List[int], device: Optional[torch.device] = None) -> tor

def check_if_dynamo_compiling():
if TORCH_VERSION >= (2, 1):
from torch._dynamo import is_compiling

return is_compiling()
return torch.compiler.is_compiling()
else:
return False

Expand Down
2 changes: 1 addition & 1 deletion detectron2/structures/image_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def from_tensors(

image_sizes = [(im.shape[-2], im.shape[-1]) for im in tensors]
image_sizes_tensor = [shapes_to_tensor(x) for x in image_sizes]
max_size = torch.stack(image_sizes_tensor).max(0).values
max_size = torch.stack(image_sizes_tensor).amax(0)

if padding_constraints is not None:
square_size = padding_constraints.get("square_size", 0)
Expand Down