Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
Signed-off-by: iamsh4shank <[email protected]>
  • Loading branch information
iamsh4shank committed Sep 9, 2023
1 parent 49a81b6 commit a51511a
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 492 deletions.
48 changes: 32 additions & 16 deletions art/attacks/inference/membership_inference/blindMI_attack.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

# Copyright (c) 2023 Yisroel Mirsky

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""
This module implements membership inference attacks.
This module implements the Practical Blind Membership Inference Attack via Differential Comparison
| Paper link: https://arxiv.org/abs/2101.01341
Module author:
Shashank Priyadarshi
Contributed by:
The Offensive AI Research Lab
Ben-Gurion University, Israel
https://offensive-ai-lab.github.io/
Sponsored by INCD
"""

from __future__ import absolute_import, division, print_function, unicode_literals
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# MIT License

# Copyright (c) 2023 Yisroel Mirsky

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""
This module implements the Membership Inference Attack Using Self Influence Functions
| Paper link: https://arxiv.org/abs/2205.13680
Module author:
Shashank Priyadarshi
Contributed by:
The Offensive AI Research Lab
Ben-Gurion University, Israel
https://offensive-ai-lab.github.io/
Sponsored by INCD
"""

from art.utils import check_and_transform_label_format

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'check_and_transform_label_format' is not used.
from art.estimators.classification.classifier import ClassifierMixin
from art.estimators.estimator import BaseEstimator
Expand Down
13 changes: 13 additions & 0 deletions art/estimators/classification/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,19 @@ def device(self) -> "torch.device":
def model(self) -> "torch.nn.Module":
return self._model._model # pylint: disable=W0212

@property
def named_parameters():
return self._model.named_parameters()

@property
def parameters(self) -> List["torch.nn.Parameter"]:
"""
Get the model parameters.
:return: The model parameters.
"""
return list(self._model.parameters())

@property
def input_shape(self) -> Tuple[int, ...]:
"""
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit a51511a

Please sign in to comment.