Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | Public Attributes | List of all members
net_builder.NetBuilder Class Reference
Inheritance diagram for net_builder.NetBuilder:
net_builder._Loop net_builder._ReporterBuilder net_builder._RunOnce net_builder._SetupBuilder net_builder._RunIf net_builder._StopGuard

Public Member Functions

def __init__ (self, name=None, _stop_blob_required=False, _stop_blob=None, _fullname=None)
 
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)
 

Public Attributes

 name
 

Detailed Description

Scope-driven mechanism for building nets, loops and conditional blocks.
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)])
        ops.Print(c, [])
        ops.Print(d, [])
    step = core.to_execution_step(nb)

Definition at line 13 of file net_builder.py.

Member Function Documentation

◆ stop_blob()

def 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 42 of file net_builder.py.


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