
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "usage_examples/flow/plot_no_funnel.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_flow_plot_no_funnel.py>`
        to download the full example code.

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

.. _sphx_glr_usage_examples_flow_plot_no_funnel.py:

Disable Funnel Connectors
=======================================

Compare the default tapered connectors with plain box-to-box connectors by setting
``draw_funnel=False``.

.. GENERATED FROM PYTHON SOURCE LINES 7-49



.. image-sg:: /usage_examples/flow/images/sphx_glr_plot_no_funnel_001.png
   :alt: Default, draw_funnel=False
   :srcset: /usage_examples/flow/images/sphx_glr_plot_no_funnel_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


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

    # Example of a simple CNN model using nn.Sequential
    model = nn.Sequential(
        nn.Conv2d(3, 16, kernel_size=3, padding=1),
        nn.ReLU(),
        nn.MaxPool2d(2, 2),
        nn.Conv2d(16, 32, kernel_size=3, padding=1),
        nn.ReLU(),
        nn.MaxPool2d(2, 2),
        nn.Conv2d(32, 64, kernel_size=3, padding=1),
        nn.ReLU(),
        nn.MaxPool2d(2, 2),
        nn.Flatten(),
        nn.Linear(64 * 28 * 28, 256),
        nn.ReLU(),
        nn.Linear(256, 10),
    )

    input_shape = (1, 3, 224, 224)

    img_default = visualtorch.render(model, input_shape=input_shape, style="flow")
    img_no_funnel = visualtorch.render(model, input_shape=input_shape, style="flow", draw_funnel=False)

    dpi = 150  # rendered at 2x this in the final doc build (savefig.dpi=300 in conf.py)
    _, axes = plt.subplots(
        1,
        2,
        figsize=((img_default.width + img_no_funnel.width) / dpi, max(img_default.height, img_no_funnel.height) / dpi),
        dpi=dpi,
    )

    for ax, img, title in zip(axes, [img_default, img_no_funnel], ["Default", "draw_funnel=False"], strict=True):
        ax.imshow(img)
        ax.set_title(title)
        ax.axis("off")

    plt.tight_layout()
    plt.show()


.. _sphx_glr_download_usage_examples_flow_plot_no_funnel.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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