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

cleanup legacy transforms tests #8013

Merged
merged 6 commits into from
Oct 5, 2023
Merged
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
9 changes: 4 additions & 5 deletions test/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ def make_bounding_boxes(
canvas_size=DEFAULT_SIZE,
*,
format=tv_tensors.BoundingBoxFormat.XYXY,
num_boxes=1,
dtype=None,
device="cpu",
):
Expand All @@ -419,8 +420,7 @@ def sample_position(values, max_value):

dtype = dtype or torch.float32

num_objects = 1
h, w = [torch.randint(1, s, (num_objects,)) for s in canvas_size]
h, w = [torch.randint(1, s, (num_boxes,)) for s in canvas_size]
y = sample_position(h, canvas_size[0])
x = sample_position(w, canvas_size[1])

Expand All @@ -443,12 +443,11 @@ def sample_position(values, max_value):
)


def make_detection_mask(size=DEFAULT_SIZE, *, dtype=None, device="cpu"):
def make_detection_masks(size=DEFAULT_SIZE, *, num_masks=1, dtype=None, device="cpu"):
"""Make a "detection" mask, i.e. (*, N, H, W), where each object is encoded as one of N boolean masks"""
num_objects = 1
return tv_tensors.Mask(
torch.testing.make_tensor(
(num_objects, *size),
(num_masks, *size),
low=0,
high=2,
dtype=dtype or torch.bool,
Expand Down
Loading
Loading