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

Method test_predictor_memory_model

caffe2/python/workspace_test.py:668–681  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

666 # self.assertAlmostEqual(outputs[0][0][0][0][0], 5.19026289e-05)
667
668 def test_predictor_memory_model(self):
669 workspace.ResetWorkspace()
670 m = self._create_model()
671 workspace.FeedBlob("data", np.zeros([4], dtype="float32"))
672 self.predictor = workspace.Predictor(
673 workspace.StringifyProto(m.param_init_net.Proto()),
674 workspace.StringifyProto(m.net.Proto()),
675 )
676
677 inputs = np.array([1, 3, 256, 256], dtype="float32")
678 outputs = self.predictor.run([inputs])
679 np.testing.assert_array_almost_equal(
680 np.array([[516, 516]], dtype="float32"), outputs
681 )
682
683
684class TestTransform(htu.HypothesisTestCase):

Callers

nothing calls this directly

Calls 4

_create_modelMethod · 0.95
zerosMethod · 0.45
ProtoMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected