docstr: Train Seq2Seq model.
  
  Parameters
  ----------
  X
      Univariate or multivariate time series.
      Shape equals (batch, features) or (batch, sequence length, features).
  loss_fn
      Loss function used for training.
  optimizer
      Optimizer used for training.
  epochs
      Number of training epochs.
  batch_size
      Batch size used for training.
  verbose
      Whether to print training progress.
  log_metric
      Additional metrics whose progress will be displayed if verbose equals True.
  callbacks
      Callbacks used during training.
docstr_tok: ["Train","Seq2Seq","model",".","Parameters","--","--","--","--","--","X","Univariate","or","multivariate","time","series",".","Shape","equals","(","batch",",","features",")","or","(","batch",",","sequence","length",",","features",")",".","loss_fn","Loss","function","used","for","training",".","optimizer","Optimizer","used","for","training",".","epochs","Number","of","training","epochs",".","batch_size","Batch","size","used","for","training",".","verbose","Whether","to","print","training","progress",".","log_metric","Additional","metrics","whose","progress","will","be","displayed","if","verbose","equals","True",".","callbacks","Callbacks","used","during","training","."]
code: def fit(
      self,
      X: np.ndarray,
      loss_fn: tf.keras.losses = tf.keras.losses.mse,
      optimizer: OptimizerTF = tf.keras.optimizers.Adam,
      epochs: int = 20,
      batch_size: int = 64,
      verbose: bool = True,
      log_metric: Tuple[str, "tf.keras.metrics"] = None,
      callbacks: tf.keras.callbacks = None,
  ) -> None:
      """
      Train Seq2Seq model.
  
      Parameters
      ----------
      X
          Univariate or multivariate time series.
          Shape equals (batch, features) or (batch, sequence length, features).
      loss_fn
          Loss function used for training.
      optimizer
          Optimizer used for training.
      epochs
          Number of training epochs.
      batch_size
          Batch size used for training.
      verbose
          Whether to print training progress.
      log_metric
          Additional metrics whose progress will be displayed if verbose equals True.
      callbacks
          Callbacks used during training.
      """
      # targets for teacher-forcing
      if len(X.shape) == 2:
          y = np.roll(X, -1, axis=0).reshape(self.shape)
          X = X.reshape(self.shape)
      else:
          y = np.roll(
              X.reshape((-1, self.shape[-1])), -1, axis=0
          ).reshape(self.shape)
  
      # train arguments
      args = [self.seq2seq, loss_fn, X]
      optimizer = (
          optimizer() if isinstance(optimizer, type) else optimizer
      )
      kwargs = {
          "y_train": y,
          "optimizer": optimizer,
          "epochs": epochs,
          "batch_size": batch_size,
          "verbose": verbose,
          "log_metric": log_metric,
          "callbacks": callbacks,
      }
  
      # train
      trainer(*args, **kwargs)
  
imports: import logging
  import numpy
  import tensorflow
  from tensorflow.keras.layers import Dense, InputLayer
  from typing import Dict, Tuple, Union
  from alibi_detect.models.tensorflow.autoencoder import Seq2Seq, EncoderLSTM, DecoderLSTM
  from alibi_detect.models.tensorflow.trainer import trainer
  from alibi_detect.base import BaseDetector, FitMixin, ThresholdMixin, outlier_prediction_dict
  from alibi_detect.utils.tensorflow.prediction import predict_batch
  from alibi_detect.utils._types import OptimizerTF
label_desc: Use image node_id 2 for calling the OutlierSeq2Seq obj's underlying member method code with example usage: obj.fit(X, loss_fn, optimizer, epochs, batch_size, verbose, log_metric, callbacks) without return types