-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
module: testsIssues related to tests (not the torch.testing module)Issues related to tests (not the torch.testing module)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
Currently, we can not fully test "clamp" op added to common_methods_invocations.py as UnaryUfuncInfo (see #51167) as it requires additional args as min
and max
but there are tests that call the op directly on a test input without passing any args/kwargs. For example:
# test_unary_ufuncs.py
@ops(unary_ufuncs)
def test_batch_vs_slicing(self, device, dtype, op):
input = make_tensor((1024, 512), dtype=dtype, device=device,
low=op.domain[0], high=op.domain[1])
actual = op(input) # <---- this will fail with RuntimeError: At least one of 'min' or 'max' must not be None
expected = torch.stack([op(slice) for slice in input])
self.assertEqual(actual, expected)
In test_ops.py, test samples are generated with samples = op.sample_inputs(device, dtype)
and op is called with its args/kwargs:
output = op(*sample.input, *sample.args, **sample.kwargs)
The drawback of this approach is that :
other tests like that rely on the structure of their input, but a sample input can be very arbitrary
Let's talk about the details of workarounds here.
Metadata
Metadata
Assignees
Labels
module: testsIssues related to tests (not the torch.testing module)Issues related to tests (not the torch.testing module)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module