Logic layers

torch_explain.nn.logic

class torch_explain.nn.logic.EntropyLinear(in_features: int, out_features: int, n_classes: int, temperature: float = 0.6, bias: bool = True, remove_attention: bool = False)

Applies a linear transformation to the incoming data: \(y = xA^T + b\)

extra_repr() str

Set the extra representation of the module

To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.

forward(input: Tensor) Tensor

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.