MCPcopy
hub / github.com/pytorch/vision / check_out

Function check_out

test/test_models.py:739–757  ·  view source on GitHub ↗
(out)

Source from the content-addressed store, hash-verified

737 out = model(x)
738
739 def check_out(out):
740 prec = 0.01
741 try:
742 # We first try to assert the entire output if possible. This is not
743 # only the best way to assert results but also handles the cases
744 # where we need to create a new expected result.
745 _assert_expected(out.cpu(), model_name, prec=prec)
746 except AssertionError:
747 # Unfortunately some segmentation models are flaky with autocast
748 # so instead of validating the probability scores, check that the class
749 # predictions match.
750 expected_file = _get_expected_file(model_name)
751 expected = torch.load(expected_file, weights_only=True)
752 torch.testing.assert_close(
753 out.argmax(dim=1), expected.argmax(dim=1), rtol=prec, atol=prec, check_device=False
754 )
755 return False # Partial validation performed
756
757 return True # Full validation performed
758
759 full_validation = check_out(out["out"])
760

Callers 2

test_segmentation_modelFunction · 0.85
test_detection_modelFunction · 0.85

Calls 4

map_nested_tensor_objectFunction · 0.90
_assert_expectedFunction · 0.85
_get_expected_fileFunction · 0.85
loadMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…