From 4f4b8da22011fb68785849f9540662fa29acf8c6 Mon Sep 17 00:00:00 2001 From: priya sridhar <121922820+theperiperi@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:02:15 +0530 Subject: [PATCH] Fix for Issue #123 (#178) * Update torch_wrapper.py * Update torch_wrapper.py * Update torch_wrapper.py * remove redundant comparisons --------- Co-authored-by: Hideaki Takahashi --- 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..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 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.")