class_docstr: Joint training on the entire stream.
  
  JointTraining performs joint training (also called offline training) on
  the entire stream of data. This means that it is not a continual
  learning strategy but it can be used as an "offline" upper bound for
  them.
  
  .. warnings also::
      Currently :py:class:`JointTraining` adapts its own dataset.
      Please check that the plugins you are using do not implement
      :py:meth:`adapt_trainin_dataset`. Otherwise, they are incompatible
      with :py:class:`JointTraining`.
class_docstr_tok: ["Joint","training","on","the","entire","stream",".","JointTraining","performs","joint","training","(","also","called","offline","training",")","on","the","entire","stream","of","data",".","This","means","that","it","is","not","a","continual","learning","strategy","but","it","can","be","used","as","an","``","offline","''","upper","bound","for","them",".","..","warnings","also",":",":","Currently",":","py",":","class",":","`","JointTraining","`","adapts","its","own","dataset",".","Please","check","that","the","plugins","you","are","using","do","not","implement",":","py",":","meth",":","`","adapt_trainin_dataset","`",".","Otherwise",",","they","are","incompatible","with",":","py",":","class",":","`","JointTraining","`","."]
docstr: Init.
  
  :param model: PyTorch model.
  :param optimizer: PyTorch optimizer.
  :param criterion: loss function.
  :param train_mb_size: mini-batch size for training.
  :param train_epochs: number of training epochs.
  :param eval_mb_size: mini-batch size for eval.
  :param device: PyTorch device to run the model.
  :param plugins: (optional) list of StrategyPlugins.
  :param evaluator: (optional) instance of EvaluationPlugin for logging
      and metric computations. None to remove logging.
  :param eval_every: the frequency of the calls to `eval` inside the
      training loop. -1 disables the evaluation. 0 means `eval` is called
      only at the end of the learning experience. Values >0 mean that
      `eval` is called every `eval_every` epochs and at the end of the
      learning experience.
docstr_tok: ["Init",".",":","param","model",":","PyTorch","model",".",":","param","optimizer",":","PyTorch","optimizer",".",":","param","criterion",":","loss","function",".",":","param","train_mb_size",":","mini-batch","size","for","training",".",":","param","train_epochs",":","number","of","training","epochs",".",":","param","eval_mb_size",":","mini-batch","size","for","eval",".",":","param","device",":","PyTorch","device","to","run","the","model",".",":","param","plugins",":","(","optional",")","list","of","StrategyPlugins",".",":","param","evaluator",":","(","optional",")","instance","of","EvaluationPlugin","for","logging","and","metric","computations",".","None","to","remove","logging",".",":","param","eval_every",":","the","frequency","of","the","calls","to","`","eval","`","inside","the","training","loop",".","-1","disables","the","evaluation",".","0","means","`","eval","`","is","called","only","at","the","end","of","the","learning","experience",".","Values",">","0","mean","that","`","eval","`","is","called","every","`","eval_every","`","epochs","and","at","the","end","of","the","learning","experience","."]
code: def __init__(
      self,
      model: Module,
      optimizer: Optimizer,
      criterion,
      train_mb_size: int = 1,
      train_epochs: int = 1,
      eval_mb_size: int = 1,
      device: Union[str, torch.device] = "cpu",
      plugins: Optional[Sequence[TPluginType]] = None,
      evaluator: Union[
          EvaluationPlugin, Callable[[], EvaluationPlugin]
      ] = default_evaluator,
      eval_every=-1,
  ):
      """Init.
  
      :param model: PyTorch model.
      :param optimizer: PyTorch optimizer.
      :param criterion: loss function.
      :param train_mb_size: mini-batch size for training.
      :param train_epochs: number of training epochs.
      :param eval_mb_size: mini-batch size for eval.
      :param device: PyTorch device to run the model.
      :param plugins: (optional) list of StrategyPlugins.
      :param evaluator: (optional) instance of EvaluationPlugin for logging
          and metric computations. None to remove logging.
      :param eval_every: the frequency of the calls to `eval` inside the
          training loop. -1 disables the evaluation. 0 means `eval` is called
          only at the end of the learning experience. Values >0 mean that
          `eval` is called every `eval_every` epochs and at the end of the
          learning experience."""
      super().__init__(
          model=model,
          optimizer=optimizer,
          criterion=criterion,
          train_mb_size=train_mb_size,
          train_epochs=train_epochs,
          eval_mb_size=eval_mb_size,
          device=device,
          plugins=plugins,
          evaluator=evaluator,
          eval_every=eval_every,
      )
      # JointTraining can be trained only once.
      self._is_fitted = False
      self._experiences: List[TDatasetExperience] = []
  
file_path: avalanche/avalanche/training/supervised/joint_training.py
imports: from typing import Callable, Iterable, List, Optional, Sequence, TypeVar, Union
  import torch
  from torch.nn import Module
  from torch.optim import Optimizer
  from avalanche.benchmarks import DatasetExperience
  from avalanche.benchmarks.utils.utils import concat_datasets
  from avalanche.core import BasePlugin
  from avalanche.training.plugins.evaluation import EvaluationPlugin, default_evaluator
  from avalanche.training.templates import SupervisedTemplate
  from avalanche.models import DynamicModule
  from avalanche.training.templates.base import _experiences_parameter_as_iterable, _group_experiences_by_stream
label_desc: Use image node_id 1 to create a new JointTraining object from inherited base classes: SupervisedTemplate with example: obj = JointTraining(model, optimizer, criterion, train_mb_size, train_epochs, eval_mb_size, device, plugins, evaluator, eval_every)