Skip to content
Snippets Groups Projects
Commit bb6252d6 authored by Mina Moshfegh's avatar Mina Moshfegh
Browse files

Upload New File

parent 18b52bc1
No related branches found
No related tags found
No related merge requests found
import abc
# Base class for defense strategies in this framework.
class BaseDefense(metaclass=abc.ABCMeta):
def __init__(self, student_model, teacher_model=None):
# student_model is the model being trained or adapted,
# teacher_model might be the model from the previous step/task.
self.student_model = student_model
self.teacher_model = teacher_model
@abc.abstractmethod
def loss_function(self, x, y, **kwargs):
# Must return a scalar loss that can be backpropagated.
pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment