tabensemb.model.AbstractNN._test_required_model#

method

static AbstractNN._test_required_model(n_inputs: int, required_model: AbstractModel | AbstractNN | AbstractWrapper) Tuple[bool, int][source]#

Test whether a required model has the attribute hidden_rep_dim and find its value.

Parameters:
n_inputs

The dimension of the input (i.e. the x of _forward())

required_model

A required model specified in AbstractModel.required_models() and extracted by AbstractModel._get_required_models().

Returns:
bool

Whether the required model has the attribute hidden_rep_dim

int

The dimension of the hidden representation. If the required model does not have the attribute hidden_rep_dim, 1+n_inputs is returned.

Notes

For an AbstractNN, whether the hidden representation (hidden_representation) is recorded is not guaranteed.