diff --git a/backends/vulkan/runtime/graph/ops/impl/UnaryOp.cpp b/backends/vulkan/runtime/graph/ops/impl/UnaryOp.cpp index d17f57774f7..0eac8b69756 100644 --- a/backends/vulkan/runtime/graph/ops/impl/UnaryOp.cpp +++ b/backends/vulkan/runtime/graph/ops/impl/UnaryOp.cpp @@ -227,6 +227,7 @@ REGISTER_OPERATORS { VK_REGISTER_OP(aten.log10.default, log10); VK_REGISTER_OP(aten.round.default, round); VK_REGISTER_OP(aten.bitwise_not.default, bitwise_not); + VK_REGISTER_OP(aten.logical_not.default, bitwise_not); } } // namespace vkcompute diff --git a/backends/vulkan/test/test_vulkan_delegate.py b/backends/vulkan/test/test_vulkan_delegate.py index 3e4b1c19433..a4e074b0629 100644 --- a/backends/vulkan/test/test_vulkan_delegate.py +++ b/backends/vulkan/test/test_vulkan_delegate.py @@ -732,6 +732,18 @@ def forward(self, x): self.lower_unary_module_and_test_output(TanhModule()) + def test_vulkan_backend_logical_not(self): + class LogicalNotModule(torch.nn.Module): + def __init__(self): + super().__init__() + + def forward(self, x): + # logical_not produces a boolean tensor, which cannot be + # compared with torch.allclose, so select through it instead. + return torch.where(torch.logical_not(x > 0), x, torch.zeros_like(x)) + + self.lower_unary_module_and_test_output(LogicalNotModule()) + def test_vulkan_backend_linear(self): class LinearModule(torch.nn.Module): def __init__(self):