mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Allow optional positional arguments for torch.func.functional_call
(#134643)
This PR resolves #134408. Add an additional test and have passed the local test. Do you think we should add a post-check to ensure `args` and `kwargs` are not both `None`? It seems to be possible to have modules without inputs. This PR does not include any such post-check. Pull Request resolved: https://github.com/pytorch/pytorch/pull/134643 Approved by: https://github.com/zou3519
This commit is contained in:
committed by
PyTorch MergeBot
parent
d67cc58181
commit
7647c398ff
@ -738,6 +738,8 @@ class TestStatelessFunctionalAPI(TestCase):
|
||||
self.assertEqual(res, other_inp)
|
||||
res_1 = functional_call(mod, a, (), {'inp': inp, 'other_inp': other_inp})
|
||||
self.assertEqual(res, res_1)
|
||||
res_2 = functional_call(mod, a, kwargs={'inp': inp, 'other_inp': other_inp})
|
||||
self.assertEqual(res, res_2)
|
||||
|
||||
def test_functional_call_tuple_dicts(self):
|
||||
mod = MockModule()
|
||||
|
Reference in New Issue
Block a user