
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "usage_examples/graph/plot_outline_width.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_usage_examples_graph_plot_outline_width.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_usage_examples_graph_plot_outline_width.py:

Outline Width
=======================================
Visualization of thin vs thick outline border using the ``outline_width`` parameter
in the graph style.

.. GENERATED FROM PYTHON SOURCE LINES 6-48



.. image-sg:: /usage_examples/graph/images/sphx_glr_plot_outline_width_001.png
   :alt: outline_width=1 (default), outline_width=8 (thick)
   :srcset: /usage_examples/graph/images/sphx_glr_plot_outline_width_001.png
   :class: sphx-glr-single-img





.. code-block:: Python

    import matplotlib.pyplot as plt
    import torch
    import visualtorch
    from torch import nn


    class SimpleDense(nn.Module):
        """Simple Dense Model."""

        def __init__(self) -> None:
            super().__init__()
            self.h0 = nn.Linear(4, 8)
            self.h1 = nn.Linear(8, 8)
            self.h2 = nn.Linear(8, 4)
            self.out = nn.Linear(4, 2)

        def forward(self, x: torch.Tensor) -> torch.Tensor:
            """Define the forward pass."""
            x = self.h0(x)
            x = self.h1(x)
            x = self.h2(x)
            return self.out(x)


    model = SimpleDense()
    input_shape = (1, 4)


    fig, axes = plt.subplots(1, 2, figsize=(12, 4))

    img_thin = visualtorch.render(model, input_shape=input_shape, style="graph", outline_width=1)
    axes[0].imshow(img_thin)
    axes[0].axis("off")
    axes[0].set_title("outline_width=1 (default)")

    img_thick = visualtorch.render(model, input_shape=input_shape, style="graph", outline_width=8)
    axes[1].imshow(img_thick)
    axes[1].axis("off")
    axes[1].set_title("outline_width=8 (thick)")

    plt.tight_layout()
    plt.show()


.. _sphx_glr_download_usage_examples_graph_plot_outline_width.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_outline_width.ipynb <plot_outline_width.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_outline_width.py <plot_outline_width.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_outline_width.zip <plot_outline_width.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
