예제 #1
0
 def IfNotElseCondTest(self, cond_net, expect, cond_on_blob):
     true_step = control.For(self.cnt_net_, self.N_)
     false_step = control.For(self.cnt_net_, 2 * self.N_)
     if cond_on_blob:
         step = control.Do(
             control.Do(cond_net),
             control.IfNot(cond_net.Proto().external_output[-1], true_step,
                           false_step))
     else:
         step = control.IfNot(cond_net, true_step, false_step)
     self.BuildAndRunPlan(step)
     self.CheckNetOutput([(self.cnt_net_, expect)])
예제 #2
0
 def ForLoopTest(self, nets_or_steps):
     step = control.For('myFor', nets_or_steps, self.N_)
     self.BuildAndRunPlan(step)
     self.CheckNetOutput([(self.cnt_net_, self.N_)])