Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

[CRC] add docstring for some Callables #296

Merged
merged 3 commits into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions sot/opcode_translator/executor/variables/callable.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ def main_info(self) -> dict[str, Any]:


class PaddleApiVariable(FunctionVariable):
"""
PaddleApiVariable is a subclass of FunctionVariable used to wrap a paddlepaddle API function.

Args:
fn (Callable[..., Any]): The paddlepaddle API to be wrapped.
graph(FunctionGraph): The FunctionGraph object that this variable is associated with.
tracker(Tracker): The Tracker object that tracks the information of this variable.
"""

def __init__(
self, fn: Callable[..., Any], graph: FunctionGraph, tracker: Tracker
):
Expand Down Expand Up @@ -355,6 +364,15 @@ def getattr(self, name: str, default=None):


class UserDefinedLayerVariable(LayerVariable):
"""
UserDefinedLayerVariable is a subclass of LayerVariable used to wrap a user-defined layer.

Args:
layer (paddle.nn.Layer): The user-defined layer to be wrapped.
graph(FunctionGraph): The FunctionGraph object that this variable is associated with.
tracker(Tracker): The Tracker object that tracks the information of this variable.
"""

def __init__(
self, layer: paddle.nn.Layer, graph: FunctionGraph, tracker: Tracker
):
Expand Down Expand Up @@ -463,6 +481,15 @@ def main_info(self) -> dict[str, Any]:


class PaddleLayerVariable(LayerVariable):
"""
PaddleLayerVariable is a subclass of LayerVariable used to wrap a paddlepaddle layer.

Args:
layer (paddle.nn.Layer): The paddle built-in layer to be wrapped.
graph(FunctionGraph): The FunctionGraph object that this variable is associated with.
tracker(Tracker): The Tracker object that tracks the information of this variable.
"""

layer_name_generator = NameGenerator("layer_")

def __init__(
Expand Down