How to do dynamic batch packaging of plaintext, for example, the gradient has several layers of different dimensions, so how to package and encrypt the plaintext according to this dimension, for example, the first layer has 10 tensors, the second layer has 360 tensors, I don’t want to initially set usint batchSize = 360; Can I set batchSize dynamically
You can set the number of slots at the ciphertext level (either during encryption or for a given ciphertext). When working multiple batch sizes (and using operations based on rotations like
EvalSumCols), please make sure rotation keys are generated for all indices.
how to set the number of slots at the ciphertext level,Can you give an example? thanks
You can use the
SetSlots method for Ciphertext but note that the internal structure should match the configured number of slots, i.e., the vector should be cloned until the maximum size for full packing (ring dimension / 2 for CKKS).