Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
caffe2.python.task.Task Class Reference
Inheritance diagram for caffe2.python.task.Task:

Public Member Functions

def __init__ (self, step=None, outputs=None, workspace_type=None, group=None, node=None, name=None, num_instances=None)
 
def __enter__ (self)
 
def __exit__ (self, type, value, traceback)
 
def workspace_type (self)
 
def add_output (self, output)
 
def add_outputs (self, outputs)
 
def set_step (self, step)
 
def get_step (self)
 
def output_list (self)
 
def outputs (self)
 
def __repr__ (self)
 

Public Attributes

 node
 
 group
 
 name
 

Static Public Attributes

string TASK_SETUP = 'task_setup'
 
string TASK_INSTANCE_SETUP = 'task_instance_setup'
 
string REPORT_STEP = 'report_step'
 

Detailed Description

A Task is composed of an execution step and zero or more outputs.
Tasks are executed in the context of a TaskGroup, which, in turn, can
be run by a Session.

Task outputs are fetched by the session at the end of the run.

The recommended way of creating a task is by using `net_builder.ops`.
Example:

    from net_builder import ops
    with Node('trainer'), Task(name='my_task', num_instances=2):
        with ops.task_init():
            globl = ops.Const(0)
        with ops.task_instance_init():
            local = ops.Const(0)
        with ops.loop(100):
            ops.Copy(globl, local)
        with ops.task_instance_exit():
            ops.Add([globl, local], [globl])
        with ops.task_exit():
            ops.Mul([globl, globl], [globl])

The task above will create 2 instances that will run in parallel.
Each instance will copy `local` to `globl` 100 times, Then Add `local`
to `globl` once. The `Mul` will only execute once, after all the instances
of the task have finished.

Definition at line 446 of file task.py.

Constructor & Destructor Documentation

def caffe2.python.task.Task.__init__ (   self,
  step = None,
  outputs = None,
  workspace_type = None,
  group = None,
  node = None,
  name = None,
  num_instances = None 
)
Instantiate a Task and add it to the current TaskGroup and Node.

Args:
   step:    If provided, this task will run this ExecutionStep.
   outputs: If provided, the task will return the provided outputs
    to the client at completion time.
   node:    If provided, force task execution on the given node.
   name:    Name of the Task.
   num_instances: If provided, this task will be cloned num_instances
          times at runtime, and all instances will run
          concurrently.

Definition at line 501 of file task.py.


The documentation for this class was generated from the following file: