Ejemplo n.º 1
0
 def task_group(self):
     """
     Creates a local task group which will execute as the next step of
     the current NetBuilder.
     """
     from caffe2.python import task
     group = NetBuilder.current()
     with task.Cluster():
         with task.Node('local'):
             tg = task.TaskGroup()
             group.add(tg)
             return tg
Ejemplo n.º 2
0
 def testRepr(self):
     cases = [
         (task.Cluster(), "Cluster(nodes=[], node_kwargs={})"),
         (task.Node(), "Node(name=local, kwargs={})"),
         (
             task.TaskGroup(),
             "TaskGroup(tasks=[], workspace_type=None, remote_nets=[])",
         ),
         (task.TaskOutput([]), "TaskOutput(names=[], values=None)"),
         (task.Task(), "Task(name=local/task, node=local, outputs=[])"),
         (task.SetupNets(), "SetupNets(init_nets=None, exit_nets=None)"),
     ]
     for obj, want in cases:
         self.assertEqual(obj.__repr__(), want)