Open maminiris opened 3 months ago
I failed to call the exp function. Could you provide a tutorial?
num_of_keys = 1 scale_bit = 16
Key0, Key1 = ExpKey.gen(num_of_keys, scale_bit)
y = RingTensor.convert_to_ring(torch.tensor(1)) x = ArithmeticSharedRingTensor.share(y, 2)
result_0 = Exp.eval(x, Key0, scale_bit) result_1 = Exp.eval(x, Key0, scale_bit)
print(result_0+result_1)
Exponential operations are fitted by polynomials
I failed to call the exp function. Could you provide a tutorial?
设置计算参数
num_of_keys = 1 scale_bit = 16
生成密钥
Key0, Key1 = ExpKey.gen(num_of_keys, scale_bit)
定义输入值
y = RingTensor.convert_to_ring(torch.tensor(1)) x = ArithmeticSharedRingTensor.share(y, 2)
调用指数函数计算
result_0 = Exp.eval(x, Key0, scale_bit) result_1 = Exp.eval(x, Key0, scale_bit)
打印结果
print(result_0+result_1)