multiply_pytorch_tensor_matrix
Engine.multiply_pytorch_tensor_matrix(tensor, ciphertext, rotation_key)- PyTorch tensor 행렬과 암호문을 곱한 암호문을 반환합니다. 레벨을 소모합니다.
- 인풋:
- tensor: torch.Tensor
- tensor는
Engine.slot_count행Engine.slot_count열 이어야 합니다.
- tensor는
- Ciphertext
- Rotation key
- tensor: torch.Tensor
- 아웃풋:
- Ciphertext
예시
import torch
from desilofhe import Engine
engine = Engine(slot_count=64)
secret_key = engine.create_secret_key()
rotation_key = engine.create_rotation_key(secret_key)
tensor = torch.arange(64 * 64).reshape(64, 64)
message = [2] * 64
ciphertext = engine.encrypt(message, secret_key)
multiplied = engine.multiply_matrix_pytorch_tensor_matrix(
tensor, ciphertext, rotation_key
) # [4032., 12224., 20416., 28608., ...]