class_docstr: Implicit Quantile Network Distribution Loss.
  
  Based on `Probabilistic Time Series Forecasting with Implicit Quantile Networks
  <https://arxiv.org/pdf/2107.03743.pdf>`_.
  A network is used to directly map network outputs to a quantile.
class_docstr_tok: ["Implicit","Quantile","Network","Distribution","Loss",".","Based","on","`","Probabilistic","Time","Series","Forecasting","with","Implicit","Quantile","Networks","<","https",":","\/\/arxiv.org\/pdf\/2107.03743.pdf",">","`","_",".","A","network","is","used","to","directly","map","network","outputs","to","a","quantile","."]
code: def to_prediction(
      self, y_pred: torch.Tensor, n_samples: int = 100
  ) -> torch.Tensor:
      if n_samples is None:
          return self.to_quantiles(y_pred, quantiles=[0.5]).squeeze(-1)
      else:
          # for a couple of random quantiles (excl. 0 and 1 as they would lead to infinities) make prediction
          return self.sample(y_pred, n_samples=n_samples).mean(-1)
  
imports: from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  from sklearn.base import BaseEstimator
  import torch
  from torch import distributions, nn
  import torch.nn.functional
  from pytorch_forecasting.data.encoders import TorchNormalizer, softplus_inv
  from pytorch_forecasting.metrics.base_metrics import DistributionLoss, MultivariateDistributionLoss
label_desc: Use image node_id 5 for calling the ImplicitQuantileNetworkDistributionLoss obj's underlying member method code with example usage: obj.to_prediction(y_pred, n_samples) and returns: self, self