Skip to content

Commit

Permalink
test apply_transfer_function_filter
Browse files Browse the repository at this point in the history
  • Loading branch information
talonchandler committed Feb 1, 2025
1 parent 60882e9 commit 2d8f6b6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
import pytest


def test_apply_transfer_function_filter():
input_array = torch.tensor([[1.0, 2.0], [3.0, 4.0]])
transfer_function = torch.tensor([[1, 0], [0, 0]])
result = filter.apply_transfer_function_filter(transfer_function, input_array)
expected = torch.tensor([[10, 10], [10, 10]])/4
assert torch.allclose(result, expected)

# Test with incompatible shapes
input_array = torch.tensor([[1.0, 2.0], [3.0, 4.0]])
transfer_function = torch.tensor([[0.5, 0.5, 0.5], [0.5, 0.5, 0.5]])
with pytest.raises(ValueError):
filter.apply_transfer_function_filter(transfer_function, input_array)


def test_stretched_multiply():
small_array = torch.tensor([[1, 2], [3, 4]])
large_array = torch.tensor(
Expand Down

0 comments on commit 2d8f6b6

Please sign in to comment.