MCPcopy
hub / github.com/openai/transformer-debugger / __init__

Method __init__

neuron_explainer/models/hooks.py:279–289  ·  view source on GitHub ↗
(self, encode, decode, add_error=False)

Source from the content-addressed store, hash-verified

277 """
278
279 def __init__(self, encode, decode, add_error=False):
280 super().__init__()
281 # hooks
282 self.add_subhooks("latents", FwdBwdHooks())
283 self.add_subhooks("reconstruction", FwdBwdHooks())
284 self.add_subhooks("error", FwdBwdHooks())
285 # autoencoder functions
286 self.encode = encode
287 self.decode = decode
288 # if add_error is True, add the error to the reconstruction.
289 self.add_error = add_error
290
291 def __call__(self, x, *args, **kwargs):
292 latents = self.encode(x)

Callers

nothing calls this directly

Calls 3

FwdBwdHooksClass · 0.85
add_subhooksMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected