Skip to content

Commit caa9c2a

Browse files
author
Beat Buesser
committed
Fix LGTM warnings
Signed-off-by: Beat Buesser <[email protected]>
1 parent edfac24 commit caa9c2a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

art/attacks/inference/membership_inference/black_box.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(
9090
else:
9191
self.default_model = True
9292
if self.attack_model_type == "nn":
93-
import torch # lgtm [py/repeated-import]
93+
import torch # lgtm [py/repeated-import] lgtm [py/import-and-import-from]
9494
from torch import nn # lgtm [py/repeated-import]
9595

9696
class MembershipInferenceAttackModel(nn.Module):
@@ -212,7 +212,7 @@ def fit( # pylint: disable=W0613
212212
x_2 = x_2.astype(np.float32).reshape(-1, 1)
213213

214214
if self.default_model and self.attack_model_type == "nn":
215-
import torch # lgtm [py/repeated-import]
215+
import torch # lgtm [py/repeated-import] lgtm [py/import-and-import-from]
216216
from torch import nn # lgtm [py/repeated-import]
217217
from torch import optim # lgtm [py/repeated-import]
218218
from torch.utils.data import DataLoader # lgtm [py/repeated-import]
@@ -281,7 +281,7 @@ def infer(self, x: np.ndarray, y: Optional[np.ndarray] = None, **kwargs) -> np.n
281281
y = y.astype(np.float32).reshape(-1, 1)
282282

283283
if self.default_model and self.attack_model_type == "nn":
284-
import torch # lgtm [py/repeated-import]
284+
import torch # lgtm [py/repeated-import] lgtm [py/import-and-import-from]
285285
from torch.utils.data import DataLoader # lgtm [py/repeated-import]
286286
from art.utils import to_cuda, from_cuda
287287

@@ -338,7 +338,7 @@ class AttackDataset(Dataset):
338338
"""
339339

340340
def __init__(self, x_1, x_2, y=None):
341-
import torch # lgtm [py/repeated-import]
341+
import torch # lgtm [py/repeated-import] lgtm [py/import-and-import-from]
342342

343343
self.x_1 = torch.from_numpy(x_1.astype(np.float64)).type(torch.FloatTensor)
344344
self.x_2 = torch.from_numpy(x_2.astype(np.int32)).type(torch.FloatTensor)

0 commit comments

Comments
 (0)