From 2545497689c90727ca200029e0bfdab7b87914a6 Mon Sep 17 00:00:00 2001 From: priya sridhar <121922820+theperiperi@users.noreply.github.com> Date: Sun, 14 Apr 2024 10:52:46 +0530 Subject: [PATCH 1/4] Update torch_wrapper.py --- src/aijack/defense/paillier/torch_wrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aijack/defense/paillier/torch_wrapper.py b/src/aijack/defense/paillier/torch_wrapper.py index 8dc1e585..f973964f 100644 --- a/src/aijack/defense/paillier/torch_wrapper.py +++ b/src/aijack/defense/paillier/torch_wrapper.py @@ -21,9 +21,9 @@ class PaillierTensor(object): """torch.Tensor-like object for Paillier Encryption""" def __init__(self, paillier_array): - if type(paillier_array) == list: + if isinstance(paillier_array) == list: self._paillier_np_array = np.array(paillier_array) - elif type(paillier_array) == np.ndarray: + elif isinstance(paillier_array) == np.ndarray: self._paillier_np_array = paillier_array else: raise TypeError(f"{type(paillier_array)} is not supported.") From 1bab2a7bf393c6b6159d672e331a7f6b8585b193 Mon Sep 17 00:00:00 2001 From: priya sridhar <121922820+theperiperi@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:58:06 +0530 Subject: [PATCH 2/4] Update torch_wrapper.py --- src/aijack/defense/paillier/torch_wrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aijack/defense/paillier/torch_wrapper.py b/src/aijack/defense/paillier/torch_wrapper.py index f973964f..7e314c10 100644 --- a/src/aijack/defense/paillier/torch_wrapper.py +++ b/src/aijack/defense/paillier/torch_wrapper.py @@ -21,9 +21,9 @@ class PaillierTensor(object): """torch.Tensor-like object for Paillier Encryption""" def __init__(self, paillier_array): - if isinstance(paillier_array) == list: + if isinstance(paillier_array, list) == list: self._paillier_np_array = np.array(paillier_array) - elif isinstance(paillier_array) == np.ndarray: + elif isinstance(paillier_array, np.ndarray) == np.ndarray: self._paillier_np_array = paillier_array else: raise TypeError(f"{type(paillier_array)} is not supported.") From 1228f3b2304b970fd081297aaab8d2757257c6a9 Mon Sep 17 00:00:00 2001 From: priya sridhar <121922820+theperiperi@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:45:42 +0530 Subject: [PATCH 3/4] Update torch_wrapper.py --- src/aijack/defense/paillier/torch_wrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aijack/defense/paillier/torch_wrapper.py b/src/aijack/defense/paillier/torch_wrapper.py index 7e314c10..35c2a313 100644 --- a/src/aijack/defense/paillier/torch_wrapper.py +++ b/src/aijack/defense/paillier/torch_wrapper.py @@ -21,9 +21,9 @@ class PaillierTensor(object): """torch.Tensor-like object for Paillier Encryption""" def __init__(self, paillier_array): - if isinstance(paillier_array, list) == list: + if isinstance(paillier_array, list) == True: self._paillier_np_array = np.array(paillier_array) - elif isinstance(paillier_array, np.ndarray) == np.ndarray: + elif isinstance(paillier_array, np.ndarray) == True: self._paillier_np_array = paillier_array else: raise TypeError(f"{type(paillier_array)} is not supported.") From b8c33868786e233b69a978e4fbd45850b3e48416 Mon Sep 17 00:00:00 2001 From: Hideaki Takahashi Date: Mon, 15 Apr 2024 20:20:22 +0900 Subject: [PATCH 4/4] remove redundant comparisons --- src/aijack/defense/paillier/torch_wrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aijack/defense/paillier/torch_wrapper.py b/src/aijack/defense/paillier/torch_wrapper.py index 35c2a313..5a2bdea9 100644 --- a/src/aijack/defense/paillier/torch_wrapper.py +++ b/src/aijack/defense/paillier/torch_wrapper.py @@ -21,9 +21,9 @@ class PaillierTensor(object): """torch.Tensor-like object for Paillier Encryption""" def __init__(self, paillier_array): - if isinstance(paillier_array, list) == True: + if isinstance(paillier_array, list): self._paillier_np_array = np.array(paillier_array) - elif isinstance(paillier_array, np.ndarray) == True: + elif isinstance(paillier_array, np.ndarray): self._paillier_np_array = paillier_array else: raise TypeError(f"{type(paillier_array)} is not supported.")