mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
fix(frontend-python): mimic summing like numpy exactly
This commit is contained in:
@@ -465,6 +465,12 @@ class Tracer:
|
||||
sanitized_args = [self.sanitize(args[0])]
|
||||
if len(args) > 1:
|
||||
kwargs["newshape"] = args[1]
|
||||
elif func is np.sum:
|
||||
sanitized_args = [self.sanitize(args[0])]
|
||||
for i, keyword in enumerate(["axis", "dtype", "out", "keepdims", "initial", "where"]):
|
||||
position = i + 1
|
||||
if len(args) > position:
|
||||
kwargs[keyword] = args[position]
|
||||
elif func is np.transpose:
|
||||
sanitized_args = [self.sanitize(args[0])]
|
||||
if len(args) > 1:
|
||||
|
||||
@@ -17,6 +17,18 @@ from concrete import fhe
|
||||
"x": {"shape": (3, 2), "range": [0, 10], "status": "encrypted"},
|
||||
},
|
||||
),
|
||||
pytest.param(
|
||||
lambda x: np.sum(x, 0),
|
||||
{
|
||||
"x": {"shape": (3, 2), "range": [0, 10], "status": "encrypted"},
|
||||
},
|
||||
),
|
||||
pytest.param(
|
||||
lambda x: np.sum(x, 1),
|
||||
{
|
||||
"x": {"shape": (3, 2), "range": [0, 10], "status": "encrypted"},
|
||||
},
|
||||
),
|
||||
pytest.param(
|
||||
lambda x: np.sum(x, axis=None), # type: ignore
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user