Skip to content

Commit fdd69f5

Browse files
csferngtensorflow-copybara
authored andcommitted
Nicer error message for saving AdversarialRegularization models.
Discussion in #23. PiperOrigin-RevId: 274057607
1 parent aadfecf commit fdd69f5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

neural_structured_learning/keras/adversarial_regularization.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,11 @@ def call(self, inputs, **kwargs):
645645
self.add_metric(adv_loss, name='adversarial_loss', aggregation='mean')
646646
return outputs
647647

648+
def save(self, *args, **kwargs):
649+
raise NotImplementedError(
650+
'Saving `AdversarialRegularization` models is currently not supported. '
651+
'Consider using `save_weights` or saving the `base_model`.')
652+
648653
def perturb_on_batch(self, x, **config_kwargs):
649654
"""Perturbs the given input to generates adversarial examples.
650655

0 commit comments

Comments
 (0)