Verify that python op can manipulate workspace directly
(self, x)
| 119 | |
| 120 | @given(x=hu.tensor()) |
| 121 | def test_workspace_manipulation(self, x): |
| 122 | """ |
| 123 | Verify that python op can manipulate workspace directly |
| 124 | """ |
| 125 | def f(inputs, outputs, ws): |
| 126 | fetched = ws.blobs['internal'].fetch() |
| 127 | np.testing.assert_almost_equal(fetched, x) |
| 128 | |
| 129 | ws = workspace.C.Workspace() |
| 130 | net = core.Net("test") |
| 131 | net.GivenTensorFill([], ['internal'], values=x, shape=x.shape) |
| 132 | net.Python(f, pass_workspace=True)([], []) |
| 133 | ws.run(net) |
| 134 | |
| 135 | @given(x=hu.tensor()) |
| 136 | def test_caught_exception_doesnt_terminate(self, x): |