Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running encodeFrac and display ValueError: Buffer dtype mismatch, expected 'double' but got 'float' #239

Open
lilvmy opened this issue Jun 7, 2024 · 0 comments
Labels

Comments

@lilvmy
Copy link

lilvmy commented Jun 7, 2024

When I use the new version of Pyfhel, for example
pip install Pyfhel
def encode_matrix(HE, matrix):
# Base case: if the matrix is one-dimensional, directly apply encodeFrac to each element.
if matrix.ndim == 1:
return np.array([HE.encodeFrac(matrix)])
# Recursive case: apply encode_matrix to each sub-array.
else:
return np.array([encode_matrix(HE, sub_matrix) for sub_matrix in matrix])
HE = Pyfhel()
ckks_params = {
"scheme": "CKKS",
"n": 214,
"scale": 2
40,
"qi_sizes":[60,40,40,40,60]
}

HE.contextGen(**ckks_params)
HE.keyGen()
HE.rotateKeyGen()
HE.relinKeyGen()
a = np.array([[[1.0,2.4,3.6],[4.2,5.5,6.7]],[[2.3,3.4,4.8],[5.2,6.5,7.8]]])
b = encode_matrix(HE, matrix)
This code runs a error:
return np.array([HE.encodeFrac(matrix)])
File "Pyfhel/Pyfhel.pyx", line 742, in Pyfhel.Pyfhel.Pyfhel.encodeFrac
ValueError: Buffer dtype mismatch, expected 'double' but got 'float'
So how do I solve this problem

@lilvmy lilvmy added the bug label Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant