class_docstr: Base pytorch Module with support for task labels.
  
  Multi-task modules are ``torch.nn.Module`` for multi-task
  scenarios. The ``forward`` method accepts task labels, one for
  each sample in the mini-batch.
  
  By default the ``forward`` method splits the mini-batch by task
  and calls ``forward_single_task``. Subclasses must implement
  ``forward_single_task`` or override `forward. If ``task_labels == None``,
  the output is computed in parallel for each task.
class_docstr_tok: ["Base","pytorch","Module","with","support","for","task","labels",".","Multi-task","modules","are","``","torch.nn.Module","``","for","multi-task","scenarios",".","The","``","forward","``","method","accepts","task","labels",",","one","for","each","sample","in","the","mini-batch",".","By","default","the","``","forward","``","method","splits","the","mini-batch","by","task","and","calls","``","forward_single_task","``",".","Subclasses","must","implement","``","forward_single_task","``","or","override","`","forward",".","If","``","task_labels","==","None","``",",","the","output","is","computed","in","parallel","for","each","task","."]
docstr: compute the output given the input `x` and task label.
  By default, it considers only tasks seen at training time.
  
  :param x:
  :return: all the possible outputs are returned as a dictionary
      with task IDs as keys and the output of the corresponding
      task as output.
docstr_tok: ["compute","the","output","given","the","input","`","x","`","and","task","label",".","By","default",",","it","considers","only","tasks","seen","at","training","time",".",":","param","x",":",":","return",":","all","the","possible","outputs","are","returned","as","a","dictionary","with","task","IDs","as","keys","and","the","output","of","the","corresponding","task","as","output","."]
code: def forward_all_tasks(self, x: torch.Tensor):
      """compute the output given the input `x` and task label.
      By default, it considers only tasks seen at training time.
  
      :param x:
      :return: all the possible outputs are returned as a dictionary
          with task IDs as keys and the output of the corresponding
          task as output.
      """
      res = {}
      for task_id in self.known_train_tasks_labels:
          res[task_id] = self.forward_single_task(x, task_id)
      return res
  
imports: import torch
  from torch.nn import Module
  from typing import Optional
  from avalanche.benchmarks.utils.flat_data import ConstantSequence
  from avalanche.benchmarks.scenarios import CLExperience
label_desc: Use image node_id 7 for calling the MultiTaskModule obj's underlying member method code with example usage: obj.forward_all_tasks(x) and returns: res