Public Member Functions | |
| def | __init__ (self, fields) |
| def | get_children (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 | __contains__ (self, item) |
| def | __len__ (self) |
| def | __getitem__ (self, item) |
| def | get (self, item, default_value) |
| def | __getattr__ (self, item) |
| def | __setattr__ (self, key, value) |
| def | __add__ (self, other) |
| def | __sub__ (self, other) |
Public Member Functions inherited from caffe2.python.schema.Field | |
| 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) |
Public Attributes | |
| fields | |
Represents a named list of fields sharing the same domain.
| def caffe2.python.schema.Struct.__init__ | ( | self, | |
| fields | |||
| ) |
fields is a list of tuples in format of (name, field). The name is
a string of nested name, e.g., `a`, `a:b`, `a:b:c`. For example
Struct(
('a', Scalar()),
('b:c', Scalar()),
('b:d:e', Scalar()),
('b', Struct(
('f', Scalar()),
)),
)
is equal to
Struct(
('a', Scalar()),
('b', Struct(
('c', Scalar()),
('d', Struct(('e', Scalar()))),
('f', Scalar()),
)),
)
| def caffe2.python.schema.Struct.__add__ | ( | self, | |
| other | |||
| ) |
Allows to merge fields of two schema.Struct using '+' operator.
If two Struct have common field names, the merge is conducted
recursively. Here are examples:
Example 1
s1 = Struct(('a', Scalar()))
s2 = Struct(('b', Scalar()))
s1 + s2 == Struct(
('a', Scalar()),
('b', Scalar()),
)
Example 2
s1 = Struct(
('a', Scalar()),
('b', Struct(('c', Scalar()))),
)
s2 = Struct(('b', Struct(('d', Scalar()))))
s1 + s2 == Struct(
('a', Scalar()),
('b', Struct(
('c', Scalar()),
('d', Scalar()),
)),
)
| def caffe2.python.schema.Struct.__getitem__ | ( | self, | |
| item | |||
| ) |
| def caffe2.python.schema.Struct.__sub__ | ( | self, | |
| other | |||
| ) |
Allows to remove common fields of two schema.Struct from self by
using '-' operator. If two Struct have common field names, the
removal is conducted recursively. If a child struct has no fields
inside, it will be removed from its parent. Here are examples:
Example 1
s1 = Struct(
('a', Scalar()),
('b', Scalar()),
)
s2 = Struct(('a', Scalar()))
s1 - s2 == Struct(('b', Scalar()))
Example 2
s1 = Struct(
('b', Struct(
('c', Scalar()),
('d', Scalar()),
))
)
s2 = Struct(
('b', Struct(('c', Scalar()))),
)
s1 - s2 == Struct(
('b', Struct(
('d', Scalar()),
)),
)
Example 3
s1 = Struct(
('a', Scalar()),
('b', Struct(
('d', Scalar()),
))
)
s2 = Struct(
('b', Struct(
('c', Scalar())
('d', Scalar())
)),
)
s1 - s2 == Struct(
('a', Scalar()),
)
| def caffe2.python.schema.Struct.get | ( | self, | |
| item, | |||
| default_value | |||
| ) |
1.8.11