treetensor.common.object¶
Object¶
-
class
treetensor.common.
Object
(data, *args, constraint=None, **kwargs)[source]¶ - Overview:
Generic object tree class, used in
treetensor.numpy
andtreetensor.torch
.
-
__init__
(data, constraint=None)[source]¶ In
treetensor.common.Object
, object or object tree can be initialized.Examples:
>>> from treetensor.common import Object >>> Object(1) 1 >>> Object({'a': 1, 'b': 2, 'x': {'c': 233}}) <Object 0x7fe00b1153a0> ├── a --> 1 ├── b --> 2 └── x --> <Object 0x7fe00b115ee0> └── c --> 233