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

Method test_feed

caffe2/python/python_op_test.py:45–53  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

43class PythonOpTest(hu.HypothesisTestCase):
44 @given(x=hu.tensor())
45 def test_feed(self, x):
46 def f(inputs, _):
47 self.assertEqual(x.shape, inputs[0].shape)
48 self.assertEqual(type(inputs[0].shape), tuple)
49 self.assertEqual(type(inputs[0].data), np.ndarray)
50 np.testing.assert_almost_equal(x, inputs[0].data)
51 op = CreatePythonOperator(f, ["x"], [])
52 workspace.FeedBlob("x", x)
53 workspace.RunOperatorOnce(op)
54
55 def test_exception(self):
56 op = CreatePythonOperator(MainOpFunctionThatThrowsCustomError, [], [])

Callers

nothing calls this directly

Calls 1

CreatePythonOperatorFunction · 0.90

Tested by

no test coverage detected