Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | List of all members
caffe2.python.schema.Field Class Reference
Inheritance diagram for caffe2.python.schema.Field:
caffe2.python.schema.List caffe2.python.schema.Scalar caffe2.python.schema.Struct

Public Member Functions

def __init__ (self, children)
 
def clone_schema (self)
 
def field_names (self)
 
def field_types (self)
 
def field_metadata (self)
 
def field_blobs (self)
 
def all_scalars (self)
 
def has_blobs (self)
 
def clone (self, keep_blobs=True)
 
def slice (self)
 
def __eq__ (self, other)
 
def __repr__ (self)
 

Detailed Description

Represents an abstract field type in a dataset.

Definition at line 97 of file schema.py.

Constructor & Destructor Documentation

def caffe2.python.schema.Field.__init__ (   self,
  children 
)
Derived classes must call this after their initialization.

Definition at line 101 of file schema.py.

Member Function Documentation

def caffe2.python.schema.Field.__eq__ (   self,
  other 
)
Equivalance of two schemas

Definition at line 179 of file schema.py.

def caffe2.python.schema.Field.all_scalars (   self)
Return the list of all Scalar instances in the Field.
The order is the same as for field_names() or field_blobs()

Definition at line 133 of file schema.py.

def caffe2.python.schema.Field.clone (   self,
  keep_blobs = True 
)
Clone this Field along with its children.

Definition at line 142 of file schema.py.

def caffe2.python.schema.Field.field_blobs (   self)
Return the list of blobs with contents for this Field.
Values can either be all numpy.ndarray or BlobReference.
If any of the fields doens't have a blob, throws.

Definition at line 126 of file schema.py.

def caffe2.python.schema.Field.field_metadata (   self)
Return the Metadata for each of the children fields.

Definition at line 122 of file schema.py.

def caffe2.python.schema.Field.field_names (   self)
Return the children field names for this field.

Definition at line 114 of file schema.py.

def caffe2.python.schema.Field.field_types (   self)
Return the numpy.dtype for each of the children fields.

Definition at line 118 of file schema.py.

def caffe2.python.schema.Field.has_blobs (   self)
Return True if every scalar of this field has blobs.

Definition at line 138 of file schema.py.

def caffe2.python.schema.Field.slice (   self)
Returns a slice representing the range of field ids that belong to
this field. This slice can be used to index a list of fields.

E.g.:

>>> s = Struct(
>>>     ('a', Scalar()),
>>>     ('b', Struct(
>>>         ('b1', Scalar()),
>>>         ('b2', Scalar()),
>>>     )),
>>>     ('c', Scalar()),
>>> )
>>> field_data = ['da', 'db1', 'db2', 'dc']
>>> field_data[s.b.split()]
['db1', 'db2']

Definition at line 149 of file schema.py.


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