MCPcopy Create free account
hub / github.com/pytorch/pytorch / assertRunOpRaises

Method assertRunOpRaises

caffe2/python/hypothesis_test_util.py:726–751  ·  view source on GitHub ↗
(
        self,
        device_option,
        op,
        inputs,
        input_device_options=None,
        exception=(Exception,),
        regexp=None,
    )

Source from the content-addressed store, hash-verified

724 validator(inputs=inputs, outputs=outputs)
725
726 def assertRunOpRaises(
727 self,
728 device_option,
729 op,
730 inputs,
731 input_device_options=None,
732 exception=(Exception,),
733 regexp=None,
734 ):
735 op = copy.deepcopy(op)
736 op.device_option.CopyFrom(device_option)
737
738 with temp_workspace():
739 _input_device_options = input_device_options or \
740 core.InferOpBlobDevicesAsDict(op)[0]
741 for (n, b) in zip(op.input, inputs):
742 workspace.FeedBlob(
743 n,
744 b,
745 device_option=_input_device_options.get(n, device_option)
746 )
747 if regexp is None:
748 self.assertRaises(exception, workspace.RunOperatorOnce, op)
749 else:
750 self.assertRaisesRegex(
751 exception, regexp, workspace.RunOperatorOnce, op)

Callers 3

test_out_of_boundsMethod · 0.80
test_under_boundsMethod · 0.80

Calls 4

temp_workspaceFunction · 0.85
assertRaisesMethod · 0.80
assertRaisesRegexMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected