Attribute Utils¶
- parallelformers.utils.attr_utils.igetattr(obj, attr, *args)[source]¶
Indexed getattr function
Examples
>>> model = Model() >>> igetattr(model, "weight[2]")
- parallelformers.utils.attr_utils.isetattr(obj, attr, val)[source]¶
Indexed setattr function
Examples
>>> model = Model() >>> isetattr(model, "weight[2]", new_weight)
- parallelformers.utils.attr_utils.rgetattr(obj, attr, default=None)[source]¶
Recursive getattr function based on igetattr
Examples
>>> model = Model() >>> rgetattr(model, "layer[2].attention.weight[3].data")