mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
feat: allow multiple graphs with the same name in debug artifacts
This commit is contained in:
@@ -5,6 +5,8 @@ Tests of `DebugArtifacts` class.
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
from concrete.numpy.compilation import DebugArtifacts, compiler
|
||||
|
||||
|
||||
@@ -21,9 +23,11 @@ def test_artifacts_export(helpers):
|
||||
|
||||
@compiler({"x": "encrypted"})
|
||||
def f(x):
|
||||
return x + 10
|
||||
a = ((np.sin(x) ** 2) + (np.cos(x) ** 2)).astype(np.int64)
|
||||
b = np.where(x < 5, x * 10, x + 10)
|
||||
return a + b
|
||||
|
||||
inputset = range(100)
|
||||
inputset = range(10)
|
||||
f.compile(inputset, configuration, artifacts)
|
||||
|
||||
artifacts.export()
|
||||
@@ -37,8 +41,14 @@ def test_artifacts_export(helpers):
|
||||
assert (tmpdir / "1.initial.graph.txt").exists()
|
||||
assert (tmpdir / "1.initial.graph.png").exists()
|
||||
|
||||
assert (tmpdir / "2.final.graph.txt").exists()
|
||||
assert (tmpdir / "2.final.graph.png").exists()
|
||||
assert (tmpdir / "2.after-fusing.graph.txt").exists()
|
||||
assert (tmpdir / "2.after-fusing.graph.png").exists()
|
||||
|
||||
assert (tmpdir / "3.after-fusing.graph.txt").exists()
|
||||
assert (tmpdir / "3.after-fusing.graph.png").exists()
|
||||
|
||||
assert (tmpdir / "4.final.graph.txt").exists()
|
||||
assert (tmpdir / "4.final.graph.png").exists()
|
||||
|
||||
assert (tmpdir / "bounds.txt").exists()
|
||||
assert (tmpdir / "mlir.txt").exists()
|
||||
@@ -55,8 +65,14 @@ def test_artifacts_export(helpers):
|
||||
assert (tmpdir / "1.initial.graph.txt").exists()
|
||||
assert (tmpdir / "1.initial.graph.png").exists()
|
||||
|
||||
assert (tmpdir / "2.final.graph.txt").exists()
|
||||
assert (tmpdir / "2.final.graph.png").exists()
|
||||
assert (tmpdir / "2.after-fusing.graph.txt").exists()
|
||||
assert (tmpdir / "2.after-fusing.graph.png").exists()
|
||||
|
||||
assert (tmpdir / "3.after-fusing.graph.txt").exists()
|
||||
assert (tmpdir / "3.after-fusing.graph.png").exists()
|
||||
|
||||
assert (tmpdir / "4.final.graph.txt").exists()
|
||||
assert (tmpdir / "4.final.graph.png").exists()
|
||||
|
||||
assert (tmpdir / "bounds.txt").exists()
|
||||
assert (tmpdir / "mlir.txt").exists()
|
||||
|
||||
@@ -46,7 +46,7 @@ def test_compiler_verbose_trace(helpers, capsys):
|
||||
|
||||
Computation Graph
|
||||
------------------------------------------------
|
||||
{str(list(artifacts.textual_representations_of_graphs.values())[-1])}
|
||||
{str(list(artifacts.textual_representations_of_graphs.values())[-1][-1])}
|
||||
------------------------------------------------
|
||||
|
||||
""".strip()
|
||||
@@ -74,7 +74,7 @@ def test_compiler_verbose_compile(helpers, capsys):
|
||||
|
||||
Computation Graph
|
||||
--------------------------------------------------------------------------------
|
||||
{list(artifacts.textual_representations_of_graphs.values())[-1]}
|
||||
{list(artifacts.textual_representations_of_graphs.values())[-1][-1]}
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
MLIR
|
||||
|
||||
Reference in New Issue
Block a user