microsoft / EVA

Compiler for the SEAL homomorphic encryption library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simple question. is this a problem of graphviz?

dasylin opened this issue · comments

I made a code like this (there's no difference with original code in EVA git)
file name is 0819.py

from eva import *
poly = EvaProgram('Polynomial', vec_size=1024)
with poly:
    x = Input('x')
    Output('y', 3*x**2 + 5*x - 2)

poly.set_output_ranges(30)
poly.set_input_scales(30)

from eva.ckks import *
compiler = CKKSCompiler()
compiled_poly, params, signature = compiler.compile(poly)

print(compiled_poly.to_DOT())

from eva.seal import *
public_ctx, secret_ctx = generate_keys(params)

inputs = { 'x': [i for i in range(compiled_poly.vec_size)] }
encInputs = public_ctx.encrypt(inputs, signature)

encOutputs = public_ctx.execute(compiled_poly, encInputs)

outputs = secret_ctx.decrypt(encOutputs, signature)

from eva.metric import valuation_mse
reference = evaluate(compiled_poly, inputs)
print('MSE', valuation_mse(outputs, reference))

But when I type "python3 0819.py" in ubuntu, I can see this below.
Is it a problem of graphviz?
or should I change the code?

WARNING: Program specifies vector size 1024 while at least 4096 slots are required for security. This does not affect correctness, as the smaller vector size will be transparently emulated. However, using a vector size up to 4096 would come at no additional cost.
digraph "Polynomial" {
t7 [label="Constant"];
t7_EncodeAtScaleAttribute [shape=box label="scale=30"];
t7_EncodeAtScaleAttribute -> t7;
t7_EncodeAtLevelAttribute [shape=box label="level=1"];
t7_EncodeAtLevelAttribute -> t7;
t17 [label="Encode"];
t7 -> t17 [label="0"];
t17_EncodeAtScaleAttribute [shape=box label="scale=90"];
t17_EncodeAtScaleAttribute -> t17;
t17_EncodeAtLevelAttribute [shape=box label="level=0"];
t17_EncodeAtLevelAttribute -> t17;
t11 [label="Constant"];
t11_EncodeAtScaleAttribute [shape=box label="scale=30"];
t11_EncodeAtScaleAttribute -> t11;
t11_EncodeAtLevelAttribute [shape=box label="level=1"];
t11_EncodeAtLevelAttribute -> t11;
t16 [label="Encode"];
t11 -> t16 [label="0"];
t16_EncodeAtScaleAttribute [shape=box label="scale=30"];
t16_EncodeAtScaleAttribute -> t16;
t16_EncodeAtLevelAttribute [shape=box label="level=0"];
t16_EncodeAtLevelAttribute -> t16;
t0 [label="Input : Cipher"];
t0_EncodeAtScaleAttribute [shape=box label="scale=30"];
t0_EncodeAtScaleAttribute -> t0;
t0_EncodeAtLevelAttribute [shape=box label="level=0"];
t0_EncodeAtLevelAttribute -> t0;
t4 [label="Constant"];
t4_EncodeAtScaleAttribute [shape=box label="scale=30"];
t4_EncodeAtScaleAttribute -> t4;
t4_EncodeAtLevelAttribute [shape=box label="level=1"];
t4_EncodeAtLevelAttribute -> t4;
t15 [label="Encode"];
t4 -> t15 [label="0"];
t15_EncodeAtScaleAttribute [shape=box label="scale=30"];
t15_EncodeAtScaleAttribute -> t15;
t15_EncodeAtLevelAttribute [shape=box label="level=0"];
t15_EncodeAtLevelAttribute -> t15;
t5 [label="Mul"];
t15 -> t5 [label="0"];
t0 -> t5 [label="1"];
t12 [label="Mul"];
t5 -> t12 [label="0"];
t16 -> t12 [label="1"];
t2 [label="Constant"];
t2_EncodeAtScaleAttribute [shape=box label="scale=30"];
t2_EncodeAtScaleAttribute -> t2;
t2_EncodeAtLevelAttribute [shape=box label="level=1"];
t2_EncodeAtLevelAttribute -> t2;
t14 [label="Encode"];
t2 -> t14 [label="0"];
t14_EncodeAtScaleAttribute [shape=box label="scale=30"];
t14_EncodeAtScaleAttribute -> t14;
t14_EncodeAtLevelAttribute [shape=box label="level=0"];
t14_EncodeAtLevelAttribute -> t14;
t10 [label="Mul"];
t14 -> t10 [label="0"];
t0 -> t10 [label="1"];
t3 [label="Mul"];
t10 -> t3 [label="0"];
t0 -> t3 [label="1"];
t6 [label="Add"];
t3 -> t6 [label="0"];
t12 -> t6 [label="1"];
t8 [label="Sub"];
t6 -> t8 [label="0"];
t17 -> t8 [label="1"];
t13 [label="Rescale(60)"];
t8 -> t13 [label="0"];
t18 [label="Relinearize"];
t13 -> t18 [label="0"];
t9 [label="Output"];
t18 -> t9 [label="0"];
t9_RangeAttribute [shape=box label="range=30"];
t9_RangeAttribute -> t9;
}

MSE 2.0307120156632308e-05