Closed scutyuqiu closed 3 months ago
Hi @scutyuqiu, I reviewed issues on Pyfhel and demos, I found one that is helpful for you to read (exploring CKKS pitfalls).
I can recall that I faced similar issue and fixed that with rescaling (HE.rescale) as also pointed out in this issue on SEAL because when you are doing multiplication, you'll have ciphertext in different scale (compared to addition/subtraction) then addition wont work properly as you desired.
I solved the problem, but I was curious. It doesn't work when I set qi to 21, but it works when I set it to 22.
Well-done!
qi_size
is about the number of bits of each prime in the chain to ensure precision in encoding and decoding. However, I also dont have any connection now in mind between your scale mismatch and qi_size
.
File "Pyfhel/PyCtxt.pyx", line 360, in Pyfhel.PyCtxt.PyCtxt.add File "Pyfhel/Pyfhel.pyx", line 1050, in Pyfhel.Pyfhel.Pyfhel.add_plain File "Pyfhel/Pyfhel.pyx", line 1070, in Pyfhel.Pyfhel.Pyfhel.add_plain ValueError: scale mismatch
How can I resolve this error?
I use homomorphic encryption in neural networks. At the full connection layer, the encrypted data has been weighted, but this error occurs when adding with bias.
code.docx