(
self,
device_option,
op,
inputs,
input_device_options=None,
exception=(Exception,),
regexp=None,
)
| 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) |
no test coverage detected