Skip to content

register nn.Module test for upsample_nearest2d #4055

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

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions backends/vulkan/partitioner/supported_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def __contains__(self, op):
exir_ops.edge.aten.full_like.default,
exir_ops.edge.aten.ones.default,
exir_ops.edge.aten.ones_like.default,
exir_ops.edge.aten.upsample_nearest2d.vec,
exir_ops.edge.aten.zeros.default,
exir_ops.edge.aten.zeros_like.default,
]
Expand Down
17 changes: 17 additions & 0 deletions backends/vulkan/test/test_vulkan_delegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,23 @@ def forward(self, x):
memory_layouts=[vk_graph_schema.VkMemoryLayout.TENSOR_CHANNELS_PACKED],
)

def test_vulkan_backend_upsample_nearest2d(self):
class UpsampleNearest2d(torch.nn.Module):
def __init__(self):
super().__init__()
self.upsample = torch.nn.Upsample(scale_factor=2, mode="nearest")

def forward(self, x):
return self.upsample(x)

sample_inputs = (torch.arange(1, 5, dtype=torch.float32).view(1, 1, 2, 2),)

self.lower_module_and_test_output(
UpsampleNearest2d(),
sample_inputs,
memory_layouts=[vk_graph_schema.VkMemoryLayout.TENSOR_CHANNELS_PACKED],
)

def test_vulkan_backend_reshape(self):
class ReshapeModule(torch.nn.Module):
def __init__(self):
Expand Down
Loading