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

Method test_ops

caffe2/python/net_builder_test.py:83–104  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

81
82class TestNetBuilder(unittest.TestCase):
83 def test_ops(self):
84 with NetBuilder() as nb:
85 y = _test_loop()
86 z, w, a, b = _test_outer()
87 p = _test_if(ops.Const(75))
88 q = _test_if(ops.Const(25))
89 plan = Plan('name')
90 plan.AddStep(to_execution_step(nb))
91 ws = workspace.C.Workspace()
92 ws.run(plan)
93 expected_results = [
94 (y, 5),
95 (z, False),
96 (w, True),
97 (a, False),
98 (b, False),
99 (p, 2),
100 (q, 3),
101 ]
102 for b, expected in expected_results:
103 actual = ws.blobs[str(b)].fetch()
104 self.assertEqual(actual, expected)
105
106 def _expected_loop(self):
107 total = 0

Callers

nothing calls this directly

Calls 11

AddStepMethod · 0.95
NetBuilderClass · 0.90
PlanClass · 0.90
to_execution_stepFunction · 0.90
_test_loopFunction · 0.85
_test_outerFunction · 0.85
_test_ifFunction · 0.85
ConstMethod · 0.80
runMethod · 0.45
fetchMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected