output_size
- hybrid_learning.concepts.models.model_extension.output_size(model, input_size, has_batch_dim=False, layer_id=None)[source]
Feed dummy input of input_size to model to determine the output size of the layer with ID
layer_id
. If no layer ID is given, the size of the model final output is returned.Will raise if the model output is not a single tensor. This essentially is a wrapper around
output_sizes()
that uses the fact that the model also occurs in itstorch.nn.Module.named_modules()
listing, with ID''
. So, the model output can also be obtained by registering a hook to''
.- Parameters
model (Module) – the model the output of which is to be investigated
input_size (Sequence[int]) – a single, all-zero tensor of that size is fed to the model
layer_id (Optional[str]) – the ID of the layer to inspect; if not given, all layers (i.e.
''
) are inspectedhas_batch_dim (bool) – whether the given
input_size
already features a batch dimension; added if not
- Return type
Size