fix(compiler): fix plaintext tensor shape when using crt

client parameter generation was removing last dimension of a tensor when using CRT including plaintext ones, while it should only be done for encrypted ones.
This commit is contained in:
Ayoub Benaissa
2023-06-20 09:07:03 +01:00
committed by Ayoub Benaissa
parent b6da228dd4
commit 3bdebae1f6

View File

@@ -210,9 +210,10 @@ generateGate(mlir::Type type, encodings::Encoding encoding,
if (auto err = scalarGate.takeError()) {
return std::move(err);
}
if (maybeCrt.has_value()) {
// When using crt, the last dimension of the tensor is for the members
// of the decomposition. It should not be used.
if (maybeCrt.has_value() && scalarGate->isEncrypted()) {
// When using crt with encrypted tensors, the last dimension of the
// tensor is for the members of the decomposition. It should not be
// used.
scalarGate->shape.dimensions =
tensor.getShape().take_front(tensor.getShape().size() - 1).vec();
} else {