peal.adaptors.didae.ProbeModel¶
- class peal.adaptors.didae.ProbeModel[source]¶
Bases:
ModuleLinear probe on the generator’s
z_semposing as a binary classifier.Wraps the distilled probe
(w, bias)of step 1 so it can be evaluated withcalculate_test_accuracylike the student: an image in classifier normalisation is converted to generator normalisation, encoded toz_semand scored ass = z @ w + bias; the output logits are[-s, s]soargmaxgives class 1 whens > 0.- Parameters:
generator (
InvertibleGenerator) – Generator withencode(x, only_semantic=True).w (
torch.Tensor) – Probe weight of shape(encoder_dim,).bias (
float) – Probe bias.classifier_to_generator (
callable) – Maps classifier-normalised images to generator normalisation.device (
strortorch.device) – Device the encoding runs on.
Methods
Return
(B, 2)logits[-s, s]for a batch of classifier inputs.