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

Method IfNotElseCondTest

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

Source from the content-addressed store, hash-verified

231 self.IfNotCondTest(self.false_cond_net_, 1, True)
232
233 def IfNotElseCondTest(self, cond_net, cond_value, expect, cond_on_blob):
234 if cond_value:
235 run_net = self.cnt_2_net_
236 else:
237 run_net = self.cnt_net_
238 if cond_on_blob:
239 step = control.Do(
240 'if-not-else',
241 control.Do('count', cond_net),
242 control.IfNot('myIfNotElse',
243 cond_net.Proto().external_output[-1],
244 self.cnt_net_, self.cnt_2_net_))
245 else:
246 step = control.IfNot('myIfNotElse', cond_net,
247 self.cnt_net_, self.cnt_2_net_)
248 self.BuildAndRunPlan(step)
249 self.CheckNetOutput([(run_net, expect)])
250
251 def testIfNotElseCondTrueOnNet(self):
252 self.IfNotElseCondTest(self.true_cond_net_, True, 2, False)

Calls 3

BuildAndRunPlanMethod · 0.95
CheckNetOutputMethod · 0.95
ProtoMethod · 0.45

Tested by

no test coverage detected