concrete-numpy icon indicating copy to clipboard operation
concrete-numpy copied to clipboard

Is it possible to implement.sum and.array in numpy? Is that possible

Open zxcCEn opened this issue 3 years ago • 1 comments

Hello, after reading the operation manual and experiment, I want to implement the. Sum and. Array functions in numpy in ciphertext, is it feasible.

zxcCEn avatar Jun 09 '22 08:06 zxcCEn

Hello, np.sum will be available in the next release of concrete-numpy (v0.6.0, which will be released in a month). As for np.array(), we cannot support it directly because of technical limitations, but we might be able to provide hnp.array(...) to create encrypted arrays. Though, I cannot think of a situation in which you would want to do that.

umut-sahin avatar Jun 09 '22 09:06 umut-sahin

With the release of v0.6.0, np.sum is now supported.

import concrete.numpy as cnp
import numpy as np

@cnp.compiler({"x": "encrypted"})
def function(x):
    return np.sum(x)

inputset = [np.random.randint(0, 10, size=(2, 2)) for _ in range(10)]
circuit = function.compile(inputset)

sample = np.array([[1, 2], [3, 4]])
assert circuit.encrypt_run_decrypt(sample) == np.sum(sample)

The creation of encrypted arrays will come in v0.8.0 in a few months.

umut-sahin avatar Aug 31 '22 14:08 umut-sahin

Closing due to inactivity. Please create another issue if your problem is not resolved.

umut-sahin avatar Oct 10 '22 11:10 umut-sahin

Thank you for your help. I will give you feedback after the experiment.

------------------ 原始邮件 ------------------ 发件人: "zama-ai/concrete-numpy" @.>; 发送时间: 2022年8月31日(星期三) 晚上10:06 @.>; @.@.>; 主题: Re: [zama-ai/concrete-numpy] Is it possible to implement.sum and.array in numpy? Is that possible (Issue #26)

With the release of v0.6.0, np.sum is now supported. import concrete.numpy as cnp import numpy as np @cnp.compiler({"x": "encrypted"}) def function(x): return np.sum(x) inputset = [np.random.randint(0, 10, size=(2, 2)) for _ in range(10)] circuit = function.compile(inputset) sample = np.array([[1, 2], [3, 4]]) assert circuit.encrypt_run_decrypt(sample) == np.sum(sample)

The creation of encrypted arrays will come in v0.7.0 in a few months.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

zxcCEn avatar Oct 11 '22 07:10 zxcCEn