neuralogic.utils.visualize packageο
Module contentsο
- draw(drawer: Any, obj: Any, filename: str | None = None, show: bool = True, img_type: str = 'png', *args: Any, **kwargs: Any) Any[source]ο
Draws the object using the provided drawer.
- Parameters:
drawer (Any) β The drawer to use.
obj (Any) β The object to draw.
filename (str, optional) β The filename to draw into. Default: None.
show (bool) β Whether to show the image. Default: True.
img_type (str) β The image type. Default: βpngβ.
args (Any) β Additional arguments for the drawer.
kwargs (Any) β Additional keyword arguments for the drawer.
- Returns:
The drawing data, image object, or None if drawn into a file.
- Return type:
Union[Any, bytes, None]
- draw_grounding(grounding: Any, filename: str | None = None, show: bool = True, img_type: str = 'png', value_detail: int = 0, graphviz_path: str | None = None, *args: Any, **kwargs: Any) Any[source]ο
- Draws sampleβs grounding either as an image of type img_type either into:
a file - if filename is specified),
an IPython Image or Image popup - if show is True
or bytes otherwise
- Parameters:
grounding (Any) β The grounding to draw.
filename (str, optional) β The filename to draw into. Default: None.
show (bool) β Whether to show the image. Default: True.
img_type (str) β The image type. Default: βpngβ.
value_detail (int) β The level of detail for values. Default: 0.
graphviz_path (str, optional) β The path to the Graphviz executable. Default: None.
args (Any) β Additional arguments for the drawer.
kwargs (Any) β Additional keyword arguments for the drawer.
- Returns:
The grounding drawing.
- Return type:
Union[Any, bytes, None]
- draw_model(model: Any, filename: str | None = None, show: bool = True, img_type: str = 'png', value_detail: int = 0, graphviz_path: str | None = None, *args: Any, **kwargs: Any) Any[source]ο
- Draws model either as an image of type img_type either into:
a file - if filename is specified),
an IPython Image or Image popup - if show is True
or bytes otherwise
- Parameters:
model (NeuralModule) β The model to draw.
filename (str, optional) β The filename to draw into. Default: None.
show (bool) β Whether to show the image. Default: True.
img_type (str) β The image type. Default: βpngβ.
value_detail (int) β The level of detail for values. Default: 0.
graphviz_path (str, optional) β The path to the Graphviz executable. Default: None.
args (Any) β Additional arguments for the drawer.
kwargs (Any) β Additional keyword arguments for the drawer.
- Returns:
The model drawing.
- Return type:
Union[Any, bytes, None]
- draw_sample(sample: Any, filename: str | None = None, show: bool = True, img_type: str = 'png', value_detail: int = 0, graphviz_path: str | None = None, *args: Any, **kwargs: Any) Any[source]ο
- Draws sample either as an image of type img_type either into:
a file - if filename is specified),
an IPython Image or Image popup - if show is True
or bytes otherwise
- Parameters:
sample (Any) β The sample to draw.
filename (str, optional) β The filename to draw into. Default: None.
show (bool) β Whether to show the image. Default: True.
img_type (str) β The image type. Default: βpngβ.
value_detail (int) β The level of detail for values. Default: 0.
graphviz_path (str, optional) β The path to the Graphviz executable. Default: None.
args (Any) β Additional arguments for the drawer.
kwargs (Any) β Additional keyword arguments for the drawer.
- Returns:
The sample drawing.
- Return type:
Union[Any, bytes, None]
- get_drawing_settings(img_type: str = 'png', value_detail: int = 0, graphviz_path: str | None = None) SettingsProxy[source]ο
Returns the default settings instance for drawing with a specified image type.
- Parameters:
img_type (str) β The image type. Default: βpngβ.
value_detail (int) β The level of detail for values. Default: 0.
graphviz_path (str, optional) β The path to the Graphviz executable. Default: None.
- Returns:
The settings proxy for drawing.
- Return type:
- get_graphviz_path(path: str | None = None) str | None[source]ο
Get the path to the Graphviz executable
- get_grounding_drawer(settings: SettingsProxy) Any[source]ο
Returns the grounding drawer.
- Parameters:
settings (SettingsProxy) β The settings proxy.
- Returns:
The grounding drawer.
- Return type:
Any
- get_model_drawer(settings: SettingsProxy) Any[source]ο
Returns the model drawer.
- Parameters:
settings (SettingsProxy) β The settings proxy.
- Returns:
The model drawer.
- Return type:
Any
- get_sample_drawer(settings: SettingsProxy) Any[source]ο
Returns the sample drawer.
- Parameters:
settings (SettingsProxy) β The settings proxy.
- Returns:
The sample drawer.
- Return type:
Any
- model_to_dot_source(model: Any) str[source]ο
Renders the model into its dot source representation.
- Parameters:
model (NeuralModule) β The model to render.
- Returns:
The dot source representation.
- Return type:
str
- sample_to_dot_source(sample: Any, value_detail: int = 0) str[source]ο
Renders the sample into its dot source representation.
- Parameters:
sample (Any) β The sample to render.
value_detail (int) β The level of detail for values. Default: 0.
- Returns:
The dot source representation.
- Return type:
str