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

Method IfElseCondTest

caffe2/python/control_test.py:180–195  ·  view source on GitHub ↗
(self, cond_net, cond_value, expect, cond_on_blob)

Source from the content-addressed store, hash-verified

178 self.IfCondTest(self.false_cond_net_, 0, True)
179
180 def IfElseCondTest(self, cond_net, cond_value, expect, cond_on_blob):
181 if cond_value:
182 run_net = self.cnt_net_
183 else:
184 run_net = self.cnt_2_net_
185 if cond_on_blob:
186 step = control.Do(
187 'if-else-all',
188 control.Do('count', cond_net),
189 control.If('myIfElse', cond_net.Proto().external_output[-1],
190 self.cnt_net_, self.cnt_2_net_))
191 else:
192 step = control.If('myIfElse', cond_net,
193 self.cnt_net_, self.cnt_2_net_)
194 self.BuildAndRunPlan(step)
195 self.CheckNetOutput([(run_net, expect)])
196
197 def testIfElseCondTrueOnNet(self):
198 self.IfElseCondTest(self.true_cond_net_, True, 1, False)

Callers 4

Calls 4

BuildAndRunPlanMethod · 0.95
CheckNetOutputMethod · 0.95
IfMethod · 0.80
ProtoMethod · 0.45

Tested by

no test coverage detected