Calculates the output dimension of a neural network for a given task that is expected by mlr3torch. For classification, this is the number of classes (unless it is a binary classification task, where it is 1). For regression, it is 1.
This is an S3 generic and the single place where mlr3torch decides how many output neurons
a task needs: it is what PipeOpTorchHead and the LearnerTorchs that build their own head
ask. Adding a method for a new task type is therefore the way to support it, see the
"Supporting Other Task Types" section of PipeOpTorchHead.