You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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": 240,
"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
The text was updated successfully, but these errors were encountered:
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": 240,
"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
The text was updated successfully, but these errors were encountered: