OpenMined / TenSEAL

A library for doing homomorphic encryption operations on tensors
Apache License 2.0
837 stars 158 forks source link

Property `shape` missing for `CKKSVector` #379

Closed mrader1248 closed 1 year ago

mrader1248 commented 2 years ago

Description

The property shape is missing for CKKSVector.

How to Reproduce

Use the following piece of code to reproduce the bug.

import numpy as np
import tenseal as ts

context = ts.context(
    ts.SCHEME_TYPE.CKKS,
    poly_modulus_degree=8192,
    coeff_mod_bit_sizes=[60, 40, 40, 60]
)
context.global_scale = 2**40

a = ts.ckks_tensor(context, np.arange(16.0))
print(a.shape)

a = ts.ckks_vector(context, np.arange(16.0))
print(a.shape)

Expected Behavior

The two print statements in the code above are expected to both print "[16]". While the first print statement executes as expected, the second one (specifically calling the property shape) fails with

AttributeError: '_tenseal_cpp.CKKSVector' object has no attribute 'shape'

System Information

youben11 commented 2 years ago

Thanks for the issue @mrader1248 but this is not a bug, but a feature request. Vector types do have a sizeattribute but not a shape

mrader1248 commented 2 years ago

Forgive me, but I disagree with you on that. The class CKKSVector is derived from AbstractTensor, which defines the property shape. Therefore, from an OOP-POV, the child class CKKSVector has to support this property.