tensor-network-visualization 1.5.3__tar.gz → 1.5.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/LICENSE +21 -21
- {tensor_network_visualization-1.5.3/src/tensor_network_visualization.egg-info → tensor_network_visualization-1.5.4}/PKG-INFO +157 -13
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/README.md +156 -12
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/pyproject.toml +1 -1
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4/src/tensor_network_visualization.egg-info}/PKG-INFO +157 -13
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_visualization.egg-info/SOURCES.txt +9 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/__init__.py +73 -3
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_contraction_viewer_ui.py +4 -2
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/__init__.py +1 -1
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/_nodes_edges_common.py +37 -1
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/contraction_scheme.py +11 -1
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/disk_metrics.py +73 -73
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/hover.py +9 -10
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/pick_distance.py +82 -82
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/plotter.py +3 -3
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/render_prep.py +95 -1
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/scene_state.py +1 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/tensors.py +9 -7
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/vectors.py +33 -33
- tensor_network_visualization-1.5.4/src/tensor_network_viz/_core/focus.py +268 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/graph.py +122 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/graph_utils.py +95 -95
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/direction_common.py +528 -528
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/free_directions_2d.py +958 -920
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/renderer.py +129 -25
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_engine_specs.py +8 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_input_inspection.py +80 -40
- tensor_network_visualization-1.5.4/src/tensor_network_viz/_interaction/controller.py +771 -0
- tensor_network_visualization-1.5.4/src/tensor_network_viz/_interaction/controls.py +370 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_interaction/scheme.py +9 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_interaction/state.py +7 -4
- tensor_network_visualization-1.5.4/src/tensor_network_viz/_interaction/tensor_inspector.py +668 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_interactive_scene.py +119 -3
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_matplotlib_state.py +25 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_registry.py +26 -2
- tensor_network_visualization-1.5.4/src/tensor_network_viz/_tensor_comparison_support.py +138 -0
- tensor_network_visualization-1.5.4/src/tensor_network_viz/_tensor_elements_controller.py +676 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_tensor_elements_data.py +412 -37
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_tensor_elements_payloads.py +123 -9
- tensor_network_visualization-1.5.4/src/tensor_network_viz/_widgets.py +26 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/config.py +50 -1
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/_equation.py +4 -4
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/_trace_state.py +68 -38
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/graph.py +64 -5
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/trace.py +38 -19
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/quimb/graph.py +17 -1
- tensor_network_visualization-1.5.4/src/tensor_network_viz/snapshot.py +345 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tenpy/graph.py +21 -2
- tensor_network_visualization-1.5.4/src/tensor_network_viz/tensor_comparison.py +244 -0
- tensor_network_visualization-1.5.4/src/tensor_network_viz/tensor_comparison_config.py +42 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensor_elements.py +6 -2
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensor_elements_config.py +58 -1
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensorkrowch/renderer.py +17 -17
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensornetwork/renderer.py +17 -17
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_contraction_cost.py +39 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_contraction_viewer.py +72 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_demo_cli_scheme.py +2 -2
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_einsum_autotrace.py +76 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_integration_tensornetwork.py +26 -26
- tensor_network_visualization-1.5.4/tests/test_interaction_controls.py +554 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_interaction_state.py +17 -1
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_label_draw_metrics_perf.py +25 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_layout_core.py +37 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_logging_and_exceptions.py +42 -0
- tensor_network_visualization-1.5.4/tests/test_matplotlib_state.py +42 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_plotting.py +888 -19
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_public_api.py +87 -1
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_render_performance_controls.py +97 -0
- tensor_network_visualization-1.5.4/tests/test_snapshot_api.py +123 -0
- tensor_network_visualization-1.5.4/tests/test_tensor_comparison.py +163 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_tensor_elements.py +408 -3
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_interaction/controller.py +0 -423
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_interaction/controls.py +0 -196
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_interaction/tensor_inspector.py +0 -220
- tensor_network_visualization-1.5.3/src/tensor_network_viz/_tensor_elements_controller.py +0 -396
- tensor_network_visualization-1.5.3/tests/test_interaction_controls.py +0 -120
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/setup.cfg +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_visualization.egg-info/dependency_links.txt +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_visualization.egg-info/requires.txt +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_visualization.egg-info/top_level.txt +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_contraction_viewer_style.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/_draw_common.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/_label_format.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/axis_directions.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/contractions.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/curves.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/__init__.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/constants.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/contraction_edges.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/dangling_self_edges.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/edge_labels.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/edge_orchestration.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/edges.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/fonts_and_scale.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/graph_pipeline.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/label_descriptors.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/labels_misc.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/viewport_geometry.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/graph_cache.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/__init__.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/body.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/force_directed.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/free_directions_3d.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/geometry.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/parameters.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/positions.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/types.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout_structure.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_interaction/__init__.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_interaction/bridge.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_interaction/views.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_logging.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_tensor_elements_rendering.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_tensor_elements_support.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_typing.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_ui_utils.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/contraction_viewer.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/__init__.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/_backend.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/_trace_types.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/contraction_cost.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/renderer.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/exceptions.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/interactive_viewer.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/py.typed +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/quimb/__init__.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/quimb/renderer.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tenpy/__init__.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tenpy/explicit.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tenpy/renderer.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensorkrowch/__init__.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensorkrowch/_history.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensorkrowch/graph.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensornetwork/__init__.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensornetwork/graph.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/viewer.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_ci_workflow.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_contraction_groups_once.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_contraction_scheme.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_contraction_scheme_api.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_draw_performance.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_edge_index_label_2d.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_edge_index_label_3d.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_einsum_backend.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_engine_detection.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_engineering_baseline.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_examples.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_examples_structure.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_graph_cache.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_integration_einsum.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_integration_tensorkrowch.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_label_format.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_lazy_imports.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_node_degrees_perf.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_packaging_metadata.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_quimb_backend.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_show_tensor_network_throughput.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_tenpy_backend.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_tensor_elements_perf.py +0 -0
- {tensor_network_visualization-1.5.3 → tensor_network_visualization-1.5.4}/tests/test_verify_script.py +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Alejandro Mata Ali
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alejandro Mata Ali
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tensor-network-visualization
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.4
|
|
4
4
|
Summary: Minimal Matplotlib visualizations for TensorKrowch, TensorNetwork, Quimb, TeNPy, and traced PyTorch/NumPy einsum tensor networks.
|
|
5
5
|
Author: Alejandro Mata Ali
|
|
6
6
|
License-Expression: MIT
|
|
@@ -63,12 +63,15 @@ PyTorch/NumPy `einsum` tensor networks.
|
|
|
63
63
|
|
|
64
64
|
## What This Library Does
|
|
65
65
|
|
|
66
|
-
Tensor-network libraries expose very different Python objects, but this package gives them
|
|
67
|
-
|
|
66
|
+
Tensor-network libraries expose very different Python objects, but this package gives them aligned
|
|
67
|
+
inspection and export entry points:
|
|
68
68
|
|
|
69
69
|
```python
|
|
70
70
|
fig, ax = show_tensor_network(...)
|
|
71
71
|
fig, ax = show_tensor_elements(...)
|
|
72
|
+
fig, ax = show_tensor_comparison(...)
|
|
73
|
+
graph = normalize_tensor_network(...)
|
|
74
|
+
snapshot = export_tensor_network_snapshot(...)
|
|
72
75
|
```
|
|
73
76
|
|
|
74
77
|
Internally, the library:
|
|
@@ -79,7 +82,7 @@ Internally, the library:
|
|
|
79
82
|
4. optionally adds figure controls for view/label/scheme toggles.
|
|
80
83
|
|
|
81
84
|
The goal is to keep the public API small while still being useful for notebooks, papers, debugging,
|
|
82
|
-
and
|
|
85
|
+
saved figures, and external tooling that wants the backend-normalized graph model.
|
|
83
86
|
|
|
84
87
|
## Install
|
|
85
88
|
|
|
@@ -211,9 +214,10 @@ When several tensors are present, the figure keeps one tensor active at a time a
|
|
|
211
214
|
to switch between them. The interactive controls are grouped: `basic` (`elements`, `magnitude`,
|
|
212
215
|
`log_magnitude`, `distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
213
216
|
`diagnostic` (`sign`, `signed_value`, `sparsity`, `nan_inf`, `singular_values`, `eigen_real`,
|
|
214
|
-
`eigen_imag`).
|
|
217
|
+
`eigen_imag`), plus `analysis` (`slice`, `reduce`, `profiles`).
|
|
215
218
|
|
|
216
|
-
- `data`:
|
|
219
|
+
- `data`: direct numeric tensor input (for example a NumPy array), direct iterables of tensors
|
|
220
|
+
preserving order and duplicates, supported backend-native tensor collections, or an
|
|
217
221
|
`EinsumTrace` with live tensor values.
|
|
218
222
|
- `engine`: optional backend override. If omitted, the library auto-detects it.
|
|
219
223
|
- `config`: tensor-inspection behavior lives here.
|
|
@@ -228,12 +232,57 @@ to switch between them. The interactive controls are grouped: `basic` (`elements
|
|
|
228
232
|
tensor slider.
|
|
229
233
|
- `show`: if `False`, nothing is displayed automatically.
|
|
230
234
|
|
|
235
|
+
### `show_tensor_comparison`
|
|
236
|
+
|
|
237
|
+
Use `show_tensor_comparison` to compare one tensor against one reference tensor:
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
show_tensor_comparison(
|
|
241
|
+
data,
|
|
242
|
+
reference,
|
|
243
|
+
*,
|
|
244
|
+
engine=None,
|
|
245
|
+
config=None,
|
|
246
|
+
comparison_config=None,
|
|
247
|
+
ax=None,
|
|
248
|
+
show_controls=True,
|
|
249
|
+
show=True,
|
|
250
|
+
)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
- `config`: still uses `TensorElementsConfig(...)` for matrixization and rendering style.
|
|
254
|
+
- `comparison_config`: uses `TensorComparisonConfig(...)` for comparison-specific behavior.
|
|
255
|
+
- comparison modes are `reference`, `abs_diff`, `relative_diff`, `ratio`, `sign_change`,
|
|
256
|
+
`phase_change`, and `topk_changes`.
|
|
257
|
+
|
|
258
|
+
### Normalized snapshots
|
|
259
|
+
|
|
260
|
+
Use the snapshot helpers when you want the backend-normalized graph and layout without touching any
|
|
261
|
+
backend adapter internals:
|
|
262
|
+
|
|
263
|
+
```python
|
|
264
|
+
graph = normalize_tensor_network(network, engine=None)
|
|
265
|
+
snapshot = export_tensor_network_snapshot(
|
|
266
|
+
network,
|
|
267
|
+
engine=None,
|
|
268
|
+
view="2d",
|
|
269
|
+
config=PlotConfig(),
|
|
270
|
+
seed=0,
|
|
271
|
+
)
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Both snapshot objects are immutable and expose `.to_dict()` for serialization.
|
|
275
|
+
|
|
231
276
|
### `PlotConfig`
|
|
232
277
|
|
|
233
278
|
Use `PlotConfig` for visual behavior:
|
|
234
279
|
|
|
235
280
|
```python
|
|
236
|
-
from tensor_network_viz import
|
|
281
|
+
from tensor_network_viz import (
|
|
282
|
+
PlotConfig,
|
|
283
|
+
TensorNetworkDiagnosticsConfig,
|
|
284
|
+
TensorNetworkFocus,
|
|
285
|
+
)
|
|
237
286
|
|
|
238
287
|
config = PlotConfig(
|
|
239
288
|
show_nodes=True,
|
|
@@ -243,6 +292,15 @@ config = PlotConfig(
|
|
|
243
292
|
show_contraction_scheme=False,
|
|
244
293
|
contraction_scheme_cost_hover=False,
|
|
245
294
|
contraction_tensor_inspector=False,
|
|
295
|
+
diagnostics=TensorNetworkDiagnosticsConfig(
|
|
296
|
+
show_overlay=False,
|
|
297
|
+
include_hover=True,
|
|
298
|
+
),
|
|
299
|
+
focus=TensorNetworkFocus(
|
|
300
|
+
kind="neighborhood",
|
|
301
|
+
center="A",
|
|
302
|
+
radius=1,
|
|
303
|
+
),
|
|
246
304
|
tensor_label_refinement="auto",
|
|
247
305
|
tensor_label_fontsize=None,
|
|
248
306
|
edge_label_fontsize=None,
|
|
@@ -253,6 +311,8 @@ This is where you configure:
|
|
|
253
311
|
|
|
254
312
|
- labels,
|
|
255
313
|
- hover tooltips,
|
|
314
|
+
- diagnostics overlays and enriched hover payloads (`shape`, `dtype`, `bond dimension`, memory),
|
|
315
|
+
- reproducible subnetwork focus (`neighborhood` radius 1/2 or shortest `path` by tensor name),
|
|
256
316
|
- contraction-scheme overlays,
|
|
257
317
|
- optional tensor/edge label font-size overrides,
|
|
258
318
|
- styling,
|
|
@@ -266,12 +326,20 @@ This is where you configure:
|
|
|
266
326
|
Use `TensorElementsConfig` for tensor inspection behavior:
|
|
267
327
|
|
|
268
328
|
```python
|
|
269
|
-
from tensor_network_viz import TensorElementsConfig
|
|
329
|
+
from tensor_network_viz import TensorAnalysisConfig, TensorElementsConfig
|
|
270
330
|
|
|
271
331
|
config = TensorElementsConfig(
|
|
272
332
|
mode="auto",
|
|
273
333
|
row_axes=None,
|
|
274
334
|
col_axes=None,
|
|
335
|
+
analysis=TensorAnalysisConfig(
|
|
336
|
+
slice_axis="phys",
|
|
337
|
+
slice_index=0,
|
|
338
|
+
reduce_axes=("bond",),
|
|
339
|
+
reduce_method="mean",
|
|
340
|
+
profile_axis="phys",
|
|
341
|
+
profile_method="norm",
|
|
342
|
+
),
|
|
275
343
|
figsize=(7.2, 6.4),
|
|
276
344
|
max_matrix_shape=(256, 256),
|
|
277
345
|
shared_color_scale=False,
|
|
@@ -290,6 +358,7 @@ This is where you configure:
|
|
|
290
358
|
|
|
291
359
|
- the active inspection mode,
|
|
292
360
|
- row/column axis grouping for rank > 2 tensors,
|
|
361
|
+
- analysis selectors for `slice`, `reduce`, and `profiles`,
|
|
293
362
|
- heatmap downsampling limits,
|
|
294
363
|
- histogram sampling and bin count,
|
|
295
364
|
- data-summary depth (`topk_count`),
|
|
@@ -299,15 +368,27 @@ This is where you configure:
|
|
|
299
368
|
|
|
300
369
|
If you want to start in a specific grouped view, pass `mode="real"`, `mode="imag"`,
|
|
301
370
|
`mode="phase"`, `mode="log_magnitude"`, `mode="sparsity"`, `mode="nan_inf"`, `mode="sign"`,
|
|
302
|
-
`mode="signed_value"`, `mode="singular_values"`, `mode="eigen_real"`,
|
|
303
|
-
`TensorElementsConfig(...)`.
|
|
371
|
+
`mode="signed_value"`, `mode="singular_values"`, `mode="eigen_real"`, `mode="eigen_imag"`,
|
|
372
|
+
`mode="slice"`, `mode="reduce"`, or `mode="profiles"` directly in `TensorElementsConfig(...)`.
|
|
373
|
+
|
|
374
|
+
For the analytical views, keep this mental model:
|
|
375
|
+
|
|
376
|
+
- `slice` fixes one axis at one index and removes that axis from the result.
|
|
377
|
+
- `reduce` collapses the checked axes with `mean` or `norm`, so you see the axes that were not
|
|
378
|
+
checked.
|
|
379
|
+
- `profiles` keeps one axis as a 1D curve and reduces the other surviving axes.
|
|
304
380
|
|
|
305
381
|
## Most Common Workflows
|
|
306
382
|
|
|
307
383
|
### Interactive figure with controls
|
|
308
384
|
|
|
309
385
|
```python
|
|
310
|
-
from tensor_network_viz import
|
|
386
|
+
from tensor_network_viz import (
|
|
387
|
+
PlotConfig,
|
|
388
|
+
TensorNetworkDiagnosticsConfig,
|
|
389
|
+
TensorNetworkFocus,
|
|
390
|
+
show_tensor_network,
|
|
391
|
+
)
|
|
311
392
|
|
|
312
393
|
fig, ax = show_tensor_network(
|
|
313
394
|
network,
|
|
@@ -315,10 +396,17 @@ fig, ax = show_tensor_network(
|
|
|
315
396
|
show_tensor_labels=False,
|
|
316
397
|
show_index_labels=False,
|
|
317
398
|
hover_labels=True,
|
|
399
|
+
diagnostics=TensorNetworkDiagnosticsConfig(show_overlay=True),
|
|
400
|
+
focus=TensorNetworkFocus(kind="neighborhood", center="A", radius=1),
|
|
318
401
|
),
|
|
319
402
|
)
|
|
320
403
|
```
|
|
321
404
|
|
|
405
|
+
When the network exposes inspectable tensor values, clicking a visible tensor node opens the shared
|
|
406
|
+
auxiliary inspector directly. In playback-enabled traces, the same inspector can still follow the
|
|
407
|
+
current contraction result or stay pinned to a manually selected node until you click empty space
|
|
408
|
+
to clear the manual selection.
|
|
409
|
+
|
|
322
410
|
### Clean export with no embedded controls
|
|
323
411
|
|
|
324
412
|
```python
|
|
@@ -339,16 +427,71 @@ fig.savefig("network.png", bbox_inches="tight")
|
|
|
339
427
|
### Inspect tensor values
|
|
340
428
|
|
|
341
429
|
```python
|
|
342
|
-
from tensor_network_viz import TensorElementsConfig, show_tensor_elements
|
|
430
|
+
from tensor_network_viz import TensorAnalysisConfig, TensorElementsConfig, show_tensor_elements
|
|
343
431
|
|
|
344
432
|
fig, ax = show_tensor_elements(
|
|
345
433
|
trace,
|
|
346
|
-
config=TensorElementsConfig(
|
|
434
|
+
config=TensorElementsConfig(
|
|
435
|
+
mode="profiles",
|
|
436
|
+
analysis=TensorAnalysisConfig(profile_axis="phys", profile_method="norm"),
|
|
437
|
+
),
|
|
347
438
|
show=False,
|
|
348
439
|
)
|
|
349
440
|
fig.savefig("tensor-elements.png", bbox_inches="tight")
|
|
350
441
|
```
|
|
351
442
|
|
|
443
|
+
### Export a focused snapshot with diagnostics
|
|
444
|
+
|
|
445
|
+
```python
|
|
446
|
+
from tensor_network_viz import (
|
|
447
|
+
PlotConfig,
|
|
448
|
+
TensorNetworkDiagnosticsConfig,
|
|
449
|
+
TensorNetworkFocus,
|
|
450
|
+
export_tensor_network_snapshot,
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
snapshot = export_tensor_network_snapshot(
|
|
454
|
+
network,
|
|
455
|
+
config=PlotConfig(
|
|
456
|
+
diagnostics=TensorNetworkDiagnosticsConfig(include_hover=True),
|
|
457
|
+
focus=TensorNetworkFocus(kind="path", endpoints=("A", "C")),
|
|
458
|
+
),
|
|
459
|
+
)
|
|
460
|
+
payload = snapshot.to_dict()
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### Compare tensors
|
|
464
|
+
|
|
465
|
+
```python
|
|
466
|
+
from tensor_network_viz import (
|
|
467
|
+
TensorComparisonConfig,
|
|
468
|
+
TensorElementsConfig,
|
|
469
|
+
show_tensor_comparison,
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
fig, ax = show_tensor_comparison(
|
|
473
|
+
current_tensor,
|
|
474
|
+
reference_tensor,
|
|
475
|
+
config=TensorElementsConfig(mode="elements"),
|
|
476
|
+
comparison_config=TensorComparisonConfig(mode="abs_diff"),
|
|
477
|
+
show=False,
|
|
478
|
+
)
|
|
479
|
+
fig.savefig("tensor-comparison.png", bbox_inches="tight")
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Export a normalized snapshot
|
|
483
|
+
|
|
484
|
+
```python
|
|
485
|
+
from tensor_network_viz import PlotConfig, export_tensor_network_snapshot
|
|
486
|
+
|
|
487
|
+
snapshot = export_tensor_network_snapshot(
|
|
488
|
+
network,
|
|
489
|
+
config=PlotConfig(),
|
|
490
|
+
view="2d",
|
|
491
|
+
)
|
|
492
|
+
payload = snapshot.to_dict()
|
|
493
|
+
```
|
|
494
|
+
|
|
352
495
|
### Faster render for large graphs
|
|
353
496
|
|
|
354
497
|
```python
|
|
@@ -465,6 +608,7 @@ For fuller backend examples, see [docs/backends.md](docs/backends.md).
|
|
|
465
608
|
| `hover_labels` | Enable hover tooltips in interactive sessions. |
|
|
466
609
|
| `show_contraction_scheme` | Enable the dynamic contraction slider with real node shape/color changes. |
|
|
467
610
|
| `contraction_scheme_cost_hover` | Show contraction details in the slider panel. |
|
|
611
|
+
| `contraction_tensor_inspector` | Enable the auxiliary tensor inspector with direct node selection and comparison controls. |
|
|
468
612
|
| `tensor_label_refinement` | `"auto"`, `"always"`, or `"never"` for the expensive label-fit pass. |
|
|
469
613
|
| `layout_iterations` | Force-layout effort. |
|
|
470
614
|
| `positions` | Supply custom node coordinates. |
|
|
@@ -12,12 +12,15 @@ PyTorch/NumPy `einsum` tensor networks.
|
|
|
12
12
|
|
|
13
13
|
## What This Library Does
|
|
14
14
|
|
|
15
|
-
Tensor-network libraries expose very different Python objects, but this package gives them
|
|
16
|
-
|
|
15
|
+
Tensor-network libraries expose very different Python objects, but this package gives them aligned
|
|
16
|
+
inspection and export entry points:
|
|
17
17
|
|
|
18
18
|
```python
|
|
19
19
|
fig, ax = show_tensor_network(...)
|
|
20
20
|
fig, ax = show_tensor_elements(...)
|
|
21
|
+
fig, ax = show_tensor_comparison(...)
|
|
22
|
+
graph = normalize_tensor_network(...)
|
|
23
|
+
snapshot = export_tensor_network_snapshot(...)
|
|
21
24
|
```
|
|
22
25
|
|
|
23
26
|
Internally, the library:
|
|
@@ -28,7 +31,7 @@ Internally, the library:
|
|
|
28
31
|
4. optionally adds figure controls for view/label/scheme toggles.
|
|
29
32
|
|
|
30
33
|
The goal is to keep the public API small while still being useful for notebooks, papers, debugging,
|
|
31
|
-
and
|
|
34
|
+
saved figures, and external tooling that wants the backend-normalized graph model.
|
|
32
35
|
|
|
33
36
|
## Install
|
|
34
37
|
|
|
@@ -160,9 +163,10 @@ When several tensors are present, the figure keeps one tensor active at a time a
|
|
|
160
163
|
to switch between them. The interactive controls are grouped: `basic` (`elements`, `magnitude`,
|
|
161
164
|
`log_magnitude`, `distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
|
|
162
165
|
`diagnostic` (`sign`, `signed_value`, `sparsity`, `nan_inf`, `singular_values`, `eigen_real`,
|
|
163
|
-
`eigen_imag`).
|
|
166
|
+
`eigen_imag`), plus `analysis` (`slice`, `reduce`, `profiles`).
|
|
164
167
|
|
|
165
|
-
- `data`:
|
|
168
|
+
- `data`: direct numeric tensor input (for example a NumPy array), direct iterables of tensors
|
|
169
|
+
preserving order and duplicates, supported backend-native tensor collections, or an
|
|
166
170
|
`EinsumTrace` with live tensor values.
|
|
167
171
|
- `engine`: optional backend override. If omitted, the library auto-detects it.
|
|
168
172
|
- `config`: tensor-inspection behavior lives here.
|
|
@@ -177,12 +181,57 @@ to switch between them. The interactive controls are grouped: `basic` (`elements
|
|
|
177
181
|
tensor slider.
|
|
178
182
|
- `show`: if `False`, nothing is displayed automatically.
|
|
179
183
|
|
|
184
|
+
### `show_tensor_comparison`
|
|
185
|
+
|
|
186
|
+
Use `show_tensor_comparison` to compare one tensor against one reference tensor:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
show_tensor_comparison(
|
|
190
|
+
data,
|
|
191
|
+
reference,
|
|
192
|
+
*,
|
|
193
|
+
engine=None,
|
|
194
|
+
config=None,
|
|
195
|
+
comparison_config=None,
|
|
196
|
+
ax=None,
|
|
197
|
+
show_controls=True,
|
|
198
|
+
show=True,
|
|
199
|
+
)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
- `config`: still uses `TensorElementsConfig(...)` for matrixization and rendering style.
|
|
203
|
+
- `comparison_config`: uses `TensorComparisonConfig(...)` for comparison-specific behavior.
|
|
204
|
+
- comparison modes are `reference`, `abs_diff`, `relative_diff`, `ratio`, `sign_change`,
|
|
205
|
+
`phase_change`, and `topk_changes`.
|
|
206
|
+
|
|
207
|
+
### Normalized snapshots
|
|
208
|
+
|
|
209
|
+
Use the snapshot helpers when you want the backend-normalized graph and layout without touching any
|
|
210
|
+
backend adapter internals:
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
graph = normalize_tensor_network(network, engine=None)
|
|
214
|
+
snapshot = export_tensor_network_snapshot(
|
|
215
|
+
network,
|
|
216
|
+
engine=None,
|
|
217
|
+
view="2d",
|
|
218
|
+
config=PlotConfig(),
|
|
219
|
+
seed=0,
|
|
220
|
+
)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Both snapshot objects are immutable and expose `.to_dict()` for serialization.
|
|
224
|
+
|
|
180
225
|
### `PlotConfig`
|
|
181
226
|
|
|
182
227
|
Use `PlotConfig` for visual behavior:
|
|
183
228
|
|
|
184
229
|
```python
|
|
185
|
-
from tensor_network_viz import
|
|
230
|
+
from tensor_network_viz import (
|
|
231
|
+
PlotConfig,
|
|
232
|
+
TensorNetworkDiagnosticsConfig,
|
|
233
|
+
TensorNetworkFocus,
|
|
234
|
+
)
|
|
186
235
|
|
|
187
236
|
config = PlotConfig(
|
|
188
237
|
show_nodes=True,
|
|
@@ -192,6 +241,15 @@ config = PlotConfig(
|
|
|
192
241
|
show_contraction_scheme=False,
|
|
193
242
|
contraction_scheme_cost_hover=False,
|
|
194
243
|
contraction_tensor_inspector=False,
|
|
244
|
+
diagnostics=TensorNetworkDiagnosticsConfig(
|
|
245
|
+
show_overlay=False,
|
|
246
|
+
include_hover=True,
|
|
247
|
+
),
|
|
248
|
+
focus=TensorNetworkFocus(
|
|
249
|
+
kind="neighborhood",
|
|
250
|
+
center="A",
|
|
251
|
+
radius=1,
|
|
252
|
+
),
|
|
195
253
|
tensor_label_refinement="auto",
|
|
196
254
|
tensor_label_fontsize=None,
|
|
197
255
|
edge_label_fontsize=None,
|
|
@@ -202,6 +260,8 @@ This is where you configure:
|
|
|
202
260
|
|
|
203
261
|
- labels,
|
|
204
262
|
- hover tooltips,
|
|
263
|
+
- diagnostics overlays and enriched hover payloads (`shape`, `dtype`, `bond dimension`, memory),
|
|
264
|
+
- reproducible subnetwork focus (`neighborhood` radius 1/2 or shortest `path` by tensor name),
|
|
205
265
|
- contraction-scheme overlays,
|
|
206
266
|
- optional tensor/edge label font-size overrides,
|
|
207
267
|
- styling,
|
|
@@ -215,12 +275,20 @@ This is where you configure:
|
|
|
215
275
|
Use `TensorElementsConfig` for tensor inspection behavior:
|
|
216
276
|
|
|
217
277
|
```python
|
|
218
|
-
from tensor_network_viz import TensorElementsConfig
|
|
278
|
+
from tensor_network_viz import TensorAnalysisConfig, TensorElementsConfig
|
|
219
279
|
|
|
220
280
|
config = TensorElementsConfig(
|
|
221
281
|
mode="auto",
|
|
222
282
|
row_axes=None,
|
|
223
283
|
col_axes=None,
|
|
284
|
+
analysis=TensorAnalysisConfig(
|
|
285
|
+
slice_axis="phys",
|
|
286
|
+
slice_index=0,
|
|
287
|
+
reduce_axes=("bond",),
|
|
288
|
+
reduce_method="mean",
|
|
289
|
+
profile_axis="phys",
|
|
290
|
+
profile_method="norm",
|
|
291
|
+
),
|
|
224
292
|
figsize=(7.2, 6.4),
|
|
225
293
|
max_matrix_shape=(256, 256),
|
|
226
294
|
shared_color_scale=False,
|
|
@@ -239,6 +307,7 @@ This is where you configure:
|
|
|
239
307
|
|
|
240
308
|
- the active inspection mode,
|
|
241
309
|
- row/column axis grouping for rank > 2 tensors,
|
|
310
|
+
- analysis selectors for `slice`, `reduce`, and `profiles`,
|
|
242
311
|
- heatmap downsampling limits,
|
|
243
312
|
- histogram sampling and bin count,
|
|
244
313
|
- data-summary depth (`topk_count`),
|
|
@@ -248,15 +317,27 @@ This is where you configure:
|
|
|
248
317
|
|
|
249
318
|
If you want to start in a specific grouped view, pass `mode="real"`, `mode="imag"`,
|
|
250
319
|
`mode="phase"`, `mode="log_magnitude"`, `mode="sparsity"`, `mode="nan_inf"`, `mode="sign"`,
|
|
251
|
-
`mode="signed_value"`, `mode="singular_values"`, `mode="eigen_real"`,
|
|
252
|
-
`TensorElementsConfig(...)`.
|
|
320
|
+
`mode="signed_value"`, `mode="singular_values"`, `mode="eigen_real"`, `mode="eigen_imag"`,
|
|
321
|
+
`mode="slice"`, `mode="reduce"`, or `mode="profiles"` directly in `TensorElementsConfig(...)`.
|
|
322
|
+
|
|
323
|
+
For the analytical views, keep this mental model:
|
|
324
|
+
|
|
325
|
+
- `slice` fixes one axis at one index and removes that axis from the result.
|
|
326
|
+
- `reduce` collapses the checked axes with `mean` or `norm`, so you see the axes that were not
|
|
327
|
+
checked.
|
|
328
|
+
- `profiles` keeps one axis as a 1D curve and reduces the other surviving axes.
|
|
253
329
|
|
|
254
330
|
## Most Common Workflows
|
|
255
331
|
|
|
256
332
|
### Interactive figure with controls
|
|
257
333
|
|
|
258
334
|
```python
|
|
259
|
-
from tensor_network_viz import
|
|
335
|
+
from tensor_network_viz import (
|
|
336
|
+
PlotConfig,
|
|
337
|
+
TensorNetworkDiagnosticsConfig,
|
|
338
|
+
TensorNetworkFocus,
|
|
339
|
+
show_tensor_network,
|
|
340
|
+
)
|
|
260
341
|
|
|
261
342
|
fig, ax = show_tensor_network(
|
|
262
343
|
network,
|
|
@@ -264,10 +345,17 @@ fig, ax = show_tensor_network(
|
|
|
264
345
|
show_tensor_labels=False,
|
|
265
346
|
show_index_labels=False,
|
|
266
347
|
hover_labels=True,
|
|
348
|
+
diagnostics=TensorNetworkDiagnosticsConfig(show_overlay=True),
|
|
349
|
+
focus=TensorNetworkFocus(kind="neighborhood", center="A", radius=1),
|
|
267
350
|
),
|
|
268
351
|
)
|
|
269
352
|
```
|
|
270
353
|
|
|
354
|
+
When the network exposes inspectable tensor values, clicking a visible tensor node opens the shared
|
|
355
|
+
auxiliary inspector directly. In playback-enabled traces, the same inspector can still follow the
|
|
356
|
+
current contraction result or stay pinned to a manually selected node until you click empty space
|
|
357
|
+
to clear the manual selection.
|
|
358
|
+
|
|
271
359
|
### Clean export with no embedded controls
|
|
272
360
|
|
|
273
361
|
```python
|
|
@@ -288,16 +376,71 @@ fig.savefig("network.png", bbox_inches="tight")
|
|
|
288
376
|
### Inspect tensor values
|
|
289
377
|
|
|
290
378
|
```python
|
|
291
|
-
from tensor_network_viz import TensorElementsConfig, show_tensor_elements
|
|
379
|
+
from tensor_network_viz import TensorAnalysisConfig, TensorElementsConfig, show_tensor_elements
|
|
292
380
|
|
|
293
381
|
fig, ax = show_tensor_elements(
|
|
294
382
|
trace,
|
|
295
|
-
config=TensorElementsConfig(
|
|
383
|
+
config=TensorElementsConfig(
|
|
384
|
+
mode="profiles",
|
|
385
|
+
analysis=TensorAnalysisConfig(profile_axis="phys", profile_method="norm"),
|
|
386
|
+
),
|
|
296
387
|
show=False,
|
|
297
388
|
)
|
|
298
389
|
fig.savefig("tensor-elements.png", bbox_inches="tight")
|
|
299
390
|
```
|
|
300
391
|
|
|
392
|
+
### Export a focused snapshot with diagnostics
|
|
393
|
+
|
|
394
|
+
```python
|
|
395
|
+
from tensor_network_viz import (
|
|
396
|
+
PlotConfig,
|
|
397
|
+
TensorNetworkDiagnosticsConfig,
|
|
398
|
+
TensorNetworkFocus,
|
|
399
|
+
export_tensor_network_snapshot,
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
snapshot = export_tensor_network_snapshot(
|
|
403
|
+
network,
|
|
404
|
+
config=PlotConfig(
|
|
405
|
+
diagnostics=TensorNetworkDiagnosticsConfig(include_hover=True),
|
|
406
|
+
focus=TensorNetworkFocus(kind="path", endpoints=("A", "C")),
|
|
407
|
+
),
|
|
408
|
+
)
|
|
409
|
+
payload = snapshot.to_dict()
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Compare tensors
|
|
413
|
+
|
|
414
|
+
```python
|
|
415
|
+
from tensor_network_viz import (
|
|
416
|
+
TensorComparisonConfig,
|
|
417
|
+
TensorElementsConfig,
|
|
418
|
+
show_tensor_comparison,
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
fig, ax = show_tensor_comparison(
|
|
422
|
+
current_tensor,
|
|
423
|
+
reference_tensor,
|
|
424
|
+
config=TensorElementsConfig(mode="elements"),
|
|
425
|
+
comparison_config=TensorComparisonConfig(mode="abs_diff"),
|
|
426
|
+
show=False,
|
|
427
|
+
)
|
|
428
|
+
fig.savefig("tensor-comparison.png", bbox_inches="tight")
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Export a normalized snapshot
|
|
432
|
+
|
|
433
|
+
```python
|
|
434
|
+
from tensor_network_viz import PlotConfig, export_tensor_network_snapshot
|
|
435
|
+
|
|
436
|
+
snapshot = export_tensor_network_snapshot(
|
|
437
|
+
network,
|
|
438
|
+
config=PlotConfig(),
|
|
439
|
+
view="2d",
|
|
440
|
+
)
|
|
441
|
+
payload = snapshot.to_dict()
|
|
442
|
+
```
|
|
443
|
+
|
|
301
444
|
### Faster render for large graphs
|
|
302
445
|
|
|
303
446
|
```python
|
|
@@ -414,6 +557,7 @@ For fuller backend examples, see [docs/backends.md](docs/backends.md).
|
|
|
414
557
|
| `hover_labels` | Enable hover tooltips in interactive sessions. |
|
|
415
558
|
| `show_contraction_scheme` | Enable the dynamic contraction slider with real node shape/color changes. |
|
|
416
559
|
| `contraction_scheme_cost_hover` | Show contraction details in the slider panel. |
|
|
560
|
+
| `contraction_tensor_inspector` | Enable the auxiliary tensor inspector with direct node selection and comparison controls. |
|
|
417
561
|
| `tensor_label_refinement` | `"auto"`, `"always"`, or `"never"` for the expensive label-fit pass. |
|
|
418
562
|
| `layout_iterations` | Force-layout effort. |
|
|
419
563
|
| `positions` | Supply custom node coordinates. |
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tensor-network-visualization"
|
|
7
|
-
version = "1.5.
|
|
7
|
+
version = "1.5.4"
|
|
8
8
|
description = "Minimal Matplotlib visualizations for TensorKrowch, TensorNetwork, Quimb, TeNPy, and traced PyTorch/NumPy einsum tensor networks."
|
|
9
9
|
authors = [{ name = "Alejandro Mata Ali" }]
|
|
10
10
|
readme = "README.md"
|