Extensions
fhe.univariate(function)
import numpy as np
from concrete import fhe
def complex_univariate_function(x):
def per_element(element):
result = 0
for i in range(element):
result += i
return result
return np.vectorize(per_element)(x)
@fhe.compiler({"x": "encrypted"})
def f(x):
return fhe.univariate(complex_univariate_function)(x)
inputset = [np.random.randint(0, 5, size=(3, 2)) for _ in range(10)]
circuit = f.compile(inputset)
sample = np.array([
[0, 4],
[2, 1],
[3, 0],
])
assert np.array_equal(circuit.encrypt_run_decrypt(sample), complex_univariate_function(sample))fhe.multivariate(function)
fhe.conv(...)
fhe.maxpool(...)
fhe.array(...)
fhe.zero()
fhe.zeros(shape)
fhe.one()
fhe.ones(shape)
fhe.hint(value, **kwargs)
Last updated
Was this helpful?