

.. _sphx_glr_usage_examples_graph:

============
Graph
============

These examples cover visualization via graph view


.. raw:: html

  <div id='sg-tag-list' class='sphx-glr-tag-list'></div>


.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Visualization of basic dense model. No color_map is passed here, so each layer type is assigned a color automatically from a colorblind-safe default palette (see the Custom Color example to override this).">

.. only:: html

  .. image:: /usage_examples/graph/images/thumb/sphx_glr_plot_basic_dense_thumb.png
    :alt:

  :doc:`/usage_examples/graph/plot_basic_dense`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Basic Dense</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Visualization of custom color. The synthetic input node can be recolored too, keyed by visualtorch.InputDummyLayer in color_map just like any real layer type.">

.. only:: html

  .. image:: /usage_examples/graph/images/thumb/sphx_glr_plot_custom_node_color_thumb.png
    :alt:

  :doc:`/usage_examples/graph/plot_custom_node_color`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Custom Color</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Visualization of custom node size">

.. only:: html

  .. image:: /usage_examples/graph/images/thumb/sphx_glr_plot_custom_node_size_thumb.png
    :alt:

  :doc:`/usage_examples/graph/plot_custom_node_size`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Custom Node Size</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Visualization of custom spacing between layers">

.. only:: html

  .. image:: /usage_examples/graph/images/thumb/sphx_glr_plot_custom_spacing_layers_thumb.png
    :alt:

  :doc:`/usage_examples/graph/plot_custom_spacing_layers`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Custom Spacing for Layers</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="By default, graph_view draws a fully-connected mesh between every pair of adjacent layers&#x27; neuron circles. That&#x27;s accurate for a genuinely dense layer (e.g. Linear), but misleading for a convolutional one - a Conv2d&#x27;s real connectivity is local and shared across spatial positions, not &quot;every input channel wired to every output channel.&quot; Setting show_neurons=False draws each layer as a single box instead, which is the more honest representation for a conv-heavy model.">

.. only:: html

  .. image:: /usage_examples/graph/images/thumb/sphx_glr_plot_residual_block_thumb.png
    :alt:

  :doc:`/usage_examples/graph/plot_residual_block`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Hiding Individual Neurons</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Visualization of an Inception-style block: four parallel branches (a plain Conv2d+BatchNorm2d, a 1x1-then-3x3 conv, a 1x1-then-5x5 conv, and a max-pool-then-1x1-conv) that all read the same input and merge into a shared projection layer.">

.. only:: html

  .. image:: /usage_examples/graph/images/thumb/sphx_glr_plot_inception_block_thumb.png
    :alt:

  :doc:`/usage_examples/graph/plot_inception_block`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Multi-Branch Merge (Inception-style)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Visualization of a model whose forward() takes two separate input tensors instead of one - an image branch (Conv2d + global pooling) and a tabular-vector branch (a small MLP) - merged by concatenation before a shared head. This is the pattern used by siamese networks and multi-modal architectures.">

.. only:: html

  .. image:: /usage_examples/graph/images/thumb/sphx_glr_plot_multi_input_thumb.png
    :alt:

  :doc:`/usage_examples/graph/plot_multi_input`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Multi-Input Model (Siamese-style)</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /usage_examples/graph/plot_basic_dense
   /usage_examples/graph/plot_custom_node_color
   /usage_examples/graph/plot_custom_node_size
   /usage_examples/graph/plot_custom_spacing_layers
   /usage_examples/graph/plot_residual_block
   /usage_examples/graph/plot_inception_block
   /usage_examples/graph/plot_multi_input

