Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
caffe2.python.net_builder.NetBuilder Class Reference
Inheritance diagram for caffe2.python.net_builder.NetBuilder:
caffe2.python.net_builder._Loop caffe2.python.net_builder._ReporterBuilder caffe2.python.net_builder._RunElseNet caffe2.python.net_builder._RunIfNet caffe2.python.net_builder._RunOnce caffe2.python.net_builder._RunWhileCondition caffe2.python.net_builder._RunWhileNet caffe2.python.net_builder._SetupBuilder

Public Member Functions

def __init__ (self, name=None, initial_scope=None, _stop_blob_required=False, _stop_blob=None, _fullname=None, _use_control_ops=False)
 
def stop_blob (self)
 
def stop_if (self, blob)
 
def add (self, child)
 
def current_net (self, name=None)
 
def freeze (self)
 
def get (self)
 
def __exit__ (self, etype, args)
 
def __str__ (self)
 

Static Public Member Functions

def merge_nets (nets_or_builders, outer_blob_names)
 

Public Attributes

 name
 

Detailed Description

Scope-driven mechanism for building nets, loops and conditional blocks.
Arguments:
  name: NetBuilder's name
  initial_scope: list of blobs that are available for reading/writing
Example:
    from caffe2.python.net_builder import NetBuilder, ops
    with NetBuilder() as nb:
        c = ops.Const(5)
        d = ops.Const(0)
        with ops.loop():
            ops.stop_if(ops.LE([c, ops.Const(0)]))
            ops.Add([c, ops.Const(-1)], [c])
            with ops.If(ops.GE([c, ops.Const(3)])):
                ops.Add([d, ops.Const(10)], [d])
        ops.Print(c, [])
        ops.Print(d, [])
    step = core.to_execution_step(nb)

Definition at line 29 of file net_builder.py.

Member Function Documentation

def caffe2.python.net_builder.NetBuilder.stop_blob (   self)
Returns the BlobReference to the stop_blob of this NetBuilder.
If one is not yet available, creates one.
This function assumes that the stop_blob() will be used immediatelly
in the current net, so it doesn't initialize it if the current net is
the first of the builder.

Definition at line 73 of file net_builder.py.


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