Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3f11448
Decouple construction and checking in Transforms
PierreQuinton Mar 28, 2025
5a97c18
add check_keys in test_stack.FakeGradientsTransform
PierreQuinton Mar 28, 2025
c804e5e
Fix tests checking Transforms
PierreQuinton Mar 28, 2025
ea5dfac
remove test_call_checks_keys
PierreQuinton Mar 28, 2025
8adad9d
Add changelog entry
ValerianRey Mar 28, 2025
ee3e099
Extract _create_transform from backward
PierreQuinton Mar 28, 2025
ac2b31b
Test _create_transform
PierreQuinton Mar 28, 2025
4979038
Fix mtl_backward test of create transform and check keys
PierreQuinton Mar 28, 2025
df6c200
Remove _compute, use __call__ instead
ValerianRey Mar 28, 2025
8d3d98d
Same as before for FakeTransforms
ValerianRey Mar 28, 2025
69b2f75
Rename check_keys to check_and_get_keys
ValerianRey Mar 28, 2025
f278a5c
Improve docstring of check_and_get_keys
ValerianRey Mar 28, 2025
316d3dd
Fix tests of check_and_get_keys
ValerianRey Mar 28, 2025
fcd1e3b
Move check and cast to set from __init__ to check_and_get_keys in Select
ValerianRey Mar 28, 2025
b518046
Change test_keys_check into test_check_and_get_keys in Select
ValerianRey Mar 28, 2025
f490089
Add missing tests of check_and_get_keys
ValerianRey Mar 28, 2025
b64665b
revert cast to set in Select
PierreQuinton Mar 28, 2025
ab912a1
Remove check_keys_are
ValerianRey Mar 28, 2025
b744af0
Remove useless casting to set in Select.check_and_get_keys
ValerianRey Mar 28, 2025
4f6e515
Add docstring to mtl_backward._create_transform
ValerianRey Mar 28, 2025
e2b3374
Rename _make_task_transform to _create_task_transform
ValerianRey Mar 28, 2025
ffb6d55
Uniformize test_check_create_transform for backward and mtl_backward …
ValerianRey Mar 28, 2025
e72d3ca
Explicitly give parameter names in calls to _create_transform
ValerianRey Mar 28, 2025
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
16 changes: 8 additions & 8 deletions tests/unit/autojac/_transform/test_base.py
Comment thread
ValerianRey marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ def test_compose_checks_keys():
t1 = FakeTransform(required_keys={a1}, output_keys={a1, a2})
t2 = FakeTransform(required_keys={a2}, output_keys={a1})

t1 << t2
(t1 << t2).check_keys()

with raises(ValueError):
t2 << t1
(t2 << t1).check_keys()


def test_conjunct_checks_required_keys():
Expand All @@ -83,13 +83,13 @@ def test_conjunct_checks_required_keys():
t2 = FakeTransform(required_keys={a1}, output_keys=set())
t3 = FakeTransform(required_keys={a2}, output_keys=set())

t1 | t2
(t1 | t2).check_keys()

with raises(ValueError):
t2 | t3
(t2 | t3).check_keys()

with raises(ValueError):
t1 | t2 | t3
(t1 | t2 | t3).check_keys()


def test_conjunct_checks_output_keys():
Expand All @@ -105,13 +105,13 @@ def test_conjunct_checks_output_keys():
t2 = FakeTransform(required_keys=set(), output_keys={a1})
t3 = FakeTransform(required_keys=set(), output_keys={a2})

t2 | t3
(t2 | t3).check_keys()

with raises(ValueError):
t1 | t3
(t1 | t3).check_keys()

with raises(ValueError):
t1 | t2 | t3
(t1 | t2 | t3).check_keys()


def test_empty_conjunction():
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/autojac/_transform/test_interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,4 @@ def test_stack_different_required_keys():
grad2 = Grad([y2], [a])

with raises(ValueError):
_ = Stack([grad1, grad2])
Stack([grad1, grad2]).check_keys()
Loading