ml_switcheroo.core.rewriter.attributes ====================================== .. py:module:: ml_switcheroo.core.rewriter.attributes .. autoapi-nested-parse:: Attribute Rewriting Logic. Handles transformation of attributes (e.g. `torch.float32`), and tracks assignment logic to detect stateful variables (e.g. `self.layer = ...`). Classes ------- .. autoapisummary:: ml_switcheroo.core.rewriter.attributes.AttributeMixin Module Contents --------------- .. py:class:: AttributeMixin(semantics: ml_switcheroo.semantics.manager.SemanticsManager, config: ml_switcheroo.config.RuntimeConfig) Bases: :py:obj:`ml_switcheroo.core.rewriter.base.BaseRewriter` Mixin for transforming attributes and tracking assignments. .. py:method:: leave_Assign(original_node: libcst.Assign, updated_node: libcst.Assign) -> libcst.Assign Track stateful assignments (e.g. self.layer = Linear(...)) to determine if an object variable requires special handling later. .. py:method:: leave_Attribute(original: libcst.Attribute, updated: libcst.Attribute) -> libcst.BaseExpression Visits attributes (e.g. torch.float32).