Hello,
I am trying to access values of an array and to concatenate them afterwards. I have tried to use np.expand_dims(np.array(my_value))
and then concatenate them but it is then perceived as trying to return multiple ciphertexts :
import numpy as np
import concrete.numpy as cnp
import time
cfg = cnp.Configuration(show_graph=True, enable_unsafe_features=True)
@cnp.compiler({"x": "encrypted"})
def f(x):
y = np.array(x[0])
print(y.shape)
y = np.expand_dims(y,axis=0)
print(y.shape)
for i in range(1,x.shape[0]):
y = np.concatenate((y,np.expand_dims(np.array(x[i]),axis=0)),axis=0 )
return y
inputset = np.random.randint(0,2,(5,3))
inpt = np.random.randint(0,2,(3))
print(f(inpt))
t = time.time()
circuit = f.compile(inputset, configuration=cfg)
print('compiled in ', time.time()-t)
t = time.time()
circuit.keygen()
enc = circuit.encrypt(inpt)
res_enc = circuit.run(enc)
dec = circuit.decrypt(res_enc)
which gives the following output when trying to compute print(f(inpt))
:
ValueError: Value cannot represent array([<concrete.numpy.tracing.tracer.Tracer object at 0x7f08d0ba8be0>,
<concrete.numpy.tracing.tracer.Tracer object at 0x7f08d0b3a160>,
<concrete.numpy.tracing.tracer.Tracer object at 0x7f0858db11c0>],
dtype=object)
I would like to know if there is a workaround ?
I am using concrete-numpy=0.11.0
Thanks