Skip to content

Horizontal sum - encrypted size must be 2 #36

Description

Hi,

I'm trying to run a horizontal_sum on a vector of values and return one single sum (or a vector that has that sum in every position) by following your std test.

fromevaimportEvaProgram, Input, Outputfromeva.ckksimportCKKSCompilerfromeva.sealimportgenerate_keysfromeva.std.numericimporthorizontal_sumvec_sz=16poly=EvaProgram('poly', vec_size=vec_sz)
withpoly:
a=Input('a')
b=Input('b')
diff=a-bsq_diff=diff*diffdiff=horizontal_sum(sq_diff)
Output('diff', diff)
poly.set_input_scales(40)
poly.set_output_ranges(10)
a= [i%10foriinrange(vec_sz)]
b= [i%5foriinrange(vec_sz)]
compiler=CKKSCompiler()
compiled_poly, params, signature=compiler.compile(poly)
public_ctx, secret_ctx=generate_keys(params)
inputs= {'a': a, 'b': b}
encInputs=public_ctx.encrypt(inputs, signature)
encOutputs=public_ctx.execute(poly, encInputs)
outputs=secret_ctx.decrypt(encOutputs, signature)
print(outputs)

I'm getting the following error:

Traceback (most recent call last):
File "std_test.py", line 29, in <module>
encOutputs = public_ctx.execute(poly, encInputs)
ValueError: encrypted size must be 2

I might be missing something obvious, but it seems that this is very similar to the std example.

cc: cgouert (@cgouert)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions