class_docstr: Abstract base class for deep learning networks using torch.nn.
class_docstr_tok: ["Abstract","base","class","for","deep","learning","networks","using","torch.nn","."]
docstr: Predict with fitted model.
docstr_tok: ["Predict","with","fitted","model","."]
code: def _predict(self, X=None, fh=None):
      """Predict with fitted model."""
      from torch import cat
  
      if fh is None:
          fh = self._fh
  
      if max(fh._values) > self.network.pred_len or min(fh._values) < 0:
          raise ValueError(
              f"fh of {fh} passed to {self.__class__.__name__} is not "
              "within `pred_len`. Please use a fh that aligns with the `pred_len` of "
              "the forecaster."
          )
  
      if X is None:
          dataloader = self.build_pytorch_pred_dataloader(self._y, fh)
      else:
          dataloader = self.build_pytorch_pred_dataloader(X, fh)
  
      y_pred = []
      for x, _ in dataloader:
          y_pred.append(self.network(x).detach())
      y_pred = cat(y_pred, dim=0).view(-1, y_pred[0].shape[-1]).numpy()
      y_pred = y_pred[fh._values.values - 1]
      y_pred = pd.DataFrame(
          y_pred,
          columns=self._y.columns,
          index=fh.to_absolute_index(self.cutoff),
      )
  
      return y_pred
  
imports: from abc import ABC, abstractmethod
  import numpy
  import pandas
  from sktime.base import BaseObject
  from sktime.forecasting.base import BaseForecaster
  from sktime.utils.validation._dependencies import _check_soft_dependencies
label_desc: Use image node_id 3 for calling the BaseDeepNetworkPyTorch obj's underlying member method code with example usage: obj._predict(X, fh) and returns: y_pred