MCPcopy Index your code
hub / github.com/pytorch/pytorch / test_workspace_manipulation

Method test_workspace_manipulation

caffe2/python/python_op_test.py:121–133  ·  view source on GitHub ↗

Verify that python op can manipulate workspace directly

(self, x)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 3

PythonMethod · 0.95
NetMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected